Squiz_Sniffs_Commenting_LongConditionClosingCommentSniff
in package
implements
PHP_CodeSniffer_Sniff
Squiz_Sniffs_ControlStructures_LongConditionClosingCommentSniff.
Tags
Interfaces, Classes and Traits
- PHP_CodeSniffer_Sniff
- Represents a PHP_CodeSniffer sniff for sniffing coding standards.
Table of Contents
- $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.
- $supportedTokenizers : array<string|int, mixed>
- A list of tokenizers this sniff supports.
- $_openers : array<string|int, mixed>|(int)
- The openers that we are interested in.
- process() : void
- 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.
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
$supportedTokenizers
A list of tokenizers this sniff supports.
public
array<string|int, mixed>
$supportedTokenizers
= array('PHP', 'JS')
$_openers
The openers that we are interested in.
private
static array<string|int, mixed>|(int)
$_openers
= array(T_SWITCH, T_IF, T_FOR, T_FOREACH, T_WHILE, T_TRY, T_CASE)
Methods
process()
Processes this test, when one of its tokens is encountered.
public
process(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Return values
void —register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>