LambdaNotUsedImportFixer
extends AbstractFixer
in package
FinalYes
Table of Contents
Properties
- $argumentsAnalyzer : ArgumentsAnalyzer
- $functionAnalyzer : FunctionsAnalyzer
- $tokensAnalyzer : TokensAnalyzer
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- clearImports() : void
- clearImportsAndUse() : void
- Remove `use` and all imported variables.
- countImportsUsedAsArgument() : array<string, int>
- filterArguments() : array<string, int>
- findNotUsedLambdaImports() : array<string, int>
- fixLambda() : void
- getLambdaUseIndex() : false|int
Properties
$argumentsAnalyzer
private
ArgumentsAnalyzer
$argumentsAnalyzer
$functionAnalyzer
private
FunctionsAnalyzer
$functionAnalyzer
$tokensAnalyzer
private
TokensAnalyzer
$tokensAnalyzer
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before MethodArgumentSpaceFixer, NoSpacesInsideParenthesisFixer, SpacesInsideParenthesesFixer.
Return values
intisCandidate()
public
isCandidate(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
clearImports()
private
clearImports(Tokens $tokens, array<string, int> $imports) : void
Parameters
- $tokens : Tokens
- $imports : array<string, int>
clearImportsAndUse()
Remove `use` and all imported variables.
private
clearImportsAndUse(Tokens $tokens, int $lambdaUseIndex, int $lambdaUseCloseBraceIndex) : void
Parameters
- $tokens : Tokens
- $lambdaUseIndex : int
- $lambdaUseCloseBraceIndex : int
countImportsUsedAsArgument()
private
countImportsUsedAsArgument(Tokens $tokens, array<string, int> $imports, array<int, int> $arguments) : array<string, int>
Parameters
- $tokens : Tokens
- $imports : array<string, int>
- $arguments : array<int, int>
Return values
array<string, int>filterArguments()
private
filterArguments(Tokens $tokens, array<int, int> $arguments) : array<string, int>
Parameters
- $tokens : Tokens
- $arguments : array<int, int>
Return values
array<string, int>findNotUsedLambdaImports()
private
findNotUsedLambdaImports(Tokens $tokens, array<string, int> $imports, int $lambdaUseCloseBraceIndex) : array<string, int>
Parameters
- $tokens : Tokens
- $imports : array<string, int>
- $lambdaUseCloseBraceIndex : int
Return values
array<string, int>fixLambda()
private
fixLambda(Tokens $tokens, int $lambdaUseIndex) : void
Parameters
- $tokens : Tokens
- $lambdaUseIndex : int
getLambdaUseIndex()
private
getLambdaUseIndex(Tokens $tokens, int $index) : false|int
Parameters
- $tokens : Tokens
- $index : int