Skip to content

Commit

Permalink
[Scoper] Clean up scoper replace namespace stub (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Apr 3, 2022
1 parent b00a4fc commit 02bb2ed
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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';

Expand Down Expand Up @@ -181,18 +180,6 @@ function (string $filePath, string $prefix, string $content): string {
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
Expand Down

0 comments on commit 02bb2ed

Please sign in to comment.