Documentation

ScopeIndentSniff extends ScopeIndentSniff
in package

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, int>
Any scope openers that should not cause an indent.
$debug  : bool
Show debug output for this sniff.
$ignoreIndentation  : 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()  : int
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.
adjustIndent()  : bool
Processes this test, when one of its tokens is encountered.

Properties

$exact

Does the indent need to be exactly right?

public bool $exact = false

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 = []

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 = ['PHP', 'JS']

$tabIndent

Should tabs be used for indenting?

public bool $tabIndent = false

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, int> $nonIndentingScopes = [T_SWITCH]

$ignoreIndentation

List of tokens not needing to be checked for indentation.

private array<string|int, int> $ignoreIndentation = []

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 = null

Methods

process()

Processes this test, when one of its tokens is encountered.

public process(File $phpcsFile, int $stackPtr) : int
Parameters
$phpcsFile : File

All the tokens found in the document.

$stackPtr : int

The position of the current token in the stack passed in $tokens.

Return values
int

register()

Returns an array of tokens this test wants to listen for.

public register() : array<string|int, mixed>
Return values
array<string|int, mixed>

adjustIndent()

Processes this test, when one of its tokens is encountered.

protected adjustIndent(File $phpcsFile, int $stackPtr, int $length, int $change) : bool
Parameters
$phpcsFile : File

All the tokens found in the document.

$stackPtr : int

The position of the current token in the stack passed in $tokens.

$length : int

The length of the new indent.

$change : int

The difference in length between the old and new indent.

Return values
bool

Search results