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

chore: Update Box #2905

Draft
wants to merge 8 commits into
base: 1.10.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checksum-phar.yml
Expand Up @@ -80,7 +80,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
php-version: "8.2"
extensions: mbstring, intl

- name: "Install dependencies"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phar.yml
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
php-version: "8.2"
extensions: mbstring, intl

- name: "Install dependencies"
Expand Down
44 changes: 0 additions & 44 deletions bin/phpstan
Expand Up @@ -35,50 +35,6 @@ use Symfony\Component\Console\Helper\ProgressBar;
}
$devOrPharLoader->unregister();

$composerAutoloadFiles = $GLOBALS['__composer_autoload_files'];
if (
!array_key_exists('e88992873b7765f9b5710cab95ba5dd7', $composerAutoloadFiles)
|| !array_key_exists('3e76f7f02b41af8cea96018933f6b7e3', $composerAutoloadFiles)
|| !array_key_exists('a4a119a56e50fbb293281d9a48007e0e', $composerAutoloadFiles)
|| !array_key_exists('0e6d7bf4a5811bfa5cf40c5ccd6fae6a', $composerAutoloadFiles)
|| !array_key_exists('e69f7f6ee287b969198c3c9d6777bd38', $composerAutoloadFiles)
|| !array_key_exists('0d59ee240a4cd96ddbb4ff164fccea4d', $composerAutoloadFiles)
|| !array_key_exists('b686b8e46447868025a15ce5d0cb2634', $composerAutoloadFiles)
|| !array_key_exists('8825ede83f2f289127722d4e842cf7e8', $composerAutoloadFiles)
|| !array_key_exists('23c18046f52bef3eea034657bafda50f', $composerAutoloadFiles)
) {
echo "Composer autoloader changed\n";
exit(1);
}

// empty the global variable so that unprefixed functions from user-space can be loaded
$GLOBALS['__composer_autoload_files'] = [
// fix unprefixed Hoa namespace - files already loaded
'e88992873b7765f9b5710cab95ba5dd7' => true,
'3e76f7f02b41af8cea96018933f6b7e3' => true,

// vendor/symfony/polyfill-php80/bootstrap.php
'a4a119a56e50fbb293281d9a48007e0e' => true,

// vendor/symfony/polyfill-mbstring/bootstrap.php
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => true,

// vendor/symfony/polyfill-intl-normalizer/bootstrap.php
'e69f7f6ee287b969198c3c9d6777bd38' => true,

// vendor/symfony/polyfill-php73/bootstrap.php
'0d59ee240a4cd96ddbb4ff164fccea4d' => true,

// vendor/symfony/polyfill-php74/bootstrap.php
'b686b8e46447868025a15ce5d0cb2634' => true,

// vendor/symfony/polyfill-intl-grapheme/bootstrap.php
'8825ede83f2f289127722d4e842cf7e8' => true,

// vendor/symfony/polyfill-php81/bootstrap.php
'23c18046f52bef3eea034657bafda50f' => true,
];

$autoloaderInWorkingDirectory = $vendorDirectory . '/autoload.php';
$composerAutoloaderProjectPaths = [];

Expand Down
Binary file modified compiler/build/box.phar 100755 → 100644
Binary file not shown.
51 changes: 37 additions & 14 deletions compiler/build/scoper.inc.php
Expand Up @@ -8,6 +8,7 @@
'../../resources/functionMap_php80delta.php',
'../../resources/functionMetadata.php',
'../../vendor/hoa/consistency/Prelude.php',
'../../vendor/hoa/protocol/Wrapper.php',
'../../vendor/composer/InstalledVersions.php',
'../../vendor/composer/installed.php',
];
Expand All @@ -16,13 +17,13 @@
'../../stubs',
'../../vendor/jetbrains/phpstorm-stubs',
'../../vendor/phpstan/php-8-stubs/stubs',
'../../vendor/symfony/polyfill-php80',
'../../vendor/symfony/polyfill-php81',
'../../vendor/symfony/polyfill-mbstring',
'../../vendor/symfony/polyfill-intl-normalizer',
'../../vendor/symfony/polyfill-php73',
'../../vendor/symfony/polyfill-php74',
'../../vendor/symfony/polyfill-intl-grapheme',
// '../../vendor/symfony/polyfill-php80',
// '../../vendor/symfony/polyfill-php81',
// '../../vendor/symfony/polyfill-mbstring',
// '../../vendor/symfony/polyfill-intl-normalizer',
// '../../vendor/symfony/polyfill-php73',
// '../../vendor/symfony/polyfill-php74',
// '../../vendor/symfony/polyfill-intl-grapheme',
]) as $file) {
if ($file->getPathName() === '../../vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php') {
continue;
Expand Down Expand Up @@ -218,19 +219,41 @@ function (string $filePath, string $prefix, string $content): string {

return str_replace(sprintf('use %s\\PhpParser;', $prefix), 'use PhpParser;', $content);
},
// Patch to mimic the expected solution result for https://github.com/humbug/php-scoper/issues/963
function (string $filePath, string $prefix, string $content): string {
return preg_replace_callback(
'/if \(\s*!\s*\\\?function_exists\(\'\\\?(?<functionFQN>.+)\'\)\)[\s\n]{/',
static function(array $matches) use ($prefix): string {
$matchedElement = $matches[0];
$functionFqn = $matches['functionFQN'];

if (str_starts_with($functionFqn, $prefix)) {
return $matchedElement;
}

return sprintf(
'if (!function_exists(\'%1$s\') && !function_exists(\'%2$s\%1$s\')) {',
$functionFqn,
$prefix,
);
},
$content,
-1
);
},
],
'exclude-namespaces' => [
'PHPStan',
'PHPUnit',
'PhpParser',
'Hoa',
'Symfony\Polyfill\Php80',
'Symfony\Polyfill\Php81',
'Symfony\Polyfill\Mbstring',
'Symfony\Polyfill\Intl\Normalizer',
'Symfony\Polyfill\Php73',
'Symfony\Polyfill\Php74',
'Symfony\Polyfill\Intl\Grapheme',
// 'Symfony\Polyfill\Php80',
// 'Symfony\Polyfill\Php81',
// 'Symfony\Polyfill\Mbstring',
// 'Symfony\Polyfill\Intl\Normalizer',
// 'Symfony\Polyfill\Php73',
// 'Symfony\Polyfill\Php74',
// 'Symfony\Polyfill\Intl\Grapheme',
],
'expose-global-functions' => false,
'expose-global-classes' => false,
Expand Down