Skip to content

Commit

Permalink
build: Simplify the PHP-Scoper configuration (#1146)
Browse files Browse the repository at this point in the history
- Leverage the PHP-Scoper scripts.
- Doing the above actually fix some symbols from the Solr extension that were aliased due to a PHPStorm stub directory not being loaded correctly.
- Remove the unnecessary polyfill whitelisted (obsolete as of PHP-Scoper
  0.18.0).
- Exclude some UV related symbols here while waiting for a patch in
  PHP-Scoper.
  • Loading branch information
theofidry authored Nov 5, 2023
1 parent dac5797 commit 587dcb6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 140 deletions.
39 changes: 0 additions & 39 deletions res/scoper-phpstorm-stubs-map-patcher.php

This file was deleted.

49 changes: 0 additions & 49 deletions res/scoper-phpstorm-stubs.php

This file was deleted.

42 changes: 0 additions & 42 deletions res/scoper-polyfills.php

This file was deleted.

23 changes: 13 additions & 10 deletions scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
],
Expand All @@ -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,
Expand All @@ -45,6 +48,6 @@
\KevinGH\Box\Compactor\PhpScoper::class,
],
'patchers' => [
$jetBrainStubPatcher,
$jetBrainStubsPatcher,
]
];

0 comments on commit 587dcb6

Please sign in to comment.