Skip to content

Commit

Permalink
bug #4678 TokensAnalyzer::isConstantInvocation - fix for importing mu…
Browse files Browse the repository at this point in the history
…ltiple classes with single "use" (kubawerlos)

This PR was merged into the 2.15 branch.

Discussion
----------

TokensAnalyzer::isConstantInvocation - fix for importing multiple classes with single "use"

Commits
-------

e98032d TokensAnalyzer::isConstantInvocation - fix for importing multiple classes with single "use"
  • Loading branch information
julienfalque committed Dec 9, 2019
2 parents 30d3cfa + e98032d commit e1d4488
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 @@ -353,7 +353,7 @@ public function isConstantInvocation($index)
$checkIndex = $this->tokens->getPrevMeaningfulToken($checkIndex);
}

if ($this->tokens[$checkIndex]->isGivenKind([T_EXTENDS, CT::T_GROUP_IMPORT_BRACE_OPEN, T_IMPLEMENTS, CT::T_USE_TRAIT])) {
if ($this->tokens[$checkIndex]->isGivenKind([T_EXTENDS, CT::T_GROUP_IMPORT_BRACE_OPEN, T_IMPLEMENTS, 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 @@ -786,6 +786,10 @@ public function provideIsConstantInvocationCases()
'<?php interface Foo extends Bar, Baz, Qux {}',
[7 => false, 10 => false, 13 => false],
],
[
'<?php use Foo\Bar, Foo\Baz, Foo\Qux;',
[3 => false, 5 => false, 8 => false, 10 => false, 13 => false, 15 => false],
],
];
}

Expand Down

0 comments on commit e1d4488

Please sign in to comment.