From 877cbb2de8150b672a966d7a8907ed63769e1cdd Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Mon, 23 Aug 2021 01:05:17 +0200 Subject: [PATCH] fix(scoper): prefix vendor classes from PHPDoc, close #6614 (#739) --- scoper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scoper.php b/scoper.php index a85ce3c77ad..617e3f53847 100644 --- a/scoper.php +++ b/scoper.php @@ -122,6 +122,13 @@ return [ 'PHPUnit\Framework\Constraint\IsEqual' ), + // prefix vendor classes in phpdoc + fn (string $filePath, string $prefix, string $content): string => Strings::replace( + $content, + '#@(var|param) (\\\\(?!Rector)(?:[^ ]+))#', + '@$1 \\\\' . $prefix . '$2' + ), + // unprefixed ContainerConfigurator function (string $filePath, string $prefix, string $content): string { // keep vendor prefixed the prefixed file loading; not part of public API