Documentation

EchoTagSyntaxFixer extends AbstractFixer
in package
implements ConfigurationDefinitionFixerInterface

Tags
author

Michele Locati michele@locati.it

Interfaces, Classes and Traits

ConfigurationDefinitionFixerInterface

Table of Contents

getDefinition()  : mixed
{@inheritdoc}
getPriority()  : mixed
{@inheritdoc}
isCandidate()  : mixed
{@inheritdoc}
applyFix()  : mixed
{@inheritdoc}
createConfigurationDefinition()  : mixed
{@inheritdoc}
buildLongToShortTokens()  : array<string|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()  : mixed
shortToLong()  : mixed

Methods

getDefinition()

{@inheritdoc}

public getDefinition() : mixed
Return values
mixed

getPriority()

{@inheritdoc}

public getPriority() : mixed

Must run before NoMixedEchoPrintFixer.

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

buildLongToShortTokens()

Builds the list of tokens that replace a long echo sequence.

private buildLongToShortTokens(Tokens $tokens, int $openTagIndex, int $echoTagIndex) : array<string|int, Token>
Parameters
$tokens : Tokens
$openTagIndex : int
$echoTagIndex : int
Return values
array<string|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
example

echo 1 ?>` is false (not complex)

example

echo 'hello' . 'world'; ?>` is false (not "complex")

example

echo 2; $set = 3 ?>` is true ("complex")

Return values
bool

Search results