PEAR_Sniffs_WhiteSpace_ScopeIndentSniff
extends Generic_Sniffs_WhiteSpace_ScopeIndentSniff
in package
PEAR_Sniffs_Whitespace_ScopeIndentSniff.
Checks that control structures are structured correctly, and their content is indented correctly.
Tags
Table of Contents
- $exact : bool
- Does the indent need to be exactly right?
- $ignoreIndentationTokens : array<string|int, int>
- List of tokens not needing to be checked for indentation.
- $indent : int
- The number of spaces code should be indented.
- $supportedTokenizers : array<string|int, mixed>
- A list of tokenizers this sniff supports.
- $tabIndent : bool
- Should tabs be used for indenting?
- $nonIndentingScopes : array<string|int, mixed>|(int)
- Any scope openers that should not cause an indent.
- $_debug : bool
- Show debug output for this sniff.
- $_ignoreIndentationTokens : array<string|int, int>
- List of tokens not needing to be checked for indentation.
- $_tabWidth : int
- The --tab-width CLI value that is being used.
- 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
$exact
Does the indent need to be exactly right?
public
bool
$exact
= alse
If TRUE, indent needs to be exactly $indent spaces. If FALSE, indent needs to be at least $indent spaces (but can be more).
$ignoreIndentationTokens
List of tokens not needing to be checked for indentation.
public
array<string|int, int>
$ignoreIndentationTokens
= array()
Useful to allow Sniffs based on this to easily ignore/skip some tokens from verification. For example, inline HTML sections or PHP open/close tags can escape from here and have their own rules elsewhere.
$indent
The number of spaces code should be indented.
public
int
$indent
= 4
$supportedTokenizers
A list of tokenizers this sniff supports.
public
array<string|int, mixed>
$supportedTokenizers
= array('PHP', 'JS')
$tabIndent
Should tabs be used for indenting?
public
bool
$tabIndent
= alse
If TRUE, fixes will be made using tabs instead of spaces. The size of each tab is important, so it should be specified using the --tab-width CLI argument.
$nonIndentingScopes
Any scope openers that should not cause an indent.
protected
array<string|int, mixed>|(int)
$nonIndentingScopes
= array(T_SWITCH)
$_debug
Show debug output for this sniff.
private
bool
$_debug
= alse
$_ignoreIndentationTokens
List of tokens not needing to be checked for indentation.
private
array<string|int, int>
$_ignoreIndentationTokens
= array()
This is a cached copy of the public version of this var, which can be set in a ruleset file, and some core ignored tokens.
$_tabWidth
The --tab-width CLI value that is being used.
private
int
$_tabWidth
=
ull
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
-
All the tokens found in the document.
- $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>