Documentation

LowercaseFunctionConstSniff
in package
implements Sniff

FinalYes

Verify that the `function` and `const` keyword in import `use` statements are lowercase.

Companion sniff to the upstream Generic.PHP.LowerCaseKeyword sniff which doesn't cover these keywords as they are not tokenized as T_FUNCTION/T_CONST, but as T_STRING.

Tags
since
1.0.0

Table of Contents

Interfaces

Sniff

Constants

METRIC_NAME  = 'Import use statement %s keyword case'
Name of the metric.

Properties

$keywords  : array<string, true>
A list of keywords that can follow use statements.

Methods

process()  : void
Processes this test, when one of its tokens is encountered.
processKeyword()  : void
Processes a found keyword.
register()  : array<string|int, int|string>
Returns an array of tokens this test wants to listen for.

Constants

Properties

$keywords

A list of keywords that can follow use statements.

protected array<string, true> $keywords = ['const' => true, 'function' => true]
Tags
since
1.0.0

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

processKeyword()

Processes a found keyword.

public processKeyword(File $phpcsFile, int $stackPtr, string $content) : void
Parameters
$phpcsFile : File

The file being scanned.

$stackPtr : int

The position of the keyword in the token stack.

$content : string

The keyword as found.

Tags
since
1.0.0

register()

Returns an array of tokens this test wants to listen for.

public register() : array<string|int, int|string>
Tags
since
1.0.0
Return values
array<string|int, int|string>

        
On this page

Search results