Documentation

ModifierKeywordOrderSniff
in package
implements Sniff

FinalYes

Standardize the modifier keyword order for class declarations.

Tags
since
1.0.0

Table of Contents

Interfaces

Sniff

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

READONLY_EXTEND

Order preference: readonly abstract/final.

public string READONLY_EXTEND = 'readonly extendability'
Tags
since
1.0.0

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