Documentation

CamelCapsMethodNameSniff extends CamelCapsFunctionNameSniff
in package

Table of Contents

$strict  : bool
If TRUE, the string must not have two capital letters next to each other.
$magicFunctions  : array<string|int, mixed>
A list of all PHP magic functions.
$magicMethods  : array<string|int, mixed>
A list of all PHP magic methods.
$methodsDoubleUnderscore  : array<string|int, mixed>
A list of all PHP non-magic methods starting with a double underscore.
$listenOutside  : bool
True if this test should fire on tokens outside of the scope.
$scopeTokens  : string
The type of scope opener tokens that this test wishes to listen to.
$tokens  : array<string|int, mixed>
The token types that this test wishes to listen to within the scope.
__construct()  : mixed
Constructs a new AbstractScopeTest.
process()  : void|int
Processes the tokens that this test is listening for.
register()  : array<string|int, int>
The method that is called to register the tokens this test wishes to listen to.
processTokenOutsideScope()  : void
Processes the tokens outside the scope.
processTokenWithinScope()  : void
Processes the tokens within the scope.

Properties

$magicFunctions

A list of all PHP magic functions.

protected array<string|int, mixed> $magicFunctions = ['autoload' => true]

$magicMethods

A list of all PHP magic methods.

protected array<string|int, mixed> $magicMethods = ['construct' => true, 'destruct' => true, 'call' => true, 'callstatic' => true, 'get' => true, 'set' => true, 'isset' => true, 'unset' => true, 'sleep' => true, 'wakeup' => true, 'serialize' => true, 'unserialize' => true, 'tostring' => true, 'invoke' => true, 'set_state' => true, 'clone' => true, 'debuginfo' => true]

$methodsDoubleUnderscore

A list of all PHP non-magic methods starting with a double underscore.

protected array<string|int, mixed> $methodsDoubleUnderscore = ['dorequest' => true, 'getcookies' => true, 'getfunctions' => true, 'getlastrequest' => true, 'getlastrequestheaders' => true, 'getlastresponse' => true, 'getlastresponseheaders' => true, 'gettypes' => true, 'setcookie' => true, 'setlocation' => true, 'setsoapheaders' => true, 'soapcall' => true]

These come from PHP modules such as SOAPClient.

$listenOutside

True if this test should fire on tokens outside of the scope.

private bool $listenOutside = false

$scopeTokens

The type of scope opener tokens that this test wishes to listen to.

private string $scopeTokens = []

$tokens

The token types that this test wishes to listen to within the scope.

private array<string|int, mixed> $tokens = []

Methods

__construct()

Constructs a new AbstractScopeTest.

public __construct(array<string|int, mixed> $scopeTokens, array<string|int, mixed> $tokens[, bool $listenOutside = false ]) : mixed
Parameters
$scopeTokens : array<string|int, mixed>

The type of scope the test wishes to listen to.

$tokens : array<string|int, mixed>

The tokens that the test wishes to listen to within the scope.

$listenOutside : bool = false

If true this test will also alert the extending class when a token is found outside the scope, by calling the processTokenOutsideScope method.

Tags
throws
RuntimeException

If the specified tokens arrays are empty or invalid.

Return values
mixed

process()

Processes the tokens that this test is listening for.

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

The file where this token was found.

$stackPtr : int

The position in the stack where this token was found.

Tags
see
processTokenWithinScope()
Return values
void|int

Optionally returns a stack pointer. The sniff will not be called again on the current file until the returned stack pointer is reached. Return ($phpcsFile->numTokens + 1) to skip the rest of the file.

register()

The method that is called to register the tokens this test wishes to listen to.

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

DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register for the desired tokens and scope.

Tags
see
__constructor()
Return values
array<string|int, int>

processTokenOutsideScope()

Processes the tokens outside the scope.

protected processTokenOutsideScope(File $phpcsFile, int $stackPtr) : void
Parameters
$phpcsFile : File

The file being processed.

$stackPtr : int

The position where this token was found.

Return values
void

processTokenWithinScope()

Processes the tokens within the scope.

protected processTokenWithinScope(File $phpcsFile, int $stackPtr, int $currScope) : void
Parameters
$phpcsFile : File

The file being processed.

$stackPtr : int

The position where this token was found.

$currScope : int

The position of the current scope.

Return values
void

Search results