EchoTagSyntaxFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Constants
- SUPPORTED_FORMAT_OPTIONS = [self::FORMAT_LONG, self::FORMAT_SHORT]
- SUPPORTED_LONGFUNCTION_OPTIONS = [self::LONG_FUNCTION_ECHO, self::LONG_FUNCTION_PRINT]
Methods
- 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
- buildLongToShortTokens() : array<int, Token>
- Builds the list of tokens that replace a long echo sequence.
- isComplexCode() : bool
- Check if $tokens, starting at $index, contains "complex code", that is, the content of the echo tag contains more than a simple "echo something".
- longToShort() : void
- shortToLong() : void
Constants
SUPPORTED_FORMAT_OPTIONS
private
mixed
SUPPORTED_FORMAT_OPTIONS
= [self::FORMAT_LONG, self::FORMAT_SHORT]
SUPPORTED_LONGFUNCTION_OPTIONS
private
mixed
SUPPORTED_LONGFUNCTION_OPTIONS
= [self::LONG_FUNCTION_ECHO, self::LONG_FUNCTION_PRINT]
Methods
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 NoMixedEchoPrintFixer.
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
FixerConfigurationResolverInterfacebuildLongToShortTokens()
Builds the list of tokens that replace a long echo sequence.
private
buildLongToShortTokens(Tokens $tokens, int $openTagIndex, int $echoTagIndex) : array<int, Token>
Parameters
- $tokens : Tokens
- $openTagIndex : int
- $echoTagIndex : int
Return values
array<int, Token>isComplexCode()
Check if $tokens, starting at $index, contains "complex code", that is, the content of the echo tag contains more than a simple "echo something".
private
isComplexCode(Tokens $tokens, int $index) : bool
This is done by a very quick test: if the tag contains non-whitespace tokens after a semicolon, we consider it as "complex".
Parameters
- $tokens : Tokens
- $index : int
Tags
Return values
boollongToShort()
private
longToShort(Tokens $tokens) : void
Parameters
- $tokens : Tokens
shortToLong()
private
shortToLong(Tokens $tokens) : void
Parameters
- $tokens : Tokens