8: constructor property promotion // PHP 8: Attribute public function __construct(#[Immutable] private int $value) { } public function getValue(): int { return $this->value; } } 17
expression return match ($ch) { '[' => new LeftSquareBracketToken(), ']' => new RightSquareBracketToken(), '{' => new LeftCurlyBracketToken(), '}' => new RightCurlyBracketToken(), ':' => new ColonToken(), ',' => new CommaToken(), default => throw new LexerException('Invalid character ' . $ch), }; } 25
public function parse(string $json): array|string|int|bool|null { $lexer = new Lexer\Lexer($json); $parser = new Parser\Parser($lexer); return $parser->parse(); } } 54