mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 17:38:19 +01:00
5900d78cc9
This is a huge hack... We temporarily create a new node with the correct structure and use that for printing. I think it would be better to always use a separate node type for NewAnonClass, rather than using a combination of New and Class, but this would require some larger changes, as this node type would have to be both Expr and ClassLike, which is not possible right now, as the latter is a class rather than an interface...
16 lines
195 B
Plaintext
16 lines
195 B
Plaintext
Anonymous classes
|
|
-----
|
|
<?php
|
|
new class
|
|
($x)
|
|
extends X
|
|
{ };
|
|
-----
|
|
$new = $stmts[0]->expr;
|
|
$new->class->extends = null;
|
|
$new->args[] = new Expr\Variable('y');
|
|
-----
|
|
<?php
|
|
new class
|
|
($x, $y)
|
|
{ }; |