Documentation

SwitchDeclarationSniff
in package
implements Sniff

Interfaces, Classes and Traits

Sniff

Table of Contents

$indent  : int
The number of spaces code should be indented.
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.
findNestedTerminator()  : int|false
Returns the position of the nested terminating statement.
findNextCase()  : int|false
Find the next CASE or DEFAULT statement from a point in the file.

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>

findNestedTerminator()

Returns the position of the nested terminating statement.

private findNestedTerminator(File $phpcsFile, int $stackPtr, int $end) : int|false

Returns false if no terminating statement was found.

Parameters
$phpcsFile : File

The file being scanned.

$stackPtr : int

The position to start looking at.

$end : int

The position to stop looking at.

Return values
int|false

findNextCase()

Find the next CASE or DEFAULT statement from a point in the file.

private findNextCase(File $phpcsFile, int $stackPtr, int $end) : int|false

Note that nested switches are ignored.

Parameters
$phpcsFile : File

The file being scanned.

$stackPtr : int

The position to start looking at.

$end : int

The position to stop looking at.

Return values
int|false

Search results