Skip to content

Commit 9993525

Browse files
kubawerlosSpacePossum
authored andcommitted
SelfAccessorFixer - fix for part qualified class name
1 parent efa97df commit 9993525

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)