Skip to content

Commit

Permalink
Avoid parent constructor call during node construction
Browse files Browse the repository at this point in the history
Instead explicitly assign the attributes. This is a minor
performance improvement.
  • Loading branch information
nikic committed May 12, 2019
1 parent 9d44edf commit 993f299
Show file tree
Hide file tree
Showing 99 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Arg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Const_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ArrayDimFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ArrayItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Array_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ArrowFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/AssignOp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/AssignRef.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BinaryOp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BitwiseNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/BooleanNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ClassConstFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Clone_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ClosureUse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ConstFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Empty_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ErrorSuppress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Eval_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Exit_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/FuncCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Include_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Instanceof_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Isset_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/List_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/MethodCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/New_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PostDec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PostInc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PreDec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PreInc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Print_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/PropertyFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/ShellExec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/StaticCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/StaticPropertyFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Ternary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/UnaryMinus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/UnaryPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PhpParser/Node/Expr/YieldFrom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading

0 comments on commit 993f299

Please sign in to comment.