| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
namespace PhpParser\Lexer\TokenEmulator; |
| 4 |
|
| 5 |
use PhpParser\PhpVersion; |
| 6 |
|
| 7 |
final class EnumTokenEmulator extends KeywordEmulator { |
| 8 |
public function getPhpVersion(): PhpVersion { |
| 9 |
return PhpVersion::fromComponents(8, 1); |
| 10 |
} |
| 11 |
|
| 12 |
public function getKeywordString(): string { |
| 13 |
return 'enum'; |
| 14 |
} |
| 15 |
|
| 16 |
public function getKeywordToken(): int { |
| 17 |
return \T_ENUM; |
| 18 |
} |
| 19 |
|
| 20 |
protected function isKeywordContext(array $tokens, int $pos): bool { |
| 21 |
return parent::isKeywordContext($tokens, $pos) |
| 22 |
&& isset($tokens[$pos + 2]) |
| 23 |
&& $tokens[$pos + 1]->id === \T_WHITESPACE |
| 24 |
&& $tokens[$pos + 2]->id === \T_STRING; |
| 25 |
} |
| 26 |
} |