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