Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Fix symfony polyfills in scoper (#2998)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelre authored Mar 1, 2021
1 parent 07d1e7f commit 9d58e23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
21 changes: 19 additions & 2 deletions packages/easy-coding-standard/scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

declare(strict_types=1);

use Isolated\Symfony\Component\Finder\Finder;

$symfonyPolyfillPhpFilesFinder = Finder::create();
$symfonyPolyfillPhpFilesFinder = $symfonyPolyfillPhpFilesFinder->files();
$symfonyPolyfillPhpFilesFinder = $symfonyPolyfillPhpFilesFinder->in(__DIR__ . '/vendor/symfony/polyfill-*');
$symfonyPolyfillPhpFilesFinder = $symfonyPolyfillPhpFilesFinder->name('*.php');

$symfonyPolyfillPhpFilesArray = \iterator_to_array($symfonyPolyfillPhpFilesFinder);
$symfonyPolyfillPhpFilenames = \array_values($symfonyPolyfillPhpFilesArray);
$symfonyPolyfillAllowlist = \array_map(
static function ($file) {
return $file->getPathName();
},
$symfonyPolyfillPhpFilenames
);

return [
'files-whitelist' => [
// do not prefix "trigger_deprecatoin" from symfony - https://github.com/symfony/symfony/commit/0032b2a2893d3be592d4312b7b098fb9d71aca03
// do not prefix "trigger_deprecation" from symfony - https://github.com/symfony/symfony/commit/0032b2a2893d3be592d4312b7b098fb9d71aca03
// these paths are relative to this file location, so it should be in the root directory
'vendor/symfony/deprecation-contracts/function.php',
],
] + $symfonyPolyfillAllowlist,
'whitelist' => [
// needed for autoload, that is not prefixed, since it's in bin/* file
'Symplify\*',
Expand All @@ -16,5 +32,6 @@
'SlevomatCodingStandard\*',
'Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator',
'Symfony\Component\DependencyInjection\Extension\ExtensionInterface',
'Symfony\Polyfill\*',
],
];
8 changes: 7 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,10 @@ parameters:
- packages/set-config-resolver/src/ConfigResolver.php
- packages/set-config-resolver/src/SetAwareConfigResolver.php

- '#Content of method "create\(\)" is duplicated with method "create\(\)" in "Symplify\\ConsoleColorDiff\\Diff\\Output\\CompleteUnifiedDiffOutputBuilderFactory" class\. Use unique content or service instead#'
# needed as `humbug/php-scoper` provides `Isolated\Symfony\Component\Finder\Finder`
-
message: '#Call to static method create\(\) on an unknown class Isolated\\Symfony\\Component\\Finder\\Finder#'
paths:
- packages/easy-coding-standard/scoper.inc.php

- '#Content of method "create\(\)" is duplicated with method "create\(\)" in "Symplify\\ConsoleColorDiff\\Diff\\Output\\CompleteUnifiedDiffOutputBuilderFactory" class\. Use unique content or service instead#'

0 comments on commit 9d58e23

Please sign in to comment.