Skip to content

Commit

Permalink
[scoper] unprefix the exception in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 12, 2021
1 parent 537a9ab commit 566e171
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 15 additions & 0 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ function (string $filePath, string $prefix, string $content): string {
);
},

// make UT=1 in tests work
function (string $filePath, string $prefix, string $content): string {
if (! Strings::endsWith($filePath, 'packages/Testing/PHPUnit/AbstractRectorTestCase.php')) {
return $content;
}

// see https://regex101.com/r/v8zRMm/1
return Strings::replace(
$content, '
#' . $prefix . '\\\\PHPUnit\\\\Framework\\\\ExpectationFailedException',
#',
'PHPUnit\Framework\ExpectationFailedException'
);
},

// unprefixed SmartFileInfo
function (string $filePath, string $prefix, string $content): string {
return Strings::replace(
Expand Down
2 changes: 0 additions & 2 deletions utils/compiler/src/PhpScoper/StaticEasyPrefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ final class StaticEasyPrefixer
// for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson',
'Symplify\ComposerJsonManipulator\ComposerJsonFactory',
// this will make AbstractRectorTest case work for fixture updating
'PHPUnit\Framework\ExpectationFailedException',
];

/**
Expand Down

0 comments on commit 566e171

Please sign in to comment.