diff --git a/res/scoper-phpstorm-stubs-map-patcher.php b/res/scoper-phpstorm-stubs-map-patcher.php deleted file mode 100644 index 17914f73f..000000000 --- a/res/scoper-phpstorm-stubs-map-patcher.php +++ /dev/null @@ -1,39 +0,0 @@ - - * Théo Fidry - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -$stubsMapVendorPath = 'vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php'; -$stubsMapPath = __DIR__.'/../'.$stubsMapVendorPath; -$stubsMapOriginalContent = file_get_contents($stubsMapPath); - -if (!preg_match('/class PhpStormStubsMap([\s\S]+)/', $stubsMapOriginalContent, $matches)) { - throw new InvalidArgumentException('Could not capture the map original content.'); -} - -$stubsMapClassOriginalContent = $matches[1]; - -return static function (string $filePath, string $prefix, string $contents) -use ( - $stubsMapVendorPath, - $stubsMapClassOriginalContent, -): string { - if ($filePath !== $stubsMapVendorPath) { - return $contents; - } - - return preg_replace( - '/class PhpStormStubsMap([\s\S]+)/', - 'class PhpStormStubsMap'.$stubsMapClassOriginalContent, - $contents, - ); -}; diff --git a/res/scoper-phpstorm-stubs.php b/res/scoper-phpstorm-stubs.php deleted file mode 100644 index 8ed329d0e..000000000 --- a/res/scoper-phpstorm-stubs.php +++ /dev/null @@ -1,49 +0,0 @@ - - * Théo Fidry - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder; - -$jetBrainStubs = (static function (): array { - $files = []; - - foreach (new DirectoryIterator(__DIR__.'/../vendor/jetbrains/phpstorm-stubs') as $directoryInfo) { - if ($directoryInfo->isDot()) { - continue; - } - - if (false === $directoryInfo->isDir()) { - continue; - } - - if (in_array($directoryInfo->getBasename(), ['tests', 'meta'], true)) { - continue; - } - - foreach (new DirectoryIterator($directoryInfo->getPathName()) as $fileInfo) { - if ($fileInfo->isDot()) { - continue; - } - - if (1 !== preg_match('/\.php$/', $fileInfo->getBasename())) { - continue; - } - - $files[] = $fileInfo->getPathName(); - } - } - - return $files; -})(); - -return [...$jetBrainStubs]; diff --git a/res/scoper-polyfills.php b/res/scoper-polyfills.php deleted file mode 100644 index b69fbc829..000000000 --- a/res/scoper-polyfills.php +++ /dev/null @@ -1,42 +0,0 @@ - - * Théo Fidry - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder; - -$polyfillsBootstraps = array_map( - static fn (SplFileInfo $fileInfo) => $fileInfo->getPathname(), - iterator_to_array( - IsolatedFinder::create() - ->files() - ->in(__DIR__ . '/../vendor/symfony/polyfill-*') - ->name('bootstrap*.php'), - false, - ), -); - -$polyfillsStubs = array_map( - static fn (SplFileInfo $fileInfo) => $fileInfo->getPathname(), - iterator_to_array( - IsolatedFinder::create() - ->files() - ->in(__DIR__ . '/../vendor/symfony/polyfill-*/Resources/stubs') - ->name('*.php'), - false, - ), -); - -return [ - ...$polyfillsBootstraps, - ...$polyfillsStubs, -]; diff --git a/scoper.inc.php b/scoper.inc.php index 008ad8fdf..73a8a55dd 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -14,15 +14,15 @@ use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder; -$polyfillFiles = require __DIR__.'/res/scoper-polyfills.php'; -$jetBrainStubFiles = require __DIR__.'/res/scoper-phpstorm-stubs.php'; -$jetBrainStubPatcher = require __DIR__.'/res/scoper-phpstorm-stubs-map-patcher.php'; +$jetBrainStubs = (require __DIR__.'/vendor/humbug/php-scoper/res/get-scoper-phpstorm-stubs.php')( + __DIR__.'/vendor/jetbrains/phpstorm-stubs', +); +$jetBrainStubsPatcher = (require __DIR__.'/vendor/humbug/php-scoper/res/create-scoper-phpstorm-stubs-map-patcher.php')( + stubsMapPath: __DIR__.'/vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php', +); return [ - 'exclude-files' => [ - ...$polyfillFiles, - ...$jetBrainStubFiles, - ], + 'exclude-files' => $jetBrainStubs, 'exclude-namespaces' => [ 'Symfony\Polyfill' ], @@ -33,8 +33,11 @@ // Symfony global constants '/^SYMFONY\_[\p{L}_]+$/', ], - 'expose-functions' => [ - 'trigger_deprecation', + 'exclude-functions' => [ + // https://github.com/humbug/php-scoper/pull/894 + 'uv_poll_init_socket', + 'uv_signal_init', + 'uv_signal_start', ], 'expose-classes' => [ \Composer\Autoload\ClassLoader::class, @@ -45,6 +48,6 @@ \KevinGH\Box\Compactor\PhpScoper::class, ], 'patchers' => [ - $jetBrainStubPatcher, + $jetBrainStubsPatcher, ] ];