PHP Класс PHP_CodeSniffer_Tokenizers_PHP, PHP_CodeSniffer

Автор: Greg Sherwood ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$endScopeTokens array This array is just a unique collection of the end tokens from the _scopeOpeners array. The data is duplicated here to save time during parsing of the file.
$scopeOpeners array This array also contains information about what kind of token the scope opener uses to open and close the scope, if the token strictly requires an opener, if the token can share a scope closer, and who it can be shared with. An example of a token that shares a scope closer is a CASE scope.
$skipMinified boolean If TRUE, files that appear to be minified will not be processed.

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

Метод Описание
processAdditional ( array &$tokens, string $eolChar ) : void Performs additional processing after main tokenizing.
resolveSimpleToken ( string $token ) : array Converts simple tokens into a format that conforms to complex tokens produced by token_get_all().
standardiseToken ( string | array $token ) : array Takes a token produced from token_get_all() and produces a more uniform token.
tokenizeString ( string $string, string $eolChar = '\n' ) : array Creates an array of tokens when given some PHP code.

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

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

This additional processing checks for CASE statements that are using curly braces for scope openers and closers. It also turns some T_FUNCTION tokens into T_CLOSURE when they are not standard function definitions. It also detects short array syntax and converts those square brackets into new tokens. It also corrects some usage of the static and class keywords. It also assigns tokens to function return types.
public processAdditional ( array &$tokens, string $eolChar ) : void
$tokens array The array of tokens to process.
$eolChar string The EOL character to use for splitting strings.
Результат void

resolveSimpleToken() публичный статический Метод

Simple tokens are tokens that are not in array form when produced from token_get_all().
public static resolveSimpleToken ( string $token ) : array
$token string The simple token to convert.
Результат array The new token in array format.

standardiseToken() публичный статический Метод

Takes a token produced from token_get_all() and produces a more uniform token.
public static standardiseToken ( string | array $token ) : array
$token string | array The token to convert.
Результат array The new token.

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

Starts by using token_get_all() but does a lot of extra processing to insert information about the context of the token.
public tokenizeString ( string $string, string $eolChar = '\n' ) : array
$string string The string to tokenize.
$eolChar string The EOL character to use for splitting strings.
Результат array

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

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

This array is just a unique collection of the end tokens from the _scopeOpeners array. The data is duplicated here to save time during parsing of the file.
public array $endScopeTokens
Результат array

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

This array also contains information about what kind of token the scope opener uses to open and close the scope, if the token strictly requires an opener, if the token can share a scope closer, and who it can be shared with. An example of a token that shares a scope closer is a CASE scope.
public array $scopeOpeners
Результат array

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

If TRUE, files that appear to be minified will not be processed.
public bool $skipMinified
Результат boolean