1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-27 04:14:44 +01:00
PHP-Parser/test/code/formatPreservation/anonClasses.test
Nikita Popov d5180f0d95 Change test to use correct node type
Class name is an Identifier, not a Name.
2019-01-12 17:31:37 +01:00

28 lines
365 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)
{ };
-----
<?php
new class
{};
-----
// Ignore name assigned to anon class
$new = $stmts[0]->expr;
$new->class->name = new Node\Identifier('Anon1');
-----
<?php
new class
{};