SideEffectsSniff
in package
implements
Sniff
Interfaces, Classes and Traits
Table of Contents
- process() : void
- Processes this sniff, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
- searchForConflict() : array<string|int, mixed>
- Searches for symbol declarations and side effects.
Methods
process()
Processes this sniff, 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 token stack.
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> —searchForConflict()
Searches for symbol declarations and side effects.
private
searchForConflict(File $phpcsFile, int $start, int $end, array<string|int, mixed> $tokens) : array<string|int, mixed>
Returns the positions of both the first symbol declared and the first side effect in the file. A NULL value for either indicates nothing was found.
Parameters
- $phpcsFile : File
-
The file being scanned.
- $start : int
-
The token to start searching from.
- $end : int
-
The token to search to.
- $tokens : array<string|int, mixed>
-
The stack of tokens that make up the file.