Repository navigation
v0.2.1
Valid PHP that the parser rejected now parses (#17):
- Partial function application (PHP 8.6):
f(1, ?),f(1, ...),f(a: ?).ArgumentExpressionhas a new childquestionToken;expressionis null for placeholders. - The
(void)cast (PHP 8.5), with a whole expression as its operand:(void) $x = f();. New token kindTokenKind::VoidCastToken. - Dereferencing and calling array literals and
null/true/false:['A', 'm'](),[0, 1][0],null?->x. - Properties with only a set visibility:
protected(set) int $x;,public(set) readonly int $r;. clone (expr)->propandclone ($a)[0].- Hook lists after a constant default:
public ?int $x = null { get => ... },public int $x = self::A { ... }.
Changes to the tree:
- The set visibility of a property stays in
PropertyDeclaration::$modifiers, in source order.$setVisibilityTokenstill refers to it but is no longer inCHILD_NAMES. intdiv(..., 3)andarray(0)()no longer produce parse errors. A variadic placeholder that is not last is reported as a diagnostic ("Variadic placeholder must be last").
New diagnostics:
- "Variadic placeholder must be last" / "Variadic placeholder may only appear once" for
f(..., 1)andf(..., ...). - "Unexpected '(void)'" for a void cast that is not a statement or part of a
forexpression list:$x = (void) f();,for (; (void) f(); ).
Not yet supported: clone(?) and clone(...), new readonly class, &get hooks and hooks on promoted parameters with a default.