Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
150 lars 1
<?php declare(strict_types=1);
2
 
3
namespace PhpParser\Lexer\TokenEmulator;
4
 
5
use PhpParser\Lexer\Emulative;
6
 
7
/*
8
 * In PHP 8.1, "readonly(" was special cased in the lexer in order to support functions with
9
 * name readonly. In PHP 8.2, this may conflict with readonly properties having a DNF type. For
10
 * this reason, PHP 8.2 instead treats this as T_READONLY and then handles it specially in the
11
 * parser. This emulator only exists to handle this special case, which is skipped by the
12
 * PHP 8.1 ReadonlyTokenEmulator.
13
 */
14
class ReadonlyFunctionTokenEmulator extends KeywordEmulator {
15
    public function getKeywordString(): string {
16
        return 'readonly';
17
    }
18
 
19
    public function getKeywordToken(): int {
20
        return \T_READONLY;
21
    }
22
 
23
    public function getPhpVersion(): string {
24
        return Emulative::PHP_8_2;
25
    }
26
 
27
    public function reverseEmulate(string $code, array $tokens): array {
28
        // Don't bother
29
        return $tokens;
30
    }
31
}