Repository navigation
More valid PHP that the parser rejected now parses (#18):
clonewith an argument list (PHP 8.6):clone(?),clone(...),clone($obj, ?),clone(object: $obj),clone().- Modifiers of anonymous classes:
new readonly class {},new #[A] readonly class(1) {}. - Property hooks that return by reference:
&get => $this->x;. - Hooks on constructor parameters:
public int $x = 1 { get => ...; }, also after an object default (= new Foo() { get => ... }). - The magic constant
__PROPERTY__. - Semi-reserved words in trait adaptations:
f as list;,list as protected;,T::f as public array;. - Negative offsets in interpolated strings:
"$a[-3]". - The binary prefix with interpolation:
b"a $x",b<<<E. - Reserved words in use clauses:
use string as X;,use function Foo\bar as string;. - Calls of a function named
readonly:readonly(),new (readonly())().
Changes to the tree:
- New children:
CloneExpression::$argumentExpressionList(set instead of$expressionwhen the parentheses hold anything other than the object and the optional modifications),ObjectCreationExpression::$modifiers,PropertyHook::$byRefToken,Parameter::$hookList. "$a[-3]"has aUnaryOpExpressionaround the number as the offset.- The name of a
readonly()call is aQualifiedNamewhose name part keeps the kindReadonlyKeywordwhen php's tokenizer returns the keyword.getResolvedName()andgetLastNamePart()accept it; the name resolves to the global function.
Now reported as errors, as in PHP:
- More than one modifier on a trait method alias:
A as protected public b;. - Curly-brace offsets in a parameter default (
$x = C{0}): the braces start a hook list.