1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

Remove anon class null name assertion

Fixes #554.
This commit is contained in:
Nikita Popov 2018-12-26 12:23:42 +01:00
parent 80ead71da2
commit 49d73e829f

View File

@ -39,6 +39,8 @@ class PrintableNewAnonClassNode extends Expr
public static function fromNewNode(Expr\New_ $newNode) {
$class = $newNode->class;
assert($class instanceof Node\Stmt\Class_);
// We don't assert that $class->name is null here, to allow consumers to assign unique names
// to anonymous classes for their own purposes. We simplify ignore the name here.
assert($class->name === null);
return new self(
$newNode->args, $class->extends, $class->implements,