Documentation

MethodArgumentSpaceFixer extends AbstractFixer
in package
implements ConfigurationDefinitionFixerInterface, WhitespacesAwareFixerInterface

Fixer for rules defined in PSR2 ¶4.4, ¶4.6.

Tags
author

Kuanhung Chen ericj.tw@gmail.com

Interfaces, Classes and Traits

ConfigurationDefinitionFixerInterface
WhitespacesAwareFixerInterface

Table of Contents

configure()  : mixed
fixSpace()  : mixed
Method to insert space after comma and remove space before comma.
getDefinition()  : mixed
{@inheritdoc}
getPriority()  : mixed
{@inheritdoc}
isCandidate()  : mixed
{@inheritdoc}
applyFix()  : mixed
{@inheritdoc}
createConfigurationDefinition()  : mixed
{@inheritdoc}
ensureFunctionFullyMultiline()  : mixed
ensureSingleLine()  : bool
findWhitespaceIndexAfterParenthesis()  : null|int
fixFunction()  : bool
Fix arguments spacing for given function.
fixNewline()  : mixed
Method to insert newline after comma or opening parenthesis.
fixSpace2()  : mixed
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

configure()

public configure([array<string|int, mixed> $configuration = null ]) : mixed
Parameters
$configuration : array<string|int, mixed> = null
Return values
mixed

fixSpace()

Method to insert space after comma and remove space before comma.

public fixSpace(Tokens $tokens, int $index) : mixed
Parameters
$tokens : Tokens
$index : int
Return values
mixed

getPriority()

{@inheritdoc}

public getPriority() : mixed

Must run before ArrayIndentationFixer. Must run after BracesFixer, CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer.

Return values
mixed

createConfigurationDefinition()

{@inheritdoc}

protected createConfigurationDefinition() : mixed
Return values
mixed

ensureFunctionFullyMultiline()

private ensureFunctionFullyMultiline(Tokens $tokens, int $startFunctionIndex) : mixed
Parameters
$tokens : Tokens
$startFunctionIndex : int
Return values
mixed

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) : null|int
Parameters
$tokens : Tokens
$startParenthesisIndex : int
$endParenthesisIndex : int
Return values
null|int

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 or opening parenthesis.

private fixNewline(Tokens $tokens, int $index, string $indentation[, bool $override = true ]) : mixed
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

Return values
mixed

fixSpace2()

Method to insert space after comma and remove space before comma.

private fixSpace2(Tokens $tokens, int $index) : mixed
Parameters
$tokens : Tokens
$index : int
Return values
mixed

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

Search results