SideEffectsSniff
in package
implements
Sniff
Table of Contents
Interfaces
Methods
- process() : int
- Processes this sniff, when one of its tokens is encountered.
- register() : array<string|int, int|string>
- 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) : int
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the token stack.
Return values
intregister()
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>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.