diff --git a/compiler/src/PhpScoper/StaticEasyPrefixer.php b/compiler/src/PhpScoper/StaticEasyPrefixer.php index 4bb5f87e9d1..050217167fd 100644 --- a/compiler/src/PhpScoper/StaticEasyPrefixer.php +++ b/compiler/src/PhpScoper/StaticEasyPrefixer.php @@ -41,6 +41,6 @@ final class StaticEasyPrefixer public static function unPreSlashQuotedValues(string $content): string { - return Strings::replace($content, '#\'\\\\#', "'"); + return Strings::replace($content, '#\'\\\\(\w|@)#', "'$1"); } } diff --git a/compiler/tests/PhpScoper/StaticEasyPrefixerTest.php b/compiler/tests/PhpScoper/StaticEasyPrefixerTest.php index 660d88a9ee8..9b9db3bb100 100644 --- a/compiler/tests/PhpScoper/StaticEasyPrefixerTest.php +++ b/compiler/tests/PhpScoper/StaticEasyPrefixerTest.php @@ -36,5 +36,6 @@ final class StaticEasyPrefixerTest extends TestCase public function provideDataForSlashes(): Iterator { yield ["'\@ORM\Entity", "'@ORM\Entity"]; + yield ["'\\", "'\\"]; } }