ModifierKeywordOrderSniff
in package
implements
Sniff
FinalYes
Standardize the modifier keyword order for OO constant declarations.
Tags
Table of Contents
Interfaces
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
METRIC_NAME
Name of the metric.
public
string
METRIC_NAME
= 'OO constant modifier keyword order'
Tags
VISIBILITY_FINAL
Order preference: visibility final.
public
string
VISIBILITY_FINAL
= 'visibility final'
Tags
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
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()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, int|string>
Tags
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.