function TokenPolyfill::getTokenName
Get the name of the token. For single-char tokens this will be the token character. Otherwise it will be a T_* style name, or null if the token ID is unknown.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Internal/ TokenPolyfill.php, line 53
Class
- TokenPolyfill
- This is a polyfill for the PhpToken class introduced in PHP 8.0. We do not actually polyfill PhpToken, because composer might end up picking a different polyfill implementation, which does not meet our requirements.
Namespace
PhpParser\InternalCode
public function getTokenName() : ?string {
if ($this->id < 256) {
return \chr($this->id);
}
$name = token_name($this->id);
return $name === 'UNKNOWN' ? null : $name;
}