Skip to content

Commit 993f299

Browse files
committed
Avoid parent constructor call during node construction
Instead explicitly assign the attributes. This is a minor performance improvement.
1 parent 9d44edf commit 993f299

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+99
-99
lines changed

lib/PhpParser/Node/Arg.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Arg extends NodeAbstract
2222
* @param array $attributes Additional attributes
2323
*/
2424
public function __construct(Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = []) {
25-
parent::__construct($attributes);
25+
$this->attributes = $attributes;
2626
$this->value = $value;
2727
$this->byRef = $byRef;
2828
$this->unpack = $unpack;

lib/PhpParser/Node/Const_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Const_ extends NodeAbstract
2222
* @param array $attributes Additional attributes
2323
*/
2424
public function __construct($name, Expr $value, array $attributes = []) {
25-
parent::__construct($attributes);
25+
$this->attributes = $attributes;
2626
$this->name = \is_string($name) ? new Identifier($name) : $name;
2727
$this->value = $value;
2828
}

lib/PhpParser/Node/Expr/ArrayDimFetch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ArrayDimFetch extends Expr
1919
* @param array $attributes Additional attributes
2020
*/
2121
public function __construct(Expr $var, Expr $dim = null, array $attributes = []) {
22-
parent::__construct($attributes);
22+
$this->attributes = $attributes;
2323
$this->var = $var;
2424
$this->dim = $dim;
2525
}

lib/PhpParser/Node/Expr/ArrayItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ArrayItem extends Expr
2424
* @param array $attributes Additional attributes
2525
*/
2626
public function __construct(Expr $value, Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) {
27-
parent::__construct($attributes);
27+
$this->attributes = $attributes;
2828
$this->key = $key;
2929
$this->value = $value;
3030
$this->byRef = $byRef;

lib/PhpParser/Node/Expr/Array_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Array_ extends Expr
2020
* @param array $attributes Additional attributes
2121
*/
2222
public function __construct(array $items = [], array $attributes = []) {
23-
parent::__construct($attributes);
23+
$this->attributes = $attributes;
2424
$this->items = $items;
2525
}
2626

lib/PhpParser/Node/Expr/ArrowFunction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ArrowFunction extends Expr implements FunctionLike
3333
* @param array $attributes Additional attributes
3434
*/
3535
public function __construct(array $subNodes = [], array $attributes = []) {
36-
parent::__construct($attributes);
36+
$this->attributes = $attributes;
3737
$this->static = $subNodes['static'] ?? false;
3838
$this->byRef = $subNodes['byRef'] ?? false;
3939
$this->params = $subNodes['params'] ?? [];

lib/PhpParser/Node/Expr/Assign.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Assign extends Expr
1919
* @param array $attributes Additional attributes
2020
*/
2121
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
22-
parent::__construct($attributes);
22+
$this->attributes = $attributes;
2323
$this->var = $var;
2424
$this->expr = $expr;
2525
}

lib/PhpParser/Node/Expr/AssignOp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class AssignOp extends Expr
1919
* @param array $attributes Additional attributes
2020
*/
2121
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
22-
parent::__construct($attributes);
22+
$this->attributes = $attributes;
2323
$this->var = $var;
2424
$this->expr = $expr;
2525
}

lib/PhpParser/Node/Expr/AssignRef.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AssignRef extends Expr
1919
* @param array $attributes Additional attributes
2020
*/
2121
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
22-
parent::__construct($attributes);
22+
$this->attributes = $attributes;
2323
$this->var = $var;
2424
$this->expr = $expr;
2525
}

lib/PhpParser/Node/Expr/BinaryOp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class BinaryOp extends Expr
1919
* @param array $attributes Additional attributes
2020
*/
2121
public function __construct(Expr $left, Expr $right, array $attributes = []) {
22-
parent::__construct($attributes);
22+
$this->attributes = $attributes;
2323
$this->left = $left;
2424
$this->right = $right;
2525
}

0 commit comments

Comments
 (0)