⬇️ Restore php-parser to its original version as tests are failing :/

This commit is contained in:
Pierre Goiffon
2021-03-29 16:51:10 +02:00
parent d62825c99b
commit afd9ddf46d
235 changed files with 13778 additions and 13877 deletions

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -6,8 +6,6 @@ use PhpParser\NodeAbstract;
class Arg extends NodeAbstract
{
/** @var Identifier|null Parameter name (for named parameters) */
public $name;
/** @var Expr Value to pass */
public $value;
/** @var bool Whether to pass by ref */
@@ -22,24 +20,15 @@ class Arg extends NodeAbstract
* @param bool $byRef Whether to pass by ref
* @param bool $unpack Whether to unpack the argument
* @param array $attributes Additional attributes
* @param Identifier|null $name Parameter name (for named parameters)
*/
public function __construct(
Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [],
Identifier $name = null
) {
$this->attributes = $attributes;
$this->name = $name;
public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames() : array {
return ['name', 'value', 'byRef', 'unpack'];
}
public function getType() : string {
return 'Arg';
public function getSubNodeNames() {
return array('value', 'byRef', 'unpack');
}
}

View File

@@ -1,15 +1,12 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
/**
* @property Name $namespacedName Namespaced name (for global constants, if using NameResolver)
*/
class Const_ extends NodeAbstract
{
/** @var Identifier Name */
/** @var string Name */
public $name;
/** @var Expr Value */
public $value;
@@ -17,21 +14,17 @@ class Const_ extends NodeAbstract
/**
* Constructs a const node for use in class const and const statements.
*
* @param string|Identifier $name Name
* @param Expr $value Value
* @param array $attributes Additional attributes
* @param string $name Name
* @param Expr $value Value
* @param array $attributes Additional attributes
*/
public function __construct($name, Expr $value, array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
public function __construct($name, Expr $value, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->value = $value;
}
public function getSubNodeNames() : array {
return ['name', 'value'];
}
public function getType() : string {
return 'Const';
public function getSubNodeNames() {
return array('name', 'value');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -6,4 +6,4 @@ use PhpParser\NodeAbstract;
abstract class Expr extends NodeAbstract
{
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -18,17 +18,13 @@ class ArrayDimFetch extends Expr
* @param null|Expr $dim Array index / dim
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $dim = null, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, Expr $dim = null, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->dim = $dim;
}
public function getSubNodeNames() : array {
return ['var', 'dim'];
}
public function getType() : string {
return 'Expr_ArrayDimFetch';
public function getSubNodeNames() {
return array('var', 'dim');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -12,8 +12,6 @@ class ArrayItem extends Expr
public $value;
/** @var bool Whether to assign by reference */
public $byRef;
/** @var bool Whether to unpack the argument */
public $unpack;
/**
* Constructs an array item node.
@@ -23,19 +21,14 @@ class ArrayItem extends Expr
* @param bool $byRef Whether to assign by reference
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value, Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) {
$this->attributes = $attributes;
public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames() : array {
return ['key', 'value', 'byRef', 'unpack'];
}
public function getType() : string {
return 'Expr_ArrayItem';
public function getSubNodeNames() {
return array('key', 'value', 'byRef');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -10,25 +10,21 @@ class Array_ extends Expr
const KIND_LONG = 1; // array() syntax
const KIND_SHORT = 2; // [] syntax
/** @var (ArrayItem|null)[] Items */
/** @var ArrayItem[] Items */
public $items;
/**
* Constructs an array node.
*
* @param (ArrayItem|null)[] $items Items of the array
* @param ArrayItem[] $items Items of the array
* @param array $attributes Additional attributes
*/
public function __construct(array $items = [], array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $items = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}
public function getSubNodeNames() : array {
return ['items'];
}
public function getType() : string {
return 'Expr_Array';
public function getSubNodeNames() {
return array('items');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -18,17 +18,13 @@ class Assign extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['var', 'expr'];
}
public function getType() : string {
return 'Expr_Assign';
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -18,13 +18,13 @@ abstract class AssignOp extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['var', 'expr'];
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class BitwiseAnd extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_BitwiseAnd';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class BitwiseOr extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_BitwiseOr';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class BitwiseXor extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_BitwiseXor';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Concat extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Concat';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Div extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Div';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Minus extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Minus';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Mod extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Mod';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Mul extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Mul';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Plus extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Plus';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class Pow extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Pow';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class ShiftLeft extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_ShiftLeft';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\AssignOp;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\AssignOp;
class ShiftRight extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_ShiftRight';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -18,17 +18,13 @@ class AssignRef extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['var', 'expr'];
}
public function getType() : string {
return 'Expr_AssignRef';
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -12,29 +12,19 @@ abstract class BinaryOp extends Expr
public $right;
/**
* Constructs a binary operator node.
* Constructs a bitwise and node.
*
* @param Expr $left The left hand side expression
* @param Expr $right The right hand side expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $left, Expr $right, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $left, Expr $right, array $attributes = array()) {
parent::__construct($attributes);
$this->left = $left;
$this->right = $right;
}
public function getSubNodeNames() : array {
return ['left', 'right'];
public function getSubNodeNames() {
return array('left', 'right');
}
/**
* Get the operator sigil for this binary operation.
*
* In the case there are multiple possible sigils for an operator, this method does not
* necessarily return the one used in the parsed code.
*
* @return string
*/
abstract public function getOperatorSigil() : string;
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class BitwiseAnd extends BinaryOp
{
public function getOperatorSigil() : string {
return '&';
}
public function getType() : string {
return 'Expr_BinaryOp_BitwiseAnd';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class BitwiseOr extends BinaryOp
{
public function getOperatorSigil() : string {
return '|';
}
public function getType() : string {
return 'Expr_BinaryOp_BitwiseOr';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class BitwiseXor extends BinaryOp
{
public function getOperatorSigil() : string {
return '^';
}
public function getType() : string {
return 'Expr_BinaryOp_BitwiseXor';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class BooleanAnd extends BinaryOp
{
public function getOperatorSigil() : string {
return '&&';
}
public function getType() : string {
return 'Expr_BinaryOp_BooleanAnd';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class BooleanOr extends BinaryOp
{
public function getOperatorSigil() : string {
return '||';
}
public function getType() : string {
return 'Expr_BinaryOp_BooleanOr';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Coalesce extends BinaryOp
{
public function getOperatorSigil() : string {
return '??';
}
public function getType() : string {
return 'Expr_BinaryOp_Coalesce';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Concat extends BinaryOp
{
public function getOperatorSigil() : string {
return '.';
}
public function getType() : string {
return 'Expr_BinaryOp_Concat';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Div extends BinaryOp
{
public function getOperatorSigil() : string {
return '/';
}
public function getType() : string {
return 'Expr_BinaryOp_Div';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Equal extends BinaryOp
{
public function getOperatorSigil() : string {
return '==';
}
public function getType() : string {
return 'Expr_BinaryOp_Equal';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Greater extends BinaryOp
{
public function getOperatorSigil() : string {
return '>';
}
public function getType() : string {
return 'Expr_BinaryOp_Greater';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class GreaterOrEqual extends BinaryOp
{
public function getOperatorSigil() : string {
return '>=';
}
public function getType() : string {
return 'Expr_BinaryOp_GreaterOrEqual';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Identical extends BinaryOp
{
public function getOperatorSigil() : string {
return '===';
}
public function getType() : string {
return 'Expr_BinaryOp_Identical';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class LogicalAnd extends BinaryOp
{
public function getOperatorSigil() : string {
return 'and';
}
public function getType() : string {
return 'Expr_BinaryOp_LogicalAnd';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class LogicalOr extends BinaryOp
{
public function getOperatorSigil() : string {
return 'or';
}
public function getType() : string {
return 'Expr_BinaryOp_LogicalOr';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class LogicalXor extends BinaryOp
{
public function getOperatorSigil() : string {
return 'xor';
}
public function getType() : string {
return 'Expr_BinaryOp_LogicalXor';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Minus extends BinaryOp
{
public function getOperatorSigil() : string {
return '-';
}
public function getType() : string {
return 'Expr_BinaryOp_Minus';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Mod extends BinaryOp
{
public function getOperatorSigil() : string {
return '%';
}
public function getType() : string {
return 'Expr_BinaryOp_Mod';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Mul extends BinaryOp
{
public function getOperatorSigil() : string {
return '*';
}
public function getType() : string {
return 'Expr_BinaryOp_Mul';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class NotEqual extends BinaryOp
{
public function getOperatorSigil() : string {
return '!=';
}
public function getType() : string {
return 'Expr_BinaryOp_NotEqual';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class NotIdentical extends BinaryOp
{
public function getOperatorSigil() : string {
return '!==';
}
public function getType() : string {
return 'Expr_BinaryOp_NotIdentical';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Plus extends BinaryOp
{
public function getOperatorSigil() : string {
return '+';
}
public function getType() : string {
return 'Expr_BinaryOp_Plus';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Pow extends BinaryOp
{
public function getOperatorSigil() : string {
return '**';
}
public function getType() : string {
return 'Expr_BinaryOp_Pow';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class ShiftLeft extends BinaryOp
{
public function getOperatorSigil() : string {
return '<<';
}
public function getType() : string {
return 'Expr_BinaryOp_ShiftLeft';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class ShiftRight extends BinaryOp
{
public function getOperatorSigil() : string {
return '>>';
}
public function getType() : string {
return 'Expr_BinaryOp_ShiftRight';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Smaller extends BinaryOp
{
public function getOperatorSigil() : string {
return '<';
}
public function getType() : string {
return 'Expr_BinaryOp_Smaller';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class SmallerOrEqual extends BinaryOp
{
public function getOperatorSigil() : string {
return '<=';
}
public function getType() : string {
return 'Expr_BinaryOp_SmallerOrEqual';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,11 +6,4 @@ use PhpParser\Node\Expr\BinaryOp;
class Spaceship extends BinaryOp
{
public function getOperatorSigil() : string {
return '<=>';
}
public function getType() : string {
return 'Expr_BinaryOp_Spaceship';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class BitwiseNot extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_BitwiseNot';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class BooleanNot extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_BooleanNot';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,12 +15,12 @@ abstract class Cast extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Array_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_Array';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Bool_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_Bool';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,12 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Double extends Cast
{
// For use in "kind" attribute
const KIND_DOUBLE = 1; // "double" syntax
const KIND_FLOAT = 2; // "float" syntax
const KIND_REAL = 3; // "real" syntax
public function getType() : string {
return 'Expr_Cast_Double';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Int_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_Int';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Object_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_Object';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class String_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_String';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr\Cast;
@@ -6,7 +6,4 @@ use PhpParser\Node\Expr\Cast;
class Unset_ extends Cast
{
public function getType() : string {
return 'Expr_Cast_Unset';
}
}
}

View File

@@ -1,36 +1,31 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
class ClassConstFetch extends Expr
{
/** @var Name|Expr Class name */
public $class;
/** @var Identifier|Error Constant name */
/** @var string|Error Constant name */
public $name;
/**
* Constructs a class const fetch node.
*
* @param Name|Expr $class Class name
* @param string|Identifier|Error $name Constant name
* @param array $attributes Additional attributes
* @param Name|Expr $class Class name
* @param string|Error $name Constant name
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->name = $name;
}
public function getSubNodeNames() : array {
return ['class', 'name'];
}
public function getType() : string {
return 'Expr_ClassConstFetch';
public function getSubNodeNames() {
return array('class', 'name');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Clone_ extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Clone';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -16,12 +16,10 @@ class Closure extends Expr implements FunctionLike
public $params;
/** @var ClosureUse[] use()s */
public $uses;
/** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */
/** @var null|string|Node\Name|Node\NullableType Return type */
public $returnType;
/** @var Node\Stmt[] Statements */
/** @var Node[] Statements */
public $stmts;
/** @var Node\AttributeGroup[] PHP attribute groups */
public $attrGroups;
/**
* Constructs a lambda function node.
@@ -33,30 +31,27 @@ class Closure extends Expr implements FunctionLike
* 'uses' => array(): use()s
* 'returnType' => null : Return type
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attributes groups
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->static = $subNodes['static'] ?? false;
$this->byRef = $subNodes['byRef'] ?? false;
$this->params = $subNodes['params'] ?? [];
$this->uses = $subNodes['uses'] ?? [];
$returnType = $subNodes['returnType'] ?? null;
$this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
public function __construct(array $subNodes = array(), array $attributes = array()) {
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();
$this->uses = isset($subNodes['uses']) ? $subNodes['uses'] : array();
$this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}
public function getSubNodeNames() : array {
return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts'];
public function getSubNodeNames() {
return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts');
}
public function returnsByRef() : bool {
public function returnsByRef() {
return $this->byRef;
}
public function getParams() : array {
public function getParams() {
return $this->params;
}
@@ -64,16 +59,7 @@ class Closure extends Expr implements FunctionLike
return $this->returnType;
}
/** @return Node\Stmt[] */
public function getStmts() : array {
public function getStmts() {
return $this->stmts;
}
public function getAttrGroups() : array {
return $this->attrGroups;
}
public function getType() : string {
return 'Expr_Closure';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -6,7 +6,7 @@ use PhpParser\Node\Expr;
class ClosureUse extends Expr
{
/** @var Expr\Variable Variable to use */
/** @var string Name of variable */
public $var;
/** @var bool Whether to use by reference */
public $byRef;
@@ -14,21 +14,17 @@ class ClosureUse extends Expr
/**
* Constructs a closure use node.
*
* @param Expr\Variable $var Variable to use
* @param bool $byRef Whether to use by reference
* @param array $attributes Additional attributes
* @param string $var Name of variable
* @param bool $byRef Whether to use by reference
* @param array $attributes Additional attributes
*/
public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($var, $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->byRef = $byRef;
}
public function getSubNodeNames() : array {
return ['var', 'byRef'];
}
public function getType() : string {
return 'Expr_ClosureUse';
public function getSubNodeNames() {
return array('var', 'byRef');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -16,16 +16,12 @@ class ConstFetch extends Expr
* @param Name $name Constant name
* @param array $attributes Additional attributes
*/
public function __construct(Name $name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Name $name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}
public function getSubNodeNames() : array {
return ['name'];
}
public function getType() : string {
return 'Expr_ConstFetch';
public function getSubNodeNames() {
return array('name');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Empty_ extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Empty';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -17,15 +17,11 @@ class Error extends Expr
*
* @param array $attributes Additional attributes
*/
public function __construct(array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $attributes = array()) {
parent::__construct($attributes);
}
public function getSubNodeNames() : array {
return [];
}
public function getType() : string {
return 'Expr_Error';
public function getSubNodeNames() {
return array();
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class ErrorSuppress extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_ErrorSuppress';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Eval_ extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Eval';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -19,16 +19,12 @@ class Exit_ extends Expr
* @param null|Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr = null, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr = null, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Exit';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -16,20 +16,16 @@ class FuncCall extends Expr
* Constructs a function call node.
*
* @param Node\Name|Expr $name Function name
* @param Node\Arg[] $args Arguments
* @param array $attributes Additional attributes
* @param Node\Arg[] $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct($name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
public function __construct($name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['name', 'args'];
}
public function getType() : string {
return 'Expr_FuncCall';
public function getSubNodeNames() {
return array('name', 'args');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -23,17 +23,13 @@ class Include_ extends Expr
* @param int $type Type of include
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, int $type, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, $type, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->type = $type;
}
public function getSubNodeNames() : array {
return ['expr', 'type'];
}
public function getType() : string {
return 'Expr_Include';
public function getSubNodeNames() {
return array('expr', 'type');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -19,17 +19,13 @@ class Instanceof_ extends Expr
* @param Name|Expr $class Class name
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, $class, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, $class, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->class = $class;
}
public function getSubNodeNames() : array {
return ['expr', 'class'];
}
public function getType() : string {
return 'Expr_Instanceof';
public function getSubNodeNames() {
return array('expr', 'class');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Isset_ extends Expr
* @param Expr[] $vars Variables
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}
public function getSubNodeNames() : array {
return ['vars'];
}
public function getType() : string {
return 'Expr_Isset';
public function getSubNodeNames() {
return array('vars');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -6,25 +6,21 @@ use PhpParser\Node\Expr;
class List_ extends Expr
{
/** @var (ArrayItem|null)[] List of items to assign to */
/** @var ArrayItem[] List of items to assign to */
public $items;
/**
* Constructs a list() destructuring node.
*
* @param (ArrayItem|null)[] $items List of items to assign to
* @param array $attributes Additional attributes
* @param ArrayItem[] $items List of items to assign to
* @param array $attributes Additional attributes
*/
public function __construct(array $items, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $items, array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}
public function getSubNodeNames() : array {
return ['items'];
}
public function getType() : string {
return 'Expr_List';
public function getSubNodeNames() {
return array('items');
}
}

View File

@@ -1,16 +1,15 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
class MethodCall extends Expr
{
/** @var Expr Variable holding object */
public $var;
/** @var Identifier|Expr Method name */
/** @var string|Expr Method name */
public $name;
/** @var Arg[] Arguments */
public $args;
@@ -18,23 +17,19 @@ class MethodCall extends Expr
/**
* Constructs a function call node.
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Method name
* @param Arg[] $args Arguments
* @param array $attributes Additional attributes
* @param Expr $var Variable holding object
* @param string|Expr $name Method name
* @param Arg[] $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['var', 'name', 'args'];
}
public function getType() : string {
return 'Expr_MethodCall';
public function getSubNodeNames() {
return array('var', 'name', 'args');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -19,17 +19,13 @@ class New_ extends Expr
* @param Node\Arg[] $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct($class, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
public function __construct($class, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['class', 'args'];
}
public function getType() : string {
return 'Expr_New';
public function getSubNodeNames() {
return array('class', 'args');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class PostDec extends Expr
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() : array {
return ['var'];
}
public function getType() : string {
return 'Expr_PostDec';
public function getSubNodeNames() {
return array('var');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class PostInc extends Expr
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() : array {
return ['var'];
}
public function getType() : string {
return 'Expr_PostInc';
public function getSubNodeNames() {
return array('var');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class PreDec extends Expr
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() : array {
return ['var'];
}
public function getType() : string {
return 'Expr_PreDec';
public function getSubNodeNames() {
return array('var');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class PreInc extends Expr
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() : array {
return ['var'];
}
public function getType() : string {
return 'Expr_PreInc';
public function getSubNodeNames() {
return array('var');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Print_ extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Print';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,35 +1,30 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
class PropertyFetch extends Expr
{
/** @var Expr Variable holding object */
public $var;
/** @var Identifier|Expr Property name */
/** @var string|Expr Property name */
public $name;
/**
* Constructs a function call node.
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Property name
* @param array $attributes Additional attributes
* @param Expr $var Variable holding object
* @param string|Expr $name Property name
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $var, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->name = $name;
}
public function getSubNodeNames() : array {
return ['var', 'name'];
}
public function getType() : string {
return 'Expr_PropertyFetch';
public function getSubNodeNames() {
return array('var', 'name');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class ShellExec extends Expr
* @param array $parts Encapsed string array
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}
public function getSubNodeNames() : array {
return ['parts'];
}
public function getType() : string {
return 'Expr_ShellExec';
public function getSubNodeNames() {
return array('parts');
}
}

View File

@@ -1,16 +1,15 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
class StaticCall extends Expr
{
/** @var Node\Name|Expr Class name */
public $class;
/** @var Identifier|Expr Method name */
/** @var string|Expr Method name */
public $name;
/** @var Node\Arg[] Arguments */
public $args;
@@ -18,23 +17,19 @@ class StaticCall extends Expr
/**
* Constructs a static method call node.
*
* @param Node\Name|Expr $class Class name
* @param string|Identifier|Expr $name Method name
* @param Node\Arg[] $args Arguments
* @param array $attributes Additional attributes
* @param Node\Name|Expr $class Class name
* @param string|Expr $name Method name
* @param Node\Arg[] $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
public function __construct($class, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['class', 'name', 'args'];
}
public function getType() : string {
return 'Expr_StaticCall';
public function getSubNodeNames() {
return array('class', 'name', 'args');
}
}

View File

@@ -1,36 +1,31 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\VarLikeIdentifier;
class StaticPropertyFetch extends Expr
{
/** @var Name|Expr Class name */
public $class;
/** @var VarLikeIdentifier|Expr Property name */
/** @var string|Expr Property name */
public $name;
/**
* Constructs a static property fetch node.
*
* @param Name|Expr $class Class name
* @param string|VarLikeIdentifier|Expr $name Property name
* @param array $attributes Additional attributes
* @param Name|Expr $class Class name
* @param string|Expr $name Property name
* @param array $attributes Additional attributes
*/
public function __construct($class, $name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name;
$this->name = $name;
}
public function getSubNodeNames() : array {
return ['class', 'name'];
}
public function getType() : string {
return 'Expr_StaticPropertyFetch';
public function getSubNodeNames() {
return array('class', 'name');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -21,18 +21,14 @@ class Ternary extends Expr
* @param Expr $else Expression for false
* @param array $attributes Additional attributes
*/
public function __construct(Expr $cond, $if, Expr $else, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $cond, $if, Expr $else, array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->if = $if;
$this->else = $else;
}
public function getSubNodeNames() : array {
return ['cond', 'if', 'else'];
}
public function getType() : string {
return 'Expr_Ternary';
public function getSubNodeNames() {
return array('cond', 'if', 'else');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class UnaryMinus extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_UnaryMinus';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class UnaryPlus extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_UnaryPlus';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class Variable extends Expr
* @param string|Expr $name Name
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}
public function getSubNodeNames() : array {
return ['name'];
}
public function getType() : string {
return 'Expr_Variable';
public function getSubNodeNames() {
return array('name');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -15,16 +15,12 @@ class YieldFrom extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_YieldFrom';
public function getSubNodeNames() {
return array('expr');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Expr;
@@ -18,17 +18,13 @@ class Yield_ extends Expr
* @param null|Expr $key Key expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $value = null, Expr $key = null, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(Expr $value = null, Expr $key = null, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
}
public function getSubNodeNames() : array {
return ['key', 'value'];
}
public function getType() : string {
return 'Expr_Yield';
public function getSubNodeNames() {
return array('key', 'value');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -11,33 +11,26 @@ interface FunctionLike extends Node
*
* @return bool
*/
public function returnsByRef() : bool;
public function returnsByRef();
/**
* List of parameters
*
* @return Param[]
* @return Node\Param[]
*/
public function getParams() : array;
public function getParams();
/**
* Get the declared return type or null
*
* @return null|Identifier|Name|NullableType|UnionType
*
* @return null|string|Node\Name|Node\NullableType
*/
public function getReturnType();
/**
* The function body
*
* @return Stmt[]|null
* @return Node\Stmt[]
*/
public function getStmts();
/**
* Get PHP attribute groups.
*
* @return AttributeGroup[]
*/
public function getAttrGroups() : array;
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -6,28 +6,24 @@ use PhpParser\NodeAbstract;
class Name extends NodeAbstract
{
/** @var string[] Parts of the name */
/**
* @var string[] Parts of the name
*/
public $parts;
private static $specialClassNames = [
'self' => true,
'parent' => true,
'static' => true,
];
/**
* Constructs a name node.
*
* @param string|string[]|self $name Name as string, part array or Name instance (copy ctor)
* @param array $attributes Additional attributes
* @param string|array|self $name Name as string, part array or Name instance (copy ctor)
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = self::prepareName($name);
}
public function getSubNodeNames() : array {
return ['parts'];
public function getSubNodeNames() {
return array('parts');
}
/**
@@ -35,7 +31,7 @@ class Name extends NodeAbstract
*
* @return string First part of the name
*/
public function getFirst() : string {
public function getFirst() {
return $this->parts[0];
}
@@ -44,7 +40,7 @@ class Name extends NodeAbstract
*
* @return string Last part of the name
*/
public function getLast() : string {
public function getLast() {
return $this->parts[count($this->parts) - 1];
}
@@ -53,8 +49,8 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() : bool {
return 1 === count($this->parts);
public function isUnqualified() {
return 1 == count($this->parts);
}
/**
@@ -62,7 +58,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is qualified
*/
public function isQualified() : bool {
public function isQualified() {
return 1 < count($this->parts);
}
@@ -71,7 +67,7 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() : bool {
public function isFullyQualified() {
return false;
}
@@ -80,57 +76,27 @@ class Name extends NodeAbstract
*
* @return bool Whether the name is relative
*/
public function isRelative() : bool {
public function isRelative() {
return false;
}
/**
* Returns a string representation of the name itself, without taking the name type into
* account (e.g., not including a leading backslash for fully qualified names).
*
* @return string String representation
*/
public function toString() : string {
return implode('\\', $this->parts);
}
/**
* Returns a string representation of the name as it would occur in code (e.g., including
* leading backslash for fully qualified names.
*
* @return string String representation
*/
public function toCodeString() : string {
return $this->toString();
}
/**
* Returns lowercased string representation of the name, without taking the name type into
* account (e.g., no leading backslash for fully qualified names).
*
* @return string Lowercased string representation
*/
public function toLowerString() : string {
return strtolower(implode('\\', $this->parts));
}
/**
* Checks whether the identifier is a special class name (self, parent or static).
*
* @return bool Whether identifier is a special class name
*/
public function isSpecialClassName() : bool {
return count($this->parts) === 1
&& isset(self::$specialClassNames[strtolower($this->parts[0])]);
}
/**
* Returns a string representation of the name by imploding the namespace parts with the
* namespace separator.
*
* @return string String representation
*/
public function __toString() : string {
public function toString() {
return implode('\\', $this->parts);
}
/**
* Returns a string representation of the name by imploding the namespace parts with the
* namespace separator.
*
* @return string String representation
*/
public function __toString() {
return implode('\\', $this->parts);
}
@@ -150,7 +116,7 @@ class Name extends NodeAbstract
*
* @return static|null Sliced name
*/
public function slice(int $offset, int $length = null) {
public function slice($offset, $length = null) {
$numParts = count($this->parts);
$realOffset = $offset < 0 ? $offset + $numParts : $offset;
@@ -186,9 +152,9 @@ class Name extends NodeAbstract
* Name::concat($namespace, $shortName)
* where $namespace is a Name node or null will work as expected.
*
* @param string|string[]|self|null $name1 The first name
* @param string|string[]|self|null $name2 The second name
* @param array $attributes Attributes to assign to concatenated name
* @param string|array|self|null $name1 The first name
* @param string|array|self|null $name2 The second name
* @param array $attributes Attributes to assign to concatenated name
*
* @return static|null Concatenated name
*/
@@ -197,7 +163,7 @@ class Name extends NodeAbstract
return null;
} elseif (null === $name1) {
return new static(self::prepareName($name2), $attributes);
} elseif (null === $name2) {
} else if (null === $name2) {
return new static(self::prepareName($name1), $attributes);
} else {
return new static(
@@ -210,22 +176,14 @@ class Name extends NodeAbstract
* Prepares a (string, array or Name node) name for use in name changing methods by converting
* it to an array.
*
* @param string|string[]|self $name Name to prepare
* @param string|array|self $name Name to prepare
*
* @return string[] Prepared name
* @return array Prepared name
*/
private static function prepareName($name) : array {
private static function prepareName($name) {
if (\is_string($name)) {
if ('' === $name) {
throw new \InvalidArgumentException('Name cannot be empty');
}
return explode('\\', $name);
} elseif (\is_array($name)) {
if (empty($name)) {
throw new \InvalidArgumentException('Name cannot be empty');
}
return $name;
} elseif ($name instanceof self) {
return $name->parts;
@@ -235,8 +193,4 @@ class Name extends NodeAbstract
'Expected string, array of parts or Name instance'
);
}
public function getType() : string {
return 'Name';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Name;
@@ -9,7 +9,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() : bool {
public function isUnqualified() {
return false;
}
@@ -18,7 +18,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is qualified
*/
public function isQualified() : bool {
public function isQualified() {
return false;
}
@@ -27,7 +27,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() : bool {
public function isFullyQualified() {
return true;
}
@@ -36,15 +36,7 @@ class FullyQualified extends \PhpParser\Node\Name
*
* @return bool Whether the name is relative
*/
public function isRelative() : bool {
public function isRelative() {
return false;
}
public function toCodeString() : string {
return '\\' . $this->toString();
}
public function getType() : string {
return 'Name_FullyQualified';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Name;
@@ -9,7 +9,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() : bool {
public function isUnqualified() {
return false;
}
@@ -18,7 +18,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is qualified
*/
public function isQualified() : bool {
public function isQualified() {
return false;
}
@@ -27,7 +27,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() : bool {
public function isFullyQualified() {
return false;
}
@@ -36,15 +36,7 @@ class Relative extends \PhpParser\Node\Name
*
* @return bool Whether the name is relative
*/
public function isRelative() : bool {
public function isRelative() {
return true;
}
public function toCodeString() : string {
return 'namespace\\' . $this->toString();
}
public function getType() : string {
return 'Name_Relative';
}
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -6,25 +6,21 @@ use PhpParser\NodeAbstract;
class NullableType extends NodeAbstract
{
/** @var Identifier|Name Type */
/** @var string|Name Type */
public $type;
/**
* Constructs a nullable type (wrapping another type).
*
* @param string|Identifier|Name $type Type
* @param array $attributes Additional attributes
* @param string|Name $type Type
* @param array $attributes Additional attributes
*/
public function __construct($type, array $attributes = []) {
$this->attributes = $attributes;
$this->type = \is_string($type) ? new Identifier($type) : $type;
public function __construct($type, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
}
public function getSubNodeNames() : array {
return ['type'];
}
public function getType() : string {
return 'NullableType';
public function getSubNodeNames() {
return array('type');
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
@@ -6,55 +6,37 @@ use PhpParser\NodeAbstract;
class Param extends NodeAbstract
{
/** @var null|Identifier|Name|NullableType|UnionType Type declaration */
/** @var null|string|Name|NullableType Typehint */
public $type;
/** @var bool Whether parameter is passed by reference */
public $byRef;
/** @var bool Whether this is a variadic argument */
public $variadic;
/** @var Expr\Variable|Expr\Error Parameter variable */
public $var;
/** @var string Name */
public $name;
/** @var null|Expr Default value */
public $default;
/** @var int */
public $flags;
/** @var AttributeGroup[] PHP attribute groups */
public $attrGroups;
/**
* Constructs a parameter node.
*
* @param Expr\Variable|Expr\Error $var Parameter variable
* @param null|Expr $default Default value
* @param null|string|Identifier|Name|NullableType|UnionType $type Type declaration
* @param bool $byRef Whether is passed by reference
* @param bool $variadic Whether this is a variadic argument
* @param array $attributes Additional attributes
* @param int $flags Optional visibility flags
* @param AttributeGroup[] $attrGroups PHP attribute groups
* @param string $name Name
* @param null|Expr $default Default value
* @param null|string|Name|NullableType $type Typehint
* @param bool $byRef Whether is passed by reference
* @param bool $variadic Whether this is a variadic argument
* @param array $attributes Additional attributes
*/
public function __construct(
$var, Expr $default = null, $type = null,
bool $byRef = false, bool $variadic = false,
array $attributes = [],
int $flags = 0,
array $attrGroups = []
) {
$this->attributes = $attributes;
$this->type = \is_string($type) ? new Identifier($type) : $type;
public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->byRef = $byRef;
$this->variadic = $variadic;
$this->var = $var;
$this->name = $name;
$this->default = $default;
$this->flags = $flags;
$this->attrGroups = $attrGroups;
}
public function getSubNodeNames() : array {
return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default'];
}
public function getType() : string {
return 'Param';
public function getSubNodeNames() {
return array('type', 'byRef', 'variadic', 'name', 'default');
}
}

View File

@@ -1,7 +1,7 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node;
abstract class Scalar extends Expr
{
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Scalar;
@@ -15,13 +15,13 @@ class DNumber extends Scalar
* @param float $value Value of the number
* @param array $attributes Additional attributes
*/
public function __construct(float $value, array $attributes = []) {
$this->attributes = $attributes;
public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() : array {
return ['value'];
public function getSubNodeNames() {
return array('value');
}
/**
@@ -33,9 +33,7 @@ class DNumber extends Scalar
*
* @return float The parsed number
*/
public static function parse(string $str) : float {
$str = str_replace('_', '', $str);
public static function parse($str) {
// if string contains any of .eE just cast it to float
if (false !== strpbrk($str, '.eE')) {
return (float) $str;
@@ -63,8 +61,4 @@ class DNumber extends Scalar
// dec
return (float) $str;
}
public function getType() : string {
return 'Scalar_DNumber';
}
}

View File

@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
namespace PhpParser\Node\Scalar;
@@ -13,19 +13,15 @@ class Encapsed extends Scalar
/**
* Constructs an encapsed string node.
*
* @param Expr[] $parts Encaps list
* @param array $attributes Additional attributes
* @param array $parts Encaps list
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = []) {
$this->attributes = $attributes;
public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}
public function getSubNodeNames() : array {
return ['parts'];
}
public function getType() : string {
return 'Scalar_Encapsed';
public function getSubNodeNames() {
return array('parts');
}
}

Some files were not shown because too many files have changed in this diff Show More