Drop support for old Node format

This commit is contained in:
Nikita Popov 2015-05-02 22:17:34 +02:00
parent e6619f5514
commit 29b9015f51
93 changed files with 97 additions and 135 deletions

View File

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

View File

@ -19,7 +19,7 @@ class Const_ extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct($name, Expr $value, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->var = $var;
$this->dim = $dim;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ class AssignRef extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ class ClosureUse extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($var, $byRef = false, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class ErrorSuppress extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

@ -16,7 +16,7 @@ class Exit_ extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr = null, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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, $type, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->vars = $vars;
}

View File

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

View File

@ -23,7 +23,7 @@ class MethodCall extends Expr
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->var = $var;
$this->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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

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

View File

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

View File

@ -23,7 +23,7 @@ class StaticCall extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $args = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
$this->args = $args;

View File

@ -20,7 +20,7 @@ class StaticPropertyFetch extends Expr
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->class = $class;
$this->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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
}

View File

@ -20,7 +20,7 @@ class Name extends NodeAbstract
$parts = explode('\\', $parts);
}
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->parts = $parts;
}

View File

@ -29,7 +29,7 @@ class Param extends NodeAbstract
* @param array $attributes Additional attributes
*/
public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->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($value = 0.0, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->value = $value;
}

View File

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

View File

@ -16,7 +16,7 @@ class LNumber extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct($value = 0, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
}
public function getSubNodeNames() {

View File

@ -27,7 +27,7 @@ class String_ extends Scalar
* @param array $attributes Additional attributes
*/
public function __construct($value = '', array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

View File

@ -22,7 +22,7 @@ class Catch_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(Node\Name $type, $var, array $stmts = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->type = $type;
$this->var = $var;
$this->stmts = $stmts;

View File

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

View File

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

View File

@ -41,7 +41,7 @@ class Class_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->type = isset($subNodes['type']) ? $subNodes['type'] : 0;
$this->name = $name;
$this->extends = isset($subNodes['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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
}

View File

@ -18,7 +18,7 @@ class Declare_ extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $declares, array $stmts, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->init = isset($subNodes['init']) ? $subNodes['init'] : array();
$this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array();
$this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array();

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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
$this->keyVar = isset($subNodes['keyVar']) ? $subNodes['keyVar'] : null;
$this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ class HaltCompiler extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct($remaining, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
$this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array();

View File

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

View File

@ -26,7 +26,7 @@ class Interface_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->name = $name;
$this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array();
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();

View File

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

View File

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

View File

@ -28,7 +28,7 @@ class Property extends Node\Stmt
throw new Error('Properties cannot be declared final');
}
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->type = $type;
$this->props = $props;
}

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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

@ -19,7 +19,7 @@ class StaticVar extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct($name, Node\Expr $default = null, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->name = $name;
$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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->expr = $expr;
}

View File

@ -20,7 +20,7 @@ class TraitUse extends Node\Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $traits, array $adaptations = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->trait = $trait;
$this->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 = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->trait = $trait;
$this->method = $method;
$this->insteadof = $insteadof;

View File

@ -14,7 +14,7 @@ class Trait_ extends ClassLike
* @param array $attributes Additional attributes
*/
public function __construct($name, array $stmts = array(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->name = $name;
$this->stmts = $stmts;
}

View File

@ -27,7 +27,7 @@ class TryCatch extends Node\Stmt
throw new Error('Cannot use try without catch or finally');
}
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->stmts = $stmts;
$this->catches = $catches;
$this->finallyStmts = $finallyStmts;

View File

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

View File

@ -31,7 +31,7 @@ class UseUse extends Node\Stmt
));
}
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->name = $name;
$this->alias = $alias;
}

View File

@ -23,7 +23,7 @@ class Use_ extends Stmt
* @param array $attributes Additional attributes
*/
public function __construct(array $uses, $type = self::TYPE_NORMAL, array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($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(), array $attributes = array()) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

View File

@ -4,30 +4,15 @@ namespace PhpParser;
abstract class NodeAbstract implements Node
{
private $subNodeNames;
protected $attributes;
/**
* Creates a Node.
*
* If null is passed for the $subNodes parameter the node constructor must assign
* all subnodes by itself and also override the getSubNodeNames() method.
* DEPRECATED: If an array is passed as $subNodes instead, the properties corresponding
* to the array keys will be set and getSubNodeNames() will return the keys of that
* array.
*
* @param null|array $subNodes Null or an array of sub nodes (deprecated)
* @param array $attributes Array of attributes
* @param array $attributes Array of attributes
*/
public function __construct($subNodes = array(), array $attributes = array()) {
public function __construct(array $attributes = array()) {
$this->attributes = $attributes;
if (null !== $subNodes) {
foreach ($subNodes as $name => $value) {
$this->$name = $value;
}
$this->subNodeNames = array_keys($subNodes);
}
}
/**
@ -39,15 +24,6 @@ abstract class NodeAbstract implements Node
return strtr(substr(rtrim(get_class($this), '_'), 15), '\\', '_');
}
/**
* Gets the names of the sub nodes.
*
* @return array Names of sub nodes
*/
public function getSubNodeNames() {
return $this->subNodeNames;
}
/**
* Gets line the node started in.
*

View File

@ -7,7 +7,7 @@ class DummyNode extends NodeAbstract {
public $subNode2;
public function __construct($subNode1, $subNode2, $attributes) {
parent::__construct(null, $attributes);
parent::__construct($attributes);
$this->subNode1 = $subNode1;
$this->subNode2 = $subNode2;
}
@ -33,25 +33,11 @@ class NodeAbstractTest extends \PHPUnit_Framework_TestCase
),
);
$node1 = $this->getMockForAbstractClass(
'PhpParser\NodeAbstract',
array(
array(
'subNode1' => 'value1',
'subNode2' => 'value2',
),
$attributes
),
'PhpParser_Node_Dummy'
);
$node1->notSubNode = 'value3';
$node2 = new DummyNode('value1', 'value2', $attributes);
$node2->notSubNode = 'value3';
$node = new DummyNode('value1', 'value2', $attributes);
$node->notSubNode = 'value3';
return array(
array($attributes, $node1),
array($attributes, $node2),
array($attributes, $node),
);
}