Documentation

DirnameSniff
in package
implements Sniff

FinalYes

Detect `dirname(__FILE__)` and nested uses of `dirname()`.

Tags
since
1.0.0

Table of Contents

Interfaces

Sniff

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
since
1.1.1

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
since
1.0.0

register()

Registers the tokens that this sniff wants to listen for.

public register() : array<string|int, int|string>
Tags
since
1.0.0
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
since
1.0.0
Return values
int|false

Integer levels value or FALSE if the levels value couldn't be determined.


        
On this page

Search results