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