From 9796e421801d6af9653bfb1fdb82ec851fa34f56 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Sun, 31 Jan 2021 02:00:13 +0100 Subject: [PATCH] Update php-scoper and fix Symfony polyfill issues --- bin/scope-vendor-fix.php | 1 - bin/scope-vendor.sh | 2 +- scoper.inc.php | 20 ++++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/bin/scope-vendor-fix.php b/bin/scope-vendor-fix.php index bcfd9f1..07074c0 100644 --- a/bin/scope-vendor-fix.php +++ b/bin/scope-vendor-fix.php @@ -13,7 +13,6 @@ $scoper_path = __DIR__ . '/../build/vendor/composer'; - $static_loader_path = "{$scoper_path}/autoload_static.php"; echo " > Fixing {$static_loader_path}\n"; diff --git a/bin/scope-vendor.sh b/bin/scope-vendor.sh index 81f13c8..a014662 100755 --- a/bin/scope-vendor.sh +++ b/bin/scope-vendor.sh @@ -2,7 +2,7 @@ if [[ ! -e bin/php-scoper.phar ]]; then echo " > Downloading php-scoper.phar" echo "" - curl -sSL -o bin/php-scoper.phar https://github.com/humbug/php-scoper/releases/download/0.13.1/php-scoper.phar + curl -sSL -o bin/php-scoper.phar https://github.com/humbug/php-scoper/releases/download/0.14.0/php-scoper.phar fi echo " > Making sure composer vendor files are on the locked version" diff --git a/scoper.inc.php b/scoper.inc.php index 377f0f9..33c4b3d 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -4,6 +4,12 @@ use Isolated\Symfony\Component\Finder\Finder; +$polyfillsBootstrap = Finder::create() + ->files() + ->in( __DIR__ . '/vendor/symfony/polyfill-*' ) + ->name( 'bootstrap.php' ) + ->name( 'bootstrap80.php' ); + return [ 'prefix' => 'WPSentry\\ScopedVendor', @@ -27,13 +33,19 @@ ], 'whitelist' => [ - 'Sentry\*', - 'Monolog\*', + 'Sentry\\*', + 'Monolog\\*', + 'Symfony\\Polyfill\\*', ], - 'files-whitelist' => [ + 'files-whitelist' => array_merge( [ 'vendor/ralouphie/getallheaders/src/getallheaders.php', - ], + ], array_map( + static function ( $file ) { + return $file->getPathName(); + }, + iterator_to_array( $polyfillsBootstrap ) + ) ), 'whitelist-global-classes' => true, 'whitelist-global-constants' => true,