Skip to content

Commit cdcd126

Browse files
committed
bug #4313 SelfAccessorFixer - fix for part qualified class name (kubawerlos, SpacePossum)
This PR was squashed before being merged into the 2.12 branch (closes #4313). Discussion ---------- SelfAccessorFixer - fix for part qualified class name Fixes #4307 Pinging @gharlan (as original author) and @glensc (as reporter) for review. Commits ------- 9993525 SelfAccessorFixer - fix for part qualified class name
2 parents d9adab3 + 9993525 commit cdcd126

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Fixer/ClassNotation/SelfAccessorFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function replaceNameOccurrences(Tokens $tokens, $namespace, $name, $star
151151
}
152152
$prevToken = $tokens[$tokens->getPrevMeaningfulToken($classStartIndex)];
153153
}
154-
if ($prevToken->isGivenKind(T_OBJECT_OPERATOR)) {
154+
if ($prevToken->isGivenKind([T_OBJECT_OPERATOR, T_STRING])) {
155155
continue;
156156
}
157157

tests/Fixer/ClassNotation/SelfAccessorFixerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public function provideFixCases()
8181
[
8282
'<?php class Foo { function bar() { new Foo\Baz(); } }',
8383
],
84+
[
85+
'<?php class Foo { function bar() { Baz\Foo::class; } }',
86+
],
8487
[
8588
'<?php class Foo { function bar() { function ($a = self::BAZ) { new self(); }; } }',
8689
'<?php class Foo { function bar() { function ($a = Foo::BAZ) { new Foo(); }; } }',

0 commit comments

Comments
 (0)