Documentation

DisallowAlternativePHPTagsSniff
in package
implements Sniff

Interfaces, Classes and Traits

Sniff

Table of Contents

$aspTags  : bool
Whether ASP tags are enabled or not.
$phpVersion  : int
The current PHP version.
process()  : void
Processes this test, when one of its tokens is encountered.
register()  : array<string|int, mixed>
Returns an array of tokens this test wants to listen for.
addChangeset()  : void
Add a changeset to replace the alternative PHP tags.
findClosingTag()  : int|false
Try and find a matching PHP closing tag.
getSnippet()  : string
Get a snippet from a HTML token.

Properties

Methods

process()

Processes this test, when one of its tokens is encountered.

public process(File $phpcsFile, int $stackPtr) : void
Parameters
$phpcsFile : File

The file being scanned.

$stackPtr : int

The position of the current token in the stack passed in $tokens.

Return values
void

register()

Returns an array of tokens this test wants to listen for.

public register() : array<string|int, mixed>
Return values
array<string|int, mixed>

addChangeset()

Add a changeset to replace the alternative PHP tags.

protected addChangeset(File $phpcsFile, array<string|int, mixed> $tokens, int $openTagPointer, int $closeTagPointer[, bool $echo = false ]) : void
Parameters
$phpcsFile : File

The file being scanned.

$tokens : array<string|int, mixed>

The token stack.

$openTagPointer : int

Stack pointer to the PHP open tag.

$closeTagPointer : int

Stack pointer to the PHP close tag.

$echo : bool = false

Whether to add 'echo' or not.

Return values
void

findClosingTag()

Try and find a matching PHP closing tag.

protected findClosingTag(File $phpcsFile, array<string|int, mixed> $tokens, int $stackPtr, string $content) : int|false
Parameters
$phpcsFile : File

The file being scanned.

$tokens : array<string|int, mixed>

The token stack.

$stackPtr : int

The position of the current token in the stack passed in $tokens.

$content : string

The expected content of the closing tag to match the opener.

Return values
int|false

Pointer to the position in the stack for the closing tag or false if not found.

getSnippet()

Get a snippet from a HTML token.

protected getSnippet(string $content[, string $start = '' ][, int $length = 40 ]) : string
Parameters
$content : string

The content of the HTML token.

$start : string = ''

Partial string to use as a starting point for the snippet.

$length : int = 40

The target length of the snippet to get. Defaults to 40.

Return values
string

Search results