Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -1,11 +1,14 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node;
use PhpParser\Node\VariadicPlaceholder;
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 */
@@ -20,15 +23,24 @@ 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, $byRef = false, $unpack = false, array $attributes = array()) {
parent::__construct($attributes);
public function __construct(
Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [],
Identifier $name = null
) {
$this->attributes = $attributes;
$this->name = $name;
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames() {
return array('value', 'byRef', 'unpack');
public function getSubNodeNames() : array {
return ['name', 'value', 'byRef', 'unpack'];
}
public function getType() : string {
return 'Arg';
}
}

View File

@@ -0,0 +1,34 @@
<?php declare(strict_types=1);
namespace PhpParser\Node;
use PhpParser\Node;
use PhpParser\NodeAbstract;
class Attribute extends NodeAbstract
{
/** @var Name Attribute name */
public $name;
/** @var Arg[] Attribute arguments */
public $args;
/**
* @param Node\Name $name Attribute name
* @param Arg[] $args Attribute arguments
* @param array $attributes Additional node attributes
*/
public function __construct(Name $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['name', 'args'];
}
public function getType() : string {
return 'Attribute';
}
}

View File

@@ -0,0 +1,29 @@
<?php declare(strict_types=1);
namespace PhpParser\Node;
use PhpParser\Node;
use PhpParser\NodeAbstract;
class AttributeGroup extends NodeAbstract
{
/** @var Attribute[] Attributes */
public $attrs;
/**
* @param Attribute[] $attrs PHP attributes
* @param array $attributes Additional node attributes
*/
public function __construct(array $attrs, array $attributes = []) {
$this->attributes = $attributes;
$this->attrs = $attrs;
}
public function getSubNodeNames() : array {
return ['attrs'];
}
public function getType() : string {
return 'AttributeGroup';
}
}

View File

@@ -0,0 +1,14 @@
<?php declare(strict_types=1);
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
/**
* This is a base class for complex types, including nullable types and union types.
*
* It does not provide any shared behavior and exists only for type-checking purposes.
*/
abstract class ComplexType extends NodeAbstract
{
}

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
@@ -18,13 +18,17 @@ 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 = array()) {
parent::__construct($attributes);
public function __construct(Expr $var, Expr $dim = null, array $attributes = []) {
$this->attributes = $attributes;
$this->var = $var;
$this->dim = $dim;
}
public function getSubNodeNames() {
return array('var', 'dim');
public function getSubNodeNames() : array {
return ['var', 'dim'];
}
public function getType() : string {
return 'Expr_ArrayDimFetch';
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
@@ -12,6 +12,8 @@ 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.
@@ -21,14 +23,19 @@ 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, $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
public function __construct(Expr $value, Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) {
$this->attributes = $attributes;
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames() {
return array('key', 'value', 'byRef');
public function getSubNodeNames() : array {
return ['key', 'value', 'byRef', 'unpack'];
}
public function getType() : string {
return 'Expr_ArrayItem';
}
}

View File

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

View File

@@ -0,0 +1,79 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\FunctionLike;
class ArrowFunction extends Expr implements FunctionLike
{
/** @var bool */
public $static;
/** @var bool */
public $byRef;
/** @var Node\Param[] */
public $params = [];
/** @var null|Node\Identifier|Node\Name|Node\ComplexType */
public $returnType;
/** @var Expr */
public $expr;
/** @var Node\AttributeGroup[] */
public $attrGroups;
/**
* @param array $subNodes Array of the following optional subnodes:
* 'static' => false : Whether the closure is static
* 'byRef' => false : Whether to return by reference
* 'params' => array() : Parameters
* 'returnType' => null : Return type
* 'expr' => Expr : Expression body
* 'attrGroups' => array() : PHP attribute 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'] ?? [];
$returnType = $subNodes['returnType'] ?? null;
$this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
$this->expr = $subNodes['expr'];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr'];
}
public function returnsByRef() : bool {
return $this->byRef;
}
public function getParams() : array {
return $this->params;
}
public function getReturnType() {
return $this->returnType;
}
public function getAttrGroups() : array {
return $this->attrGroups;
}
/**
* @return Node\Stmt\Return_[]
*/
public function getStmts() : array {
return [new Node\Stmt\Return_($this->expr)];
}
public function getType() : string {
return 'Expr_ArrowFunction';
}
}

View File

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

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
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 = array()) {
parent::__construct($attributes);
public function __construct(Expr $var, Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('var', 'expr');
public function getSubNodeNames() : array {
return ['var', 'expr'];
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Coalesce extends AssignOp
{
public function getType() : string {
return 'Expr_AssignOp_Coalesce';
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
@@ -12,19 +12,29 @@ abstract class BinaryOp extends Expr
public $right;
/**
* Constructs a bitwise and node.
* Constructs a binary operator 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 = array()) {
parent::__construct($attributes);
public function __construct(Expr $left, Expr $right, array $attributes = []) {
$this->attributes = $attributes;
$this->left = $left;
$this->right = $right;
}
public function getSubNodeNames() {
return array('left', 'right');
public function getSubNodeNames() : array {
return ['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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr\BinaryOp;
@@ -6,4 +6,11 @@ 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
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
@@ -15,12 +15,16 @@ class BitwiseNot extends Expr
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_BitwiseNot';
}
}

View File

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

View File

@@ -0,0 +1,39 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\VariadicPlaceholder;
abstract class CallLike extends Expr {
/**
* Return raw arguments, which may be actual Args, or VariadicPlaceholders for first-class
* callables.
*
* @return array<Arg|VariadicPlaceholder>
*/
abstract public function getRawArgs(): array;
/**
* Returns whether this call expression is actually a first class callable.
*/
public function isFirstClassCallable(): bool {
foreach ($this->getRawArgs() as $arg) {
if ($arg instanceof VariadicPlaceholder) {
return true;
}
}
return false;
}
/**
* Assert that this is not a first-class callable and return only ordinary Args.
*
* @return Arg[]
*/
public function getArgs(): array {
assert(!$this->isFirstClassCallable());
return $this->getRawArgs();
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
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 = array()) {
parent::__construct($attributes);
public function __construct(Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
public function getSubNodeNames() : array {
return ['expr'];
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,31 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\MatchArm;
class Match_ extends Node\Expr
{
/** @var Node\Expr */
public $cond;
/** @var MatchArm[] */
public $arms;
/**
* @param MatchArm[] $arms
*/
public function __construct(Node\Expr $cond, array $arms = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->arms = $arms;
}
public function getSubNodeNames() : array {
return ['cond', 'arms'];
}
public function getType() : string {
return 'Expr_Match';
}
}

View File

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

View File

@@ -1,31 +1,41 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\VariadicPlaceholder;
class New_ extends Expr
class New_ extends CallLike
{
/** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
public $class;
/** @var Node\Arg[] Arguments */
/** @var array<Arg|VariadicPlaceholder> Arguments */
public $args;
/**
* Constructs a function call node.
*
* @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
* @param Node\Arg[] $args Arguments
* @param array<Arg|VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct($class, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
public function __construct($class, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
$this->class = $class;
$this->args = $args;
}
public function getSubNodeNames() {
return array('class', 'args');
public function getSubNodeNames() : array {
return ['class', 'args'];
}
public function getType() : string {
return 'Expr_New';
}
public function getRawArgs(): array {
return $this->args;
}
}

View File

@@ -0,0 +1,45 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
use PhpParser\Node\VariadicPlaceholder;
class NullsafeMethodCall extends CallLike
{
/** @var Expr Variable holding object */
public $var;
/** @var Identifier|Expr Method name */
public $name;
/** @var array<Arg|VariadicPlaceholder> Arguments */
public $args;
/**
* Constructs a nullsafe method call node.
*
* @param Expr $var Variable holding object
* @param string|Identifier|Expr $name Method name
* @param array<Arg|VariadicPlaceholder> $args Arguments
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
$this->attributes = $attributes;
$this->var = $var;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->args = $args;
}
public function getSubNodeNames() : array {
return ['var', 'name', 'args'];
}
public function getType() : string {
return 'Expr_NullsafeMethodCall';
}
public function getRawArgs(): array {
return $this->args;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
@@ -21,14 +21,18 @@ 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 = array()) {
parent::__construct($attributes);
public function __construct(Expr $cond, $if, Expr $else, array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->if = $if;
$this->else = $else;
}
public function getSubNodeNames() {
return array('cond', 'if', 'else');
public function getSubNodeNames() : array {
return ['cond', 'if', 'else'];
}
public function getType() : string {
return 'Expr_Ternary';
}
}

View File

@@ -0,0 +1,30 @@
<?php declare(strict_types=1);
namespace PhpParser\Node\Expr;
use PhpParser\Node;
class Throw_ extends Node\Expr
{
/** @var Node\Expr Expression */
public $expr;
/**
* Constructs a throw expression node.
*
* @param Node\Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Expr_Throw';
}
}

View File

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

View File

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

View File

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

View File

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

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