Skip to content

Commit bcfd0b6

Browse files
committed
Fix detection for fully qualified return type
1 parent 1d0996d commit bcfd0b6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Tokenizer/TokensAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function isConstantInvocation($index)
331331
$prevIndex = $this->tokens->getPrevMeaningfulToken($prevIndex);
332332
}
333333

334-
if ($this->tokens[$prevIndex]->isGivenKind([CT::T_CONST_IMPORT, T_EXTENDS, CT::T_FUNCTION_IMPORT, T_IMPLEMENTS, T_INSTANCEOF, T_INSTEADOF, T_NAMESPACE, T_NEW, CT::T_NULLABLE_TYPE, T_USE, CT::T_USE_TRAIT])) {
334+
if ($this->tokens[$prevIndex]->isGivenKind([CT::T_CONST_IMPORT, T_EXTENDS, CT::T_FUNCTION_IMPORT, T_IMPLEMENTS, T_INSTANCEOF, T_INSTEADOF, T_NAMESPACE, T_NEW, CT::T_NULLABLE_TYPE, CT::T_TYPE_COLON, T_USE, CT::T_USE_TRAIT])) {
335335
return false;
336336
}
337337

tests/Tokenizer/TokensAnalyzerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,10 @@ public function provideIsConstantInvocation71Cases()
852852
'<?php interface Foo { public function bar(): Baz; }',
853853
[16 => false],
854854
],
855+
[
856+
'<?php interface Foo { public function bar(): \Baz; }',
857+
[17 => false],
858+
],
855859
[
856860
'<?php interface Foo { public function bar(): ?Baz; }',
857861
[17 => false],

0 commit comments

Comments
 (0)