Skip to content

Commit 097be4a

Browse files
bolmstedtSpacePossum
authored andcommitted
StrictParamFixer - Don't detect functions in use statements
1 parent 0e0054c commit 097be4a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Fixer/Strict/StrictParamFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
7575
for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
7676
$token = $tokens[$index];
7777

78-
$previousIndex = $tokens->getPrevMeaningfulToken($index);
79-
if (null !== $previousIndex && $tokens[$previousIndex]->isGivenKind(CT::T_FUNCTION_IMPORT)) {
78+
$nextIndex = $tokens->getNextMeaningfulToken($index);
79+
if (null !== $nextIndex && !$tokens[$nextIndex]->equals('(')) {
8080
continue;
8181
}
8282

tests/Fixer/Strict/StrictParamFixerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ public function __construct($foo, $bar) {}
155155
array_keys($foo, $bar);
156156
}',
157157
],
158+
[
159+
'<?php
160+
use function \base64_decode;
161+
foo($bar);',
162+
],
163+
[
164+
'<?php
165+
use function Baz\base64_decode;
166+
foo($bar);',
167+
],
158168
];
159169
}
160170

0 commit comments

Comments
 (0)