function Tokens::tokenName
Given a token, returns the name of the token.
If passed an integer, the token name is sourced from PHP's token_name() function. If passed a string, it is assumed to be a PHPCS-supplied token that begins with PHPCS_T_, so the name is sourced from the token value itself.
Parameters
int|string $token The token to get the name for.:
Return value
string
4 calls to Tokens::tokenName()
- PHP::processAdditional in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ PHP.php - Performs additional processing after main tokenizing.
- PHP::standardiseToken in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ PHP.php - Takes a token produced from <code>token_get_all()</code> and produces a more uniform token.
- PHP::tokenize in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ PHP.php - Creates an array of tokens when given some PHP code.
- Tokenizer::createLevelMap in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ Tokenizer.php - Constructs the level map.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Util/ Tokens.php, line 760
Class
Namespace
PHP_CodeSniffer\UtilCode
public static function tokenName($token) {
if (is_string($token) === false) {
// PHP-supplied token name.
return token_name($token);
}
return substr($token, 6);
}