Skip to content

Commit

Permalink
Fix the PHP 7.1 polyfill autoloading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry committed Mar 5, 2019
1 parent cfc7c11 commit 10cedf2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ function (string $filePath, string $prefix, string $contents): string {

return $contents;
},
function (string $filePath, string $prefix, string $contents): string {
if ('vendor/symfony/polyfill-php72/bootstrap.php' !== $filePath) {
return $contents;
}

return preg_replace(
'/namespace .+;/',
'',
$contents
);
},
],
'files-whitelist' => [
__DIR__.'/vendor/composer/composer/src/Composer/Autoload/ClassLoader.php',
Expand All @@ -157,6 +168,18 @@ function (string $filePath, string $prefix, string $contents): string {
\KevinGH\Box\Compactor\Php::class,
\KevinGH\Box\Compactor\PhpScoper::class,

// Symfony Polyfill for PHP 7.1 support
// https://github.com/humbug/php-scoper/issues/304
'sapi_windows_vt100_support',
'stream_isatty',
'utf8_encode',
'utf8_decode',
'spl_object_id',
'PHP_OS_FAMILY',
'mb_chr',
'mb_ord',
'mb_scrub',

// Hoa symbols
'SUCCEED',
'FAILED',
Expand Down

0 comments on commit 10cedf2

Please sign in to comment.