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