mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 08:50:50 +00:00
[Scoper] Clean up scoper replace namespace stub (#2002)
This commit is contained in:
parent
b00a4fcfc4
commit
02bb2edef3
13
scoper.php
13
scoper.php
|
@ -8,7 +8,6 @@ use Rector\Compiler\PhpScoper\StaticEasyPrefixer;
|
|||
use Rector\Compiler\Unprefixer;
|
||||
use Rector\Compiler\ValueObject\ScoperOption;
|
||||
use Rector\Core\Application\VersionResolver;
|
||||
use Rector\Core\Util\StringUtils;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
|
@ -181,18 +180,6 @@ return [
|
|||
return $content;
|
||||
},
|
||||
|
||||
// fixes https://github.com/rectorphp/rector/issues/6010 + test case prefix
|
||||
function (string $filePath, string $prefix, string $content): string {
|
||||
// @see https://regex101.com/r/bA1nQa/1
|
||||
if (! StringUtils::isMatch($filePath, '#vendor/symfony/polyfill-php\d{2}/Resources/stubs#')) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
// @see https://regex101.com/r/x5Ukrx/1
|
||||
$namespace = sprintf('#namespace %s;#m', $prefix);
|
||||
return Strings::replace($content, $namespace);
|
||||
},
|
||||
|
||||
// unprefix string classes, as they're string on purpose - they have to be checked in original form, not prefixed
|
||||
function (string $filePath, string $prefix, string $content): string {
|
||||
// skip vendor, expect rector packages
|
||||
|
|
Loading…
Reference in New Issue
Block a user