PHP Класс Generic_Sniffs_WhiteSpace_ScopeIndentSniff, PHP_CodeSniffer

Checks that control structures are structured correctly, and their content is indented correctly. This sniff will throw errors if tabs are used for indentation rather than spaces.
Автор: Greg Sherwood ([email protected])
Автор: Marc McIntyre ([email protected])
Наследование: implements PHP_CodeSniffer_Sniff
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$exact boolean If TRUE, indent needs to be exactly $indent spaces. If FALSE, indent needs to be at least $indent spaces (but can be more).
$ignoreIndentationTokens int[] 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 integer The number of spaces code should be indented.
$supportedTokenizers array A list of tokenizers this sniff supports.
$tabIndent boolean 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.

Защищенные свойства (Protected)

Свойство Тип Описание
$nonIndentingScopes int[] Any scope openers that should not cause an indent.

Открытые методы

Метод Описание
process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void Processes this test, when one of its tokens is encountered.
register ( ) : array Returns an array of tokens this test wants to listen for.

Описание методов

process() публичный Метод

Processes this test, when one of its tokens is encountered.
public process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File All the tokens found in the document.
$stackPtr integer The position of the current token in the stack passed in $tokens.
Результат void

register() публичный Метод

Returns an array of tokens this test wants to listen for.
public register ( ) : array
Результат array

Описание свойств

$exact публичное свойство

If TRUE, indent needs to be exactly $indent spaces. If FALSE, indent needs to be at least $indent spaces (but can be more).
public bool $exact
Результат boolean

$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.
public int[] $ignoreIndentationTokens
Результат int[]

$indent публичное свойство

The number of spaces code should be indented.
public int $indent
Результат integer

$nonIndentingScopes защищенное свойство

Any scope openers that should not cause an indent.
protected int[] $nonIndentingScopes
Результат int[]

$supportedTokenizers публичное свойство

A list of tokenizers this sniff supports.
public array $supportedTokenizers
Результат array

$tabIndent публичное свойство

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.
public bool $tabIndent
Результат boolean