Skip to content

Commit

Permalink
[scoped] unprefix ComposerJson in ComposerRector contract
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 12, 2021
1 parent 4e724f4 commit c2c1890
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ function (string $filePath, string $prefix, string $content): string {
);
},

// unprefixed ComposerJson as part of public API in ComposerRectorInterface
function (string $filePath, string $prefix, string $content): string {
if (! Strings::endsWith($filePath, 'rules/Composer/Contract/Rector/ComposerRectorInterface.php')) {
return $content;
}

// see https://regex101.com/r/v8zRMm/1
return Strings::replace(
$content, '
#' . $prefix . '\\\\Symplify\\\\ComposerJsonManipulator\\\\ValueObject\\\\ComposerJson#',
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson'
);
},

// get version for prefixed version
function (string $filePath, string $prefix, string $content): string {
if (! Strings::endsWith($filePath, 'src/Configuration/Configuration.php')) {
Expand Down

0 comments on commit c2c1890

Please sign in to comment.