diff --git a/.gitignore b/.gitignore index 0934d2ca..219148f5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /box.json /dist/ /build/ +/fixtures/set004/scoper.inc.php /fixtures/*/vendor /vendor/ /vendor-bin/box/vendor/ diff --git a/Makefile b/Makefile index 69540f5a..00ecb345 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ build: bin/php-scoper src vendor vendor-bin/box/vendor scoper.inc.php composer install --no-dev --prefer-dist # Prefixes the code to be bundled - php -d zend.enable_gc=0 bin/php-scoper add-prefix --prefix=Isolated --output-dir=build/php-scoper --force + php -d zend.enable_gc=0 bin/php-scoper add-prefix --output-dir=build/php-scoper --force # Re-dump the loader to account for the prefixing # and optimize the loader diff --git a/bin/php-scoper b/bin/php-scoper index b7762a38..1ce60ee4 100755 --- a/bin/php-scoper +++ b/bin/php-scoper @@ -13,7 +13,9 @@ namespace Humbug\PhpScoper; +use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder; use RuntimeException; +use Symfony\Component\Finder\Finder; $findAutoload = function () { if (file_exists($autoload = __DIR__.'/../../../autoload.php')) { @@ -39,8 +41,8 @@ $autoload = $findAutoload(); require $autoload; // Exposes the finder used by PHP-Scoper PHAR to allow its usage in the configuration file. -if (false === class_exists('Isolated\Symfony\Component\Finder\Finder')) { - class_alias('Symfony\Component\Finder\Finder', 'Isolated\Symfony\Component\Finder\Finder'); +if (false === class_exists(IsolatedFinder::class)) { + class_alias(Finder::class, IsolatedFinder::class); } $isVeryVerbose = array_reduce( diff --git a/scoper.inc.php b/scoper.inc.php index 55741aae..96b2fe3a 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -36,6 +36,9 @@ 'box.json.dist', ]), ], + 'whitelist' => [ + Finder::class, + ], 'patchers' => [ function (string $filePath, string $prefix, string $content): string { //