ModifierKeywordOrderSniff
in package
implements
Sniff
FinalYes
Standardize the modifier keyword order for class declarations.
Tags
Table of Contents
Interfaces
Constants
- EXTEND_READONLY = 'extendability readonly'
- Order preference: abstract/final readonly.
- METRIC_NAME = 'Class modifier keyword order'
- Name of the metric.
- READONLY_EXTEND = 'readonly extendability'
- Order preference: readonly abstract/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
EXTEND_READONLY
Order preference: abstract/final readonly.
public
string
EXTEND_READONLY
= 'extendability readonly'
Tags
METRIC_NAME
Name of the metric.
public
string
METRIC_NAME
= 'Class modifier keyword order'
Tags
READONLY_EXTEND
Order preference: readonly abstract/final.
public
string
READONLY_EXTEND
= 'readonly extendability'
Tags
Properties
$order
Preferred order for the modifier keywords.
public
string
$order
= self::EXTEND_READONLY
Accepted values:
- "extendability readonly".
- or "readonly extendability".
Defaults to "extendability readonly".
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.