DirnameSniff
in package
implements
Sniff
FinalYes
Detect `dirname(__FILE__)` and nested uses of `dirname()`.
Tags
Table of Contents
Interfaces
Properties
- $phpVersion : int
- PHP version as configured or 0 if unknown.
Methods
- process() : void
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, int|string>
- Registers the tokens that this sniff wants to listen for.
- getLevelsValue() : int|false
- Determine the value of the $levels parameter passed to dirname().
Properties
$phpVersion
PHP version as configured or 0 if unknown.
private
int
$phpVersion
Tags
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.
Tags
register()
Registers the tokens that this sniff wants to listen for.
public
register() : array<string|int, int|string>
Tags
Return values
array<string|int, int|string>getLevelsValue()
Determine the value of the $levels parameter passed to dirname().
private
getLevelsValue(File $phpcsFile, array<string, int|string>|false $levelsParam) : int|false
Parameters
- $phpcsFile : File
-
The file being scanned.
- $levelsParam : array<string, int|string>|false
-
The information about the parameter as retrieved via PassedParameters::getParameterFromStack().
Tags
Return values
int|false —Integer levels value or FALSE if the levels value couldn't be determined.