Skip to content

Commit

Permalink
Fixed broken 3rd case
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Aug 2, 2020
1 parent 3ae96bf commit 4443a47
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php
Expand Up @@ -183,6 +183,18 @@ private function findNotUsedLambdaImports(Tokens $tokens, array $imports, $lambd
}
}

if ($token->isGivenKind(T_STRING_VARNAME)) {
$content = '$'.$token->getContent();

if (isset($imports[$content])) {
unset($imports[$content]);

if (0 === \count($imports)) {
return $imports;
}
}
}

if ($token->isClassy()) { // is anonymous class
// check if used as argument in the constructor of the anonymous class
$index = $tokens->getNextTokenOfKind($index, ['(', '{']);
Expand Down

0 comments on commit 4443a47

Please sign in to comment.