NoAlternativeSyntaxFixer
extends AbstractFixer
in package
Tags
Table of Contents
- getDefinition() : mixed
- {@inheritdoc}
- getPriority() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- addBraces() : mixed
- Add opening and closing braces to the else: and elseif: cases.
- findParenthesisEnd() : mixed
- fixElse() : mixed
- Handle the else: cases.
- fixElseif() : mixed
- Handle the elsif(): cases.
- fixOpenCloseControls() : mixed
- Handle both extremes of the control structures.
Methods
getDefinition()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —getPriority()
{@inheritdoc}
public
getPriority() : mixed
Must run before BracesFixer, ElseifFixer, NoSuperfluousElseifFixer, NoUselessElseFixer, SwitchContinueToBreakFixer.
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 —addBraces()
Add opening and closing braces to the else: and elseif: cases.
private
addBraces(Tokens $tokens, Token $token, int $index, int $colonIndex) : mixed
Parameters
- $tokens : Tokens
-
the tokens collection
- $token : Token
-
the current token
- $index : int
-
the current token index
- $colonIndex : int
-
the index of the colon
Return values
mixed —findParenthesisEnd()
private
findParenthesisEnd(Tokens $tokens, mixed $structureTokenIndex) : mixed
Parameters
- $tokens : Tokens
- $structureTokenIndex : mixed
Return values
mixed —fixElse()
Handle the else: cases.
private
fixElse(int $index, Token $token, Tokens $tokens) : mixed
Parameters
- $index : int
-
the index of the token being processed
- $token : Token
-
the token being processed
- $tokens : Tokens
-
the collection of tokens
Return values
mixed —fixElseif()
Handle the elsif(): cases.
private
fixElseif(int $index, Token $token, Tokens $tokens) : mixed
Parameters
- $index : int
-
the index of the token being processed
- $token : Token
-
the token being processed
- $tokens : Tokens
-
the collection of tokens
Return values
mixed —fixOpenCloseControls()
Handle both extremes of the control structures.
private
fixOpenCloseControls(int $index, Token $token, Tokens $tokens) : mixed
e.g. if(): or endif;.
Parameters
- $index : int
-
the index of the token being processed
- $token : Token
-
the token being processed
- $tokens : Tokens
-
the collection of tokens