StatementIndentationFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait, Indentation
Tags
Table of Contents
Interfaces
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
$alternativeSyntaxAnalyzer
private
AlternativeSyntaxAnalyzer
$alternativeSyntaxAnalyzer
$bracesFixerCompatibility
private
bool
$bracesFixerCompatibility
Methods
__construct()
public
__construct([bool $bracesFixerCompatibility = false ]) : mixed
Parameters
- $bracesFixerCompatibility : bool = false
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 HeredocIndentationFixer. Must run after BracesPositionFixer, ClassAttributesSeparationFixer, CurlyBracesPositionFixer, FullyQualifiedStrictTypesFixer, GlobalNamespaceImportFixer, MethodArgumentSpaceFixer, NoUselessElseFixer, YieldFromArrayToYieldsFixer.
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
FixerConfigurationResolverInterfacefindCaseBlockEnd()
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
intgetLineIndentationWithBracesCompatibility()
private
getLineIndentationWithBracesCompatibility(Tokens $tokens, int $index, string $regularIndent) : string
Parameters
- $tokens : Tokens
- $index : int
- $regularIndent : string
Return values
stringgetSiblingContinuousSingleLineComment()
private
getSiblingContinuousSingleLineComment(Tokens $tokens, int $index, bool $after) : int|null
Parameters
- $tokens : Tokens
- $index : int
- $after : bool
Return values
int|nullisCommentWithFixableIndentation()
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
boolisPropertyStart()
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