PHP Class PHP_CodeSniffer_Tokenizers_PHP, PHP_CodeSniffer

Afficher le fichier Open project: squizlabs/php_codesniffer Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
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.

Method Details

processAdditional() public méthode

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.
Résultat void

resolveSimpleToken() public static méthode

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.
Résultat array The new token in array format.

standardiseToken() public static méthode

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.
Résultat array The new token.

tokenizeString() public méthode

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.
Résultat array

Property Details

$endScopeTokens public_oe property

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
Résultat array

$scopeOpeners public_oe property

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
Résultat array

$skipMinified public_oe property

If TRUE, files that appear to be minified will not be processed.
public bool $skipMinified
Résultat boolean