MethodArgumentSpaceFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Methods
- getDefinition() : FixerDefinitionInterface
- Returns the definition of the fixer.
- getPriority() : int
- Returns the priority of the fixer.
- isCandidate() : bool
- Check if the fixer is a candidate for given Tokens collection.
- applyFix() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- ensureFunctionFullyMultiline() : void
- ensureSingleLine() : bool
- findWhitespaceIndexAfterParenthesis() : int|null
- fixFunction() : bool
- Fix arguments spacing for given function.
- fixNewline() : void
- Method to insert newline after comma, attribute or opening parenthesis.
- fixSpace() : void
- Method to insert space after comma and remove space before comma.
- isCommentLastLineToken() : bool
- Check if last item of current line is a comment.
- isNewline() : bool
- Checks if token is new line.
Methods
getDefinition()
Returns the definition of the fixer.
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
Returns the priority of the fixer.
public
getPriority() : int
Must run before ArrayIndentationFixer, StatementIndentationFixer. Must run after CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, LambdaNotUsedImportFixer, NoMultilineWhitespaceAroundDoubleArrowFixer, NoUselessSprintfFixer, PowToExponentiationFixer, StrictParamFixer.
Return values
intisCandidate()
Check if the fixer is a candidate for given Tokens collection.
public
isCandidate(Tokens $tokens) : bool
Fixer is a candidate when the collection contains tokens that may be fixed during fixer work. This could be considered as some kind of bloom filter. When this method returns true then to the Tokens collection may or may not need a fixing, but when this method returns false then the Tokens collection need no fixing for sure.
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfaceensureFunctionFullyMultiline()
private
ensureFunctionFullyMultiline(Tokens $tokens, int $startFunctionIndex) : void
Parameters
- $tokens : Tokens
- $startFunctionIndex : int
ensureSingleLine()
private
ensureSingleLine(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
bool —Whether newlines were removed from the whitespace token
findWhitespaceIndexAfterParenthesis()
private
findWhitespaceIndexAfterParenthesis(Tokens $tokens, int $startParenthesisIndex, int $endParenthesisIndex) : int|null
Parameters
- $tokens : Tokens
- $startParenthesisIndex : int
- $endParenthesisIndex : int
Return values
int|nullfixFunction()
Fix arguments spacing for given function.
private
fixFunction(Tokens $tokens, int $startFunctionIndex) : bool
Parameters
- $tokens : Tokens
-
Tokens to handle
- $startFunctionIndex : int
-
Start parenthesis position
Return values
bool —whether the function is multiline
fixNewline()
Method to insert newline after comma, attribute or opening parenthesis.
private
fixNewline(Tokens $tokens, int $index, string $indentation[, bool $override = true ]) : void
Parameters
- $tokens : Tokens
- $index : int
-
index of a comma
- $indentation : string
-
the indentation that should be used
- $override : bool = true
-
whether to override the existing character or not
fixSpace()
Method to insert space after comma and remove space before comma.
private
fixSpace(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
isCommentLastLineToken()
Check if last item of current line is a comment.
private
isCommentLastLineToken(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
-
tokens to handle
- $index : int
-
index of token
Return values
boolisNewline()
Checks if token is new line.
private
isNewline(Token $token) : bool
Parameters
- $token : Token