HumHub Documentation (unofficial)

DisallowAlternativePHPTagsSniff
in package
implements Sniff

Table of Contents

Interfaces

Sniff

Properties

$aspTags  : bool
Whether ASP tags are enabled or not.
$phpVersion  : int|string|null
The current PHP version.

Methods

process()  : void
Processes this test, when one of its tokens is encountered.
register()  : array<string|int, int|string>
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.

register()

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

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

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.

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

        
On this page

Search results