From eea6c966af9c8bb55a84c2540c0ebb4adcc3f90b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 25 Dec 2019 22:03:51 +0100 Subject: [PATCH] 7to5 fix --- src/polyfill.php | 14 ++++++++++++++ tests/makephar.sh | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/polyfill.php b/src/polyfill.php index 78a960b4..7ffd1c80 100644 --- a/src/polyfill.php +++ b/src/polyfill.php @@ -8,6 +8,20 @@ function returnMe($res) { return $res; } +function __coalesce($ifNotNull, $then) { + return $ifNotNull ? $ifNotNull : $then; +} +function __destructure($list, $value) { + $res = []; + foreach ($list as $key) { + if (is_string($key)) { + $res []= $value[$key]; + } else { + $res = array_merge($res, __destructure($key, $value[$key])); + } + } + return $res; +} if (!\function_exists('is_iterable')) { function is_iterable($var) { diff --git a/tests/makephar.sh b/tests/makephar.sh index e58adf6f..be32a0b4 100755 --- a/tests/makephar.sh +++ b/tests/makephar.sh @@ -51,7 +51,7 @@ cd .. sudo apt-get update -q sudo apt-get install php7.3-cli php7.3-json php7.3-mbstring php7.3-curl php7.3-xml php7.3-json -y - composer global require spatie/7to5 dev-master#d4be6d0 + composer global require spatie/7to5 dev-master#0420ad3 [ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5 [ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5