LineLengthSniff
in package
implements
Sniff
Interfaces, Classes and Traits
Table of Contents
- $absoluteLineLimit : int
- The limit that the length of a line must not exceed.
- $ignoreComments : bool
- Whether or not to ignore trailing comments.
- $lineLimit : int
- The limit that the length of a line should not exceed.
- process() : int
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
- checkLineLength() : void
- Checks if a line is too long.
Properties
$absoluteLineLimit
The limit that the length of a line must not exceed.
public
int
$absoluteLineLimit
= 100
Set to zero (0) to disable.
$ignoreComments
Whether or not to ignore trailing comments.
public
bool
$ignoreComments
= false
This has the effect of also ignoring all lines that only contain comments.
$lineLimit
The limit that the length of a line should not exceed.
public
int
$lineLimit
= 80
Methods
process()
Processes this test, when one of its tokens is encountered.
public
process(File $phpcsFile, int $stackPtr) : int
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Return values
int —register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>
Return values
array<string|int, mixed> —checkLineLength()
Checks if a line is too long.
protected
checkLineLength(File $phpcsFile, array<string|int, mixed> $tokens, int $stackPtr) : void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $tokens : array<string|int, mixed>
-
The token stack.
- $stackPtr : int
-
The first token on the next line.