LongConditionClosingCommentSniff
in package
implements
Sniff
Table of Contents
Interfaces
Constants
- CONDITION_OPENERS = [T_SWITCH => T_SWITCH, T_IF => T_IF, T_FOR => T_FOR, T_FOREACH => T_FOREACH, T_WHILE => T_WHILE, T_TRY => T_TRY, T_CASE => T_CASE, T_MATCH => T_MATCH]
- The condition openers that we are interested in.
Properties
- $commentFormat : string
- The format the end comment should be in.
- $lineLimit : int
- The length that a code block must be before requiring a closing comment.
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.
Constants
CONDITION_OPENERS
The condition openers that we are interested in.
private
array<int|string, int|string>
CONDITION_OPENERS
= [T_SWITCH => T_SWITCH, T_IF => T_IF, T_FOR => T_FOR, T_FOREACH => T_FOREACH, T_WHILE => T_WHILE, T_TRY => T_TRY, T_CASE => T_CASE, T_MATCH => T_MATCH]
Properties
$commentFormat
The format the end comment should be in.
public
string
$commentFormat
= '//end %s'
The placeholder %s will be replaced with the type of condition opener.
$lineLimit
The length that a code block must be before requiring a closing comment.
public
int
$lineLimit
= 20
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.
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, int|string>