Skip to content

Commit

Permalink
Fix detection for fully qualified return type
Browse files Browse the repository at this point in the history
  • Loading branch information
julienfalque committed Dec 7, 2019
1 parent 1d0996d commit bcfd0b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Tokenizer/TokensAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function isConstantInvocation($index)
$prevIndex = $this->tokens->getPrevMeaningfulToken($prevIndex);
}

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])) {
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])) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Tokenizer/TokensAnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,10 @@ public function provideIsConstantInvocation71Cases()
'<?php interface Foo { public function bar(): Baz; }',
[16 => false],
],
[
'<?php interface Foo { public function bar(): \Baz; }',
[17 => false],
],
[
'<?php interface Foo { public function bar(): ?Baz; }',
[17 => false],
Expand Down

0 comments on commit bcfd0b6

Please sign in to comment.