Documentation

StatementIndentationFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait, Indentation

FinalYes
Tags
implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ stick_comment_to_next_continuous_control_statement?: bool }

phpstan-type

_AutogeneratedComputedConfiguration array{ stick_comment_to_next_continuous_control_statement: bool }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

Properties

$alternativeSyntaxAnalyzer  : AlternativeSyntaxAnalyzer
$bracesFixerCompatibility  : bool

Methods

__construct()  : mixed
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
findCaseBlockEnd()  : array{: int, : bool}
findStatementEndIndex()  : int
getLineIndentationWithBracesCompatibility()  : string
getSiblingContinuousSingleLineComment()  : int|null
isCommentWithFixableIndentation()  : bool
Returns whether the token at given index is a comment whose indentation can be fixed.
isPropertyStart()  : bool
Returns whether the token at given index is the last token in a property declaration before the type or the name of that property.

Properties

Methods

__construct()

public __construct([bool $bracesFixerCompatibility = false ]) : mixed
Parameters
$bracesFixerCompatibility : bool = false

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before HeredocIndentationFixer. Must run after BracesPositionFixer, ClassAttributesSeparationFixer, CurlyBracesPositionFixer, FullyQualifiedStrictTypesFixer, GlobalNamespaceImportFixer, MethodArgumentSpaceFixer, NoUselessElseFixer, YieldFromArrayToYieldsFixer.

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

findCaseBlockEnd()

private findCaseBlockEnd(Tokens $tokens, int $index) : array{: int, : bool}
Parameters
$tokens : Tokens
$index : int
Return values
array{: int, : bool}

findStatementEndIndex()

private findStatementEndIndex(Tokens $tokens, int $index, int $parentScopeEndIndex) : int
Parameters
$tokens : Tokens
$index : int
$parentScopeEndIndex : int
Return values
int

getLineIndentationWithBracesCompatibility()

private getLineIndentationWithBracesCompatibility(Tokens $tokens, int $index, string $regularIndent) : string
Parameters
$tokens : Tokens
$index : int
$regularIndent : string
Return values
string

getSiblingContinuousSingleLineComment()

private getSiblingContinuousSingleLineComment(Tokens $tokens, int $index, bool $after) : int|null
Parameters
$tokens : Tokens
$index : int
$after : bool
Return values
int|null

isCommentWithFixableIndentation()

Returns whether the token at given index is a comment whose indentation can be fixed.

private isCommentWithFixableIndentation(Tokens $tokens, int $index) : bool

Indentation of a comment is not changed when the comment is part of a multi-line message whose lines are all single-line comments and at least one line has meaningful content.

Parameters
$tokens : Tokens
$index : int
Return values
bool

isPropertyStart()

Returns whether the token at given index is the last token in a property declaration before the type or the name of that property.

private isPropertyStart(Tokens $tokens, int $index) : bool
Parameters
$tokens : Tokens
$index : int
Return values
bool

        
On this page

Search results