Skip to content

Commit e1d4488

Browse files
committed
bug #4678 TokensAnalyzer::isConstantInvocation - fix for importing multiple 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"
2 parents 30d3cfa + e98032d commit e1d4488

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
@@ -353,7 +353,7 @@ public function isConstantInvocation($index)
353353
$checkIndex = $this->tokens->getPrevMeaningfulToken($checkIndex);
354354
}
355355

356-
if ($this->tokens[$checkIndex]->isGivenKind([T_EXTENDS, CT::T_GROUP_IMPORT_BRACE_OPEN, T_IMPLEMENTS, CT::T_USE_TRAIT])) {
356+
if ($this->tokens[$checkIndex]->isGivenKind([T_EXTENDS, CT::T_GROUP_IMPORT_BRACE_OPEN, T_IMPLEMENTS, T_USE, CT::T_USE_TRAIT])) {
357357
return false;
358358
}
359359
}

tests/Tokenizer/TokensAnalyzerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,10 @@ public function provideIsConstantInvocationCases()
786786
'<?php interface Foo extends Bar, Baz, Qux {}',
787787
[7 => false, 10 => false, 13 => false],
788788
],
789+
[
790+
'<?php use Foo\Bar, Foo\Baz, Foo\Qux;',
791+
[3 => false, 5 => false, 8 => false, 10 => false, 13 => false, 15 => false],
792+
],
789793
];
790794
}
791795

0 commit comments

Comments
 (0)