Avoid parent constructor call during node construction

Instead explicitly assign the attributes. This is a minor
performance improvement.
This commit is contained in:
Nikita Popov 2019-05-12 14:55:21 +02:00
parent 9d44edf85d
commit 993f29906b
99 changed files with 99 additions and 99 deletions

View File

@ -22,7 +22,7 @@ class Arg extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;

View File

@ -22,7 +22,7 @@ class Const_ extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct($name, Expr $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->value = $value;
}

View File

@ -19,7 +19,7 @@ class ArrayDimFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $dim = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->dim = $dim;
}

View File

@ -24,7 +24,7 @@ class ArrayItem extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value, Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;

View File

@ -20,7 +20,7 @@ class Array_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(array $items = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->items = $items;
}

View File

@ -33,7 +33,7 @@ class ArrowFunction extends Expr implements FunctionLike
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->static = $subNodes['static'] ?? false;
$this->byRef = $subNodes['byRef'] ?? false;
$this->params = $subNodes['params'] ?? [];

View File

@ -19,7 +19,7 @@ class Assign extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ abstract class AssignOp extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ class AssignRef extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ abstract class BinaryOp extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $left, Expr $right, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->left = $left;
$this->right = $right;
}

View File

@ -16,7 +16,7 @@ class BitwiseNot extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class BooleanNot extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ abstract class Cast extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -21,7 +21,7 @@ class ClassConstFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->class = $class;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}

View File

@ -16,7 +16,7 @@ class Clone_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -34,7 +34,7 @@ class Closure extends Expr implements FunctionLike
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->static = $subNodes['static'] ?? false;
$this->byRef = $subNodes['byRef'] ?? false;
$this->params = $subNodes['params'] ?? [];

View File

@ -19,7 +19,7 @@ class ClosureUse extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->byRef = $byRef;
}

View File

@ -17,7 +17,7 @@ class ConstFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Name $name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = $name;
}

View File

@ -16,7 +16,7 @@ class Empty_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -18,7 +18,7 @@ class Error extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
}
public function getSubNodeNames() : array {

View File

@ -16,7 +16,7 @@ class ErrorSuppress extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class Eval_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -20,7 +20,7 @@ class Exit_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -20,7 +20,7 @@ class FuncCall extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($name, array $args = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = $name;
$this->args = $args;
}

View File

@ -24,7 +24,7 @@ class Include_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, int $type, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
$this->type = $type;
}

View File

@ -20,7 +20,7 @@ class Instanceof_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, $class, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
$this->class = $class;
}

View File

@ -16,7 +16,7 @@ class Isset_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->vars = $vars;
}

View File

@ -16,7 +16,7 @@ class List_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(array $items, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->items = $items;
}

View File

@ -24,7 +24,7 @@ class MethodCall extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->args = $args;

View File

@ -20,7 +20,7 @@ class New_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, array $args = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->class = $class;
$this->args = $args;
}

View File

@ -16,7 +16,7 @@ class PostDec extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
}

View File

@ -16,7 +16,7 @@ class PostInc extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
}

View File

@ -16,7 +16,7 @@ class PreDec extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
}

View File

@ -16,7 +16,7 @@ class PreInc extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
}

View File

@ -16,7 +16,7 @@ class Print_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -20,7 +20,7 @@ class PropertyFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}

View File

@ -16,7 +16,7 @@ class ShellExec extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->parts = $parts;
}

View File

@ -24,7 +24,7 @@ class StaticCall extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $args = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->class = $class;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->args = $args;

View File

@ -21,7 +21,7 @@ class StaticPropertyFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->class = $class;
$this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name;
}

View File

@ -22,7 +22,7 @@ class Ternary extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $cond, $if, Expr $else, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->if = $if;
$this->else = $else;

View File

@ -16,7 +16,7 @@ class UnaryMinus extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class UnaryPlus extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class Variable extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = $name;
}

View File

@ -16,7 +16,7 @@ class YieldFrom extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ class Yield_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value = null, Expr $key = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->key = $key;
$this->value = $value;
}

View File

@ -25,7 +25,7 @@ class Identifier extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct(string $name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = $name;
}

View File

@ -22,7 +22,7 @@ class Name extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->parts = self::prepareName($name);
}

View File

@ -16,7 +16,7 @@ class NullableType extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct($type, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->type = \is_string($type) ? new Identifier($type) : $type;
}

View File

@ -31,7 +31,7 @@ class Param extends NodeAbstract
$var, Expr $default = null, $type = null,
bool $byRef = false, bool $variadic = false, array $attributes = []
) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->type = \is_string($type) ? new Identifier($type) : $type;
$this->byRef = $byRef;
$this->variadic = $variadic;

View File

@ -16,7 +16,7 @@ class DNumber extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(float $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
}

View File

@ -17,7 +17,7 @@ class Encapsed extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->parts = $parts;
}

View File

@ -16,7 +16,7 @@ class EncapsedStringPart extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(string $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
}

View File

@ -23,7 +23,7 @@ class LNumber extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(int $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
}

View File

@ -12,7 +12,7 @@ abstract class MagicConst extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
}
public function getSubNodeNames() : array {

View File

@ -34,7 +34,7 @@ class String_ extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct(string $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
}

View File

@ -16,7 +16,7 @@ class Break_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $num = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->num = $num;
}

View File

@ -19,7 +19,7 @@ class Case_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct($cond, array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}

View File

@ -25,7 +25,7 @@ class Catch_ extends Node\Stmt
public function __construct(
array $types, Expr\Variable $var, array $stmts = [], array $attributes = []
) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->types = $types;
$this->var = $var;
$this->stmts = $stmts;

View File

@ -19,7 +19,7 @@ class ClassConst extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $consts, int $flags = 0, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->flags = $flags;
$this->consts = $consts;
}

View File

@ -51,7 +51,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0;
$this->byRef = $subNodes['byRef'] ?? false;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;

View File

@ -35,7 +35,7 @@ class Class_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->extends = $subNodes['extends'] ?? null;

View File

@ -16,7 +16,7 @@ class Const_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $consts, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->consts = $consts;
}

View File

@ -16,7 +16,7 @@ class Continue_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $num = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->num = $num;
}

View File

@ -19,7 +19,7 @@ class DeclareDeclare extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct($key, Node\Expr $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->key = \is_string($key) ? new Node\Identifier($key) : $key;
$this->value = $value;
}

View File

@ -19,7 +19,7 @@ class Declare_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $declares, array $stmts = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->declares = $declares;
$this->stmts = $stmts;
}

View File

@ -19,7 +19,7 @@ class Do_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}

View File

@ -16,7 +16,7 @@ class Echo_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $exprs, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->exprs = $exprs;
}

View File

@ -19,7 +19,7 @@ class ElseIf_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}

View File

@ -16,7 +16,7 @@ class Else_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->stmts = $stmts;
}

View File

@ -19,7 +19,7 @@ class Expression extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class Finally_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->stmts = $stmts;
}

View File

@ -26,7 +26,7 @@ class For_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->init = $subNodes['init'] ?? [];
$this->cond = $subNodes['cond'] ?? [];
$this->loop = $subNodes['loop'] ?? [];

View File

@ -29,7 +29,7 @@ class Foreach_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
$this->keyVar = $subNodes['keyVar'] ?? null;
$this->byRef = $subNodes['byRef'] ?? false;

View File

@ -33,7 +33,7 @@ class Function_ extends Node\Stmt implements FunctionLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->byRef = $subNodes['byRef'] ?? false;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->params = $subNodes['params'] ?? [];

View File

@ -16,7 +16,7 @@ class Global_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->vars = $vars;
}

View File

@ -17,7 +17,7 @@ class Goto_ extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}

View File

@ -23,7 +23,7 @@ class GroupUse extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Name $prefix, array $uses, int $type = Use_::TYPE_NORMAL, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->type = $type;
$this->prefix = $prefix;
$this->uses = $uses;

View File

@ -16,7 +16,7 @@ class HaltCompiler extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(string $remaining, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->remaining = $remaining;
}

View File

@ -26,7 +26,7 @@ class If_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $subNodes['stmts'] ?? [];
$this->elseifs = $subNodes['elseifs'] ?? [];

View File

@ -16,7 +16,7 @@ class InlineHTML extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(string $value, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->value = $value;
}

View File

@ -19,7 +19,7 @@ class Interface_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->extends = $subNodes['extends'] ?? [];
$this->stmts = $subNodes['stmts'] ?? [];

View File

@ -17,7 +17,7 @@ class Label extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}

View File

@ -23,7 +23,7 @@ class Namespace_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Name $name = null, $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = $name;
$this->stmts = $stmts;
}

View File

@ -25,7 +25,7 @@ class Property extends Node\Stmt
* @param null|string|Identifier|Name|NullableType $type Type declaration
*/
public function __construct(int $flags, array $props, array $attributes = [], $type = null) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->flags = $flags;
$this->props = $props;
$this->type = \is_string($type) ? new Identifier($type) : $type;

View File

@ -19,7 +19,7 @@ class PropertyProperty extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct($name, Node\Expr $default = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name;
$this->default = $default;
}

View File

@ -16,7 +16,7 @@ class Return_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -22,7 +22,7 @@ class StaticVar extends Node\Stmt
public function __construct(
Expr\Variable $var, Node\Expr $default = null, array $attributes = []
) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->var = $var;
$this->default = $default;
}

View File

@ -16,7 +16,7 @@ class Static_ extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->vars = $vars;
}

View File

@ -19,7 +19,7 @@ class Switch_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $cases, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->cases = $cases;
}

View File

@ -16,7 +16,7 @@ class Throw_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ class TraitUse extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $traits, array $adaptations = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->traits = $traits;
$this->adaptations = $adaptations;
}

View File

@ -21,7 +21,7 @@ class Alias extends Node\Stmt\TraitUseAdaptation
* @param array $attributes Additional attributes
*/
public function __construct($trait, $method, $newModifier, $newName, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->trait = $trait;
$this->method = \is_string($method) ? new Node\Identifier($method) : $method;
$this->newModifier = $newModifier;

View File

@ -18,7 +18,7 @@ class Precedence extends Node\Stmt\TraitUseAdaptation
* @param array $attributes Additional attributes
*/
public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->trait = $trait;
$this->method = \is_string($method) ? new Node\Identifier($method) : $method;
$this->insteadof = $insteadof;

View File

@ -15,7 +15,7 @@ class Trait_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->stmts = $subNodes['stmts'] ?? [];
}

View File

@ -22,7 +22,7 @@ class TryCatch extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $stmts, array $catches, Finally_ $finally = null, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->stmts = $stmts;
$this->catches = $catches;
$this->finally = $finally;

View File

@ -16,7 +16,7 @@ class Unset_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->vars = $vars;
}

View File

@ -23,7 +23,7 @@ class UseUse extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->type = $type;
$this->name = $name;
$this->alias = \is_string($alias) ? new Identifier($alias) : $alias;

View File

@ -32,7 +32,7 @@ class Use_ extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->type = $type;
$this->uses = $uses;
}

View File

@ -19,7 +19,7 @@ class While_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
parent::__construct($attributes);
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}