OperatorSpacingSniff
extends OperatorSpacingSniff
in package
Table of Contents
Properties
- $ignoreNewlines : bool
- Allow newlines instead of spaces.
- $ignoreSpacingBeforeAssignments : bool
- Don't check spacing for assignment operators.
- $supportedTokenizers : array<string|int, mixed>
- A list of tokenizers this sniff supports.
- $nonOperandTokens : array<string|int, string>
- A list of tokens that aren't considered as operands.
Methods
- process() : void|int
- Processes this sniff, when one of its tokens is encountered.
- register() : array<string|int, int|string>
- Returns an array of tokens this test wants to listen for.
- isOperator() : bool
- Checks if an operator is actually a different type of token in the current context.
Properties
$ignoreNewlines
Allow newlines instead of spaces.
public
bool
$ignoreNewlines
= false
$ignoreSpacingBeforeAssignments
Don't check spacing for assignment operators.
public
bool
$ignoreSpacingBeforeAssignments
= true
This allows multiple assignment statements to be aligned.
$supportedTokenizers
A list of tokenizers this sniff supports.
public
array<string|int, mixed>
$supportedTokenizers
= ['PHP', 'JS']
$nonOperandTokens
A list of tokens that aren't considered as operands.
private
array<string|int, string>
$nonOperandTokens
= []
Methods
process()
Processes this sniff, when one of its tokens is encountered.
public
process(File $phpcsFile, int $stackPtr) : void|int
Parameters
- $phpcsFile : File
-
The current file being checked.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Return values
void|int —Optionally returns a stack pointer. The sniff will not be
called again on the current file until the returned stack
pointer is reached. Return $phpcsFile->numTokens
to skip
the rest of the file.
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, int|string>
Return values
array<string|int, int|string>isOperator()
Checks if an operator is actually a different type of token in the current context.
protected
isOperator(File $phpcsFile, int $stackPtr) : bool
Parameters
- $phpcsFile : File
-
The current file being checked.
- $stackPtr : int
-
The position of the operator in the stack.