Skip to content

Commit

Permalink
Make prefixed applied for PHP-Scoper PHAR random (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Oct 9, 2017
1 parent 079c5bc commit 3f8a6cb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/box.json
/dist/
/build/
/fixtures/set004/scoper.inc.php
/fixtures/*/vendor
/vendor/
/vendor-bin/box/vendor/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions bin/php-scoper
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
'box.json.dist',
]),
],
'whitelist' => [
Finder::class,
],
'patchers' => [
function (string $filePath, string $prefix, string $content): string {
//
Expand Down

0 comments on commit 3f8a6cb

Please sign in to comment.