PHP Class Generic_Sniffs_Formatting_MultipleStatementAlignmentSniff, PHP_CodeSniffer

Checks alignment of assignments. If there are multiple adjacent assignments, it will check that the equals signs of each assignment are aligned. It will display a warning to advise that the signs should be aligned.
Author: Greg Sherwood ([email protected])
Author: Marc McIntyre ([email protected])
Inheritance: implements PHP_CodeSniffer_Sniff
ファイルを表示 Open project: squizlabs/php_codesniffer

Public Properties

Property Type Description
$error boolean If true, an error will be thrown; otherwise a warning.
$maxPadding integer If the amount of padding required to align this assignment with the surrounding assignments exceeds this number, the assignment will be ignored and no errors or warnings will be thrown.
$supportedTokenizers array A list of tokenizers this sniff supports.

Public Methods

Method Description
checkAlignment ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : integer Processes this test, when one of its tokens is encountered.
process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : integer Processes this test, when one of its tokens is encountered.
register ( ) : array Returns an array of tokens this test wants to listen for.

Method Details

checkAlignment() public method

Processes this test, when one of its tokens is encountered.
public checkAlignment ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : integer
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
return integer

process() public method

Processes this test, when one of its tokens is encountered.
public process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : integer
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
return integer

register() public method

Returns an array of tokens this test wants to listen for.
public register ( ) : array
return array

Property Details

$error public_oe property

If true, an error will be thrown; otherwise a warning.
public bool $error
return boolean

$maxPadding public_oe property

If the amount of padding required to align this assignment with the surrounding assignments exceeds this number, the assignment will be ignored and no errors or warnings will be thrown.
public int $maxPadding
return integer

$supportedTokenizers public_oe property

A list of tokenizers this sniff supports.
public array $supportedTokenizers
return array