Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d509fb

Browse files
committed
Merge branch '2.3'
2 parents 7d570d0 + eee8390 commit 5d509fb

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/Fixer/ClassNotation/SelfAccessorFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ private function replaceNameOccurrences(Tokens $tokens, $name, $startIndex, $end
115115
$prevToken = $tokens[$tokens->getPrevMeaningfulToken($i)];
116116
$nextToken = $tokens[$tokens->getNextMeaningfulToken($i)];
117117

118-
// skip tokens that are part of a fully qualified name
119-
if ($prevToken->isGivenKind(T_NS_SEPARATOR) || $nextToken->isGivenKind(T_NS_SEPARATOR)) {
118+
// skip tokens that are part of a fully qualified name or used in class property access
119+
if ($prevToken->isGivenKind([T_NS_SEPARATOR, T_OBJECT_OPERATOR]) || $nextToken->isGivenKind(T_NS_SEPARATOR)) {
120120
continue;
121121
}
122122

tests/Fixer/ClassNotation/SelfAccessorFixerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public function provide70Cases()
113113
new class() { function baz() { new Foo(); } };
114114
} }',
115115
],
116+
[
117+
'<?php class Foo { protected $foo; function bar() { return $this->foo::find(2); } }',
118+
],
116119
];
117120
}
118121
}

0 commit comments

Comments
 (0)