Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make prefixed applied for PHP-Scoper PHAR random #119

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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