BracesFixer
extends AbstractFixer
in package
implements
ConfigurationDefinitionFixerInterface, WhitespacesAwareFixerInterface
Fixer for rules defined in PSR2 ¶4.1, ¶4.4, ¶5.
Tags
Interfaces, Classes and Traits
Table of Contents
- getDefinition() : mixed
- {@inheritdoc}
- getPriority() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- createConfigurationDefinition() : mixed
- {@inheritdoc}
- ensureWhitespaceAtIndexAndIndentMultilineComment() : mixed
- findParenthesisEnd() : int
- findStatementEnd() : int
- fixCommentBeforeBrace() : mixed
- fixControlContinuationBraces() : mixed
- fixDeclareStatement() : mixed
- fixDoWhile() : mixed
- fixIndents() : mixed
- fixMissingControlBraces() : mixed
- fixSingleLineWhitespaceForDeclare() : mixed
- fixSpaceAroundToken() : mixed
- getControlContinuationTokens() : mixed
- getControlContinuationTokensForOpeningToken() : mixed
- getControlTokens() : mixed
- getFinalControlContinuationTokensForOpeningToken() : mixed
- getSiblingContinuousSingleLineComment() : null|int
- isCommentWithFixableIndentation() : bool
- Returns whether the token at given index is a comment whose indentation can be fixed.
- isMultilined() : bool
Methods
getDefinition()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —getPriority()
{@inheritdoc}
public
getPriority() : mixed
Must run before ArrayIndentationFixer, MethodArgumentSpaceFixer, MethodChainingIndentationFixer. Must run after ClassAttributesSeparationFixer, ClassDefinitionFixer, ElseifFixer, LineEndingFixer, MethodSeparationFixer, NoAlternativeSyntaxFixer, NoEmptyStatementFixer, NoUselessElseFixer, SingleLineThrowFixer, SingleSpaceAfterConstructFixer, SingleTraitInsertPerStatementFixer.
Return values
mixed —isCandidate()
{@inheritdoc}
public
isCandidate(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —applyFix()
{@inheritdoc}
protected
applyFix(SplFileInfo $file, Tokens $tokens) : mixed
Parameters
- $file : SplFileInfo
- $tokens : Tokens
Return values
mixed —createConfigurationDefinition()
{@inheritdoc}
protected
createConfigurationDefinition() : mixed
Return values
mixed —ensureWhitespaceAtIndexAndIndentMultilineComment()
private
ensureWhitespaceAtIndexAndIndentMultilineComment(Tokens $tokens, int $index, string $whitespace) : mixed
Parameters
- $tokens : Tokens
- $index : int
- $whitespace : string
Return values
mixed —findParenthesisEnd()
private
findParenthesisEnd(Tokens $tokens, int $structureTokenIndex) : int
Parameters
- $tokens : Tokens
- $structureTokenIndex : int
Return values
int —findStatementEnd()
private
findStatementEnd(Tokens $tokens, int $parenthesisEndIndex) : int
Parameters
- $tokens : Tokens
- $parenthesisEndIndex : int
Return values
int —fixCommentBeforeBrace()
private
fixCommentBeforeBrace(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —fixControlContinuationBraces()
private
fixControlContinuationBraces(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —fixDeclareStatement()
private
fixDeclareStatement(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
Return values
mixed —fixDoWhile()
private
fixDoWhile(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —fixIndents()
private
fixIndents(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —fixMissingControlBraces()
private
fixMissingControlBraces(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —fixSingleLineWhitespaceForDeclare()
private
fixSingleLineWhitespaceForDeclare(Tokens $tokens, int $startBraceIndex) : mixed
Parameters
- $tokens : Tokens
- $startBraceIndex : int
Return values
mixed —fixSpaceAroundToken()
private
fixSpaceAroundToken(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —getControlContinuationTokens()
private
getControlContinuationTokens() : mixed
Return values
mixed —getControlContinuationTokensForOpeningToken()
private
getControlContinuationTokensForOpeningToken(mixed $openingTokenKind) : mixed
Parameters
- $openingTokenKind : mixed
Return values
mixed —getControlTokens()
private
getControlTokens() : mixed
Return values
mixed —getFinalControlContinuationTokensForOpeningToken()
private
getFinalControlContinuationTokensForOpeningToken(mixed $openingTokenKind) : mixed
Parameters
- $openingTokenKind : mixed
Return values
mixed —getSiblingContinuousSingleLineComment()
private
getSiblingContinuousSingleLineComment(Tokens $tokens, int $index, bool $after) : null|int
Parameters
- $tokens : Tokens
- $index : int
- $after : bool
Return values
null|int —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 —isMultilined()
private
isMultilined(Tokens $tokens, int $startParenthesisIndex, int $endParenthesisIndex) : bool
Parameters
- $tokens : Tokens
- $startParenthesisIndex : int
- $endParenthesisIndex : int