Documentation

MethodArgumentSpaceFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Kuanhung Chen ericj.tw@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ after_heredoc?: bool, attribute_placement?: 'ignore'|'same_line'|'standalone', keep_multiple_spaces_after_comma?: bool, on_multiline?: 'ensure_fully_multiline'|'ensure_single_line'|'ignore' }

phpstan-type

_AutogeneratedComputedConfiguration array{ after_heredoc: bool, attribute_placement: 'ignore'|'same_line'|'standalone', keep_multiple_spaces_after_comma: bool, on_multiline: 'ensure_fully_multiline'|'ensure_single_line'|'ignore' }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

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

getPriority()

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
int

isCandidate()

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
bool

ensureFunctionFullyMultiline()

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|null

fixFunction()

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
bool

        
On this page

Search results