Documentation

ModifierKeywordOrderSniff
in package
implements Sniff

FinalYes

Standardize the modifier keyword order for OO constant declarations.

Tags
since
1.0.0

Table of Contents

Interfaces

Sniff

Constants

FINAL_VISIBILITY  = 'final visibility'
Order preference: final visibility.
METRIC_NAME  = 'OO constant modifier keyword order'
Name of the metric.
VISIBILITY_FINAL  = 'visibility final'
Order preference: visibility final.

Properties

$order  : string
Preferred order for the modifier keywords.

Methods

process()  : void
Processes this test, when one of its tokens is encountered.
register()  : array<string|int, int|string>
Returns an array of tokens this test wants to listen for.
handleError()  : void
Throw the error and potentially fix it.

Constants

FINAL_VISIBILITY

Order preference: final visibility.

public string FINAL_VISIBILITY = 'final visibility'
Tags
since
1.0.0

METRIC_NAME

Name of the metric.

public string METRIC_NAME = 'OO constant modifier keyword order'
Tags
since
1.0.0

VISIBILITY_FINAL

Order preference: visibility final.

public string VISIBILITY_FINAL = 'visibility final'
Tags
since
1.0.0

Properties

$order

Preferred order for the modifier keywords.

public string $order = self::FINAL_VISIBILITY

Accepted values:

  • "final visibility".
  • or "visibility final".

Defaults to "final visibility".

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

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>

handleError()

Throw the error and potentially fix it.

private handleError(File $phpcsFile, int $firstKeyword, int $secondKeyword) : void
Parameters
$phpcsFile : File

The file being scanned.

$firstKeyword : int

The position of the first keyword found.

$secondKeyword : int

The position of the second keyword token.

Tags
since
1.0.0

        
On this page

Search results