First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,34 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class Arg extends NodeAbstract
{
/** @var Expr Value to pass */
public $value;
/** @var bool Whether to pass by ref */
public $byRef;
/** @var bool Whether to unpack the argument */
public $unpack;
/**
* Constructs a function call argument node.
*
* @param Expr $value Value to pass
* @param bool $byRef Whether to pass by ref
* @param bool $unpack Whether to unpack the argument
* @param array $attributes Additional attributes
*/
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() {
return array('value', 'byRef', 'unpack');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class Const_ extends NodeAbstract
{
/** @var string Name */
public $name;
/** @var Expr Value */
public $value;
/**
* 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
*/
public function __construct($name, Expr $value, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->value = $value;
}
public function getSubNodeNames() {
return array('name', 'value');
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
abstract class Expr extends NodeAbstract
{
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class ArrayDimFetch extends Expr
{
/** @var Expr Variable */
public $var;
/** @var null|Expr Array index / dim */
public $dim;
/**
* Constructs an array index fetch node.
*
* @param Expr $var Variable
* @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);
$this->var = $var;
$this->dim = $dim;
}
public function getSubNodeNames() {
return array('var', 'dim');
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class ArrayItem extends Expr
{
/** @var null|Expr Key */
public $key;
/** @var Expr Value */
public $value;
/** @var bool Whether to assign by reference */
public $byRef;
/**
* Constructs an array item node.
*
* @param Expr $value Value
* @param null|Expr $key Key
* @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);
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;
}
public function getSubNodeNames() {
return array('key', 'value', 'byRef');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Array_ extends Expr
{
// For use in "kind" attribute
const KIND_LONG = 1; // array() syntax
const KIND_SHORT = 2; // [] syntax
/** @var ArrayItem[] Items */
public $items;
/**
* Constructs an array node.
*
* @param ArrayItem[] $items Items of the array
* @param array $attributes Additional attributes
*/
public function __construct(array $items = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}
public function getSubNodeNames() {
return array('items');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Assign extends Expr
{
/** @var Expr Variable */
public $var;
/** @var Expr Expression */
public $expr;
/**
* Constructs an assignment node.
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
abstract class AssignOp extends Expr
{
/** @var Expr Variable */
public $var;
/** @var Expr Expression */
public $expr;
/**
* Constructs a compound assignment operation node.
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class BitwiseAnd extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class BitwiseOr extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class BitwiseXor extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Concat extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Div extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Minus extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Mod extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Mul extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Plus extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class Pow extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class ShiftLeft extends AssignOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\AssignOp;
class ShiftRight extends AssignOp
{
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class AssignRef extends Expr
{
/** @var Expr Variable reference is assigned to */
public $var;
/** @var Expr Variable which is referenced */
public $expr;
/**
* Constructs an assignment node.
*
* @param Expr $var Variable
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('var', 'expr');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
abstract class BinaryOp extends Expr
{
/** @var Expr The left hand side expression */
public $left;
/** @var Expr The right hand side expression */
public $right;
/**
* 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 = array()) {
parent::__construct($attributes);
$this->left = $left;
$this->right = $right;
}
public function getSubNodeNames() {
return array('left', 'right');
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class BitwiseAnd extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class BitwiseOr extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class BitwiseXor extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class BooleanAnd extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class BooleanOr extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Coalesce extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Concat extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Div extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Equal extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Greater extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class GreaterOrEqual extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Identical extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class LogicalAnd extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class LogicalOr extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class LogicalXor extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Minus extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Mod extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Mul extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class NotEqual extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class NotIdentical extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Plus extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Pow extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class ShiftLeft extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class ShiftRight extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Smaller extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class SmallerOrEqual extends BinaryOp
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp;
class Spaceship extends BinaryOp
{
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class BitwiseNot extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a bitwise not node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class BooleanNot extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a boolean not node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
abstract class Cast extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a cast node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Array_ extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Bool_ extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Double extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Int_ extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Object_ extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class String_ extends Cast
{
}

View file

@ -0,0 +1,9 @@
<?php
namespace PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\Cast;
class Unset_ extends Cast
{
}

View file

@ -0,0 +1,31 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
class ClassConstFetch extends Expr
{
/** @var Name|Expr Class name */
public $class;
/** @var string|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
*/
public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
}
public function getSubNodeNames() {
return array('class', 'name');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Clone_ extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a clone node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,65 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\FunctionLike;
class Closure extends Expr implements FunctionLike
{
/** @var bool Whether the closure is static */
public $static;
/** @var bool Whether to return by reference */
public $byRef;
/** @var Node\Param[] Parameters */
public $params;
/** @var ClosureUse[] use()s */
public $uses;
/** @var null|string|Node\Name|Node\NullableType Return type */
public $returnType;
/** @var Node[] Statements */
public $stmts;
/**
* Constructs a lambda function node.
*
* @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
* 'uses' => array(): use()s
* 'returnType' => null : Return type
* 'stmts' => array(): Statements
* @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 getSubNodeNames() {
return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts');
}
public function returnsByRef() {
return $this->byRef;
}
public function getParams() {
return $this->params;
}
public function getReturnType() {
return $this->returnType;
}
public function getStmts() {
return $this->stmts;
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class ClosureUse extends Expr
{
/** @var string Name of variable */
public $var;
/** @var bool Whether to use by reference */
public $byRef;
/**
* Constructs a closure use node.
*
* @param string $var Name of variable
* @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);
$this->var = $var;
$this->byRef = $byRef;
}
public function getSubNodeNames() {
return array('var', 'byRef');
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
class ConstFetch extends Expr
{
/** @var Name Constant name */
public $name;
/**
* Constructs a const fetch node.
*
* @param Name $name Constant name
* @param array $attributes Additional attributes
*/
public function __construct(Name $name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}
public function getSubNodeNames() {
return array('name');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Empty_ extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs an empty() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
/**
* Error node used during parsing with error recovery.
*
* An error node may be placed at a position where an expression is required, but an error occurred.
* Error nodes will not be present if the parser is run in throwOnError mode (the default).
*/
class Error extends Expr
{
/**
* Constructs an error node.
*
* @param array $attributes Additional attributes
*/
public function __construct(array $attributes = array()) {
parent::__construct($attributes);
}
public function getSubNodeNames() {
return array();
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class ErrorSuppress extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs an error suppress node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Eval_ extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs an eval() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Exit_ extends Expr
{
/* For use in "kind" attribute */
const KIND_EXIT = 1;
const KIND_DIE = 2;
/** @var null|Expr Expression */
public $expr;
/**
* Constructs an exit() node.
*
* @param null|Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr = null, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
class FuncCall extends Expr
{
/** @var Node\Name|Expr Function name */
public $name;
/** @var Node\Arg[] 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
*/
public function __construct($name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() {
return array('name', 'args');
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Include_ extends Expr
{
const TYPE_INCLUDE = 1;
const TYPE_INCLUDE_ONCE = 2;
const TYPE_REQUIRE = 3;
const TYPE_REQUIRE_ONCE = 4;
/** @var Expr Expression */
public $expr;
/** @var int Type of include */
public $type;
/**
* Constructs an include node.
*
* @param Expr $expr Expression
* @param int $type Type of include
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, $type, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->type = $type;
}
public function getSubNodeNames() {
return array('expr', 'type');
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
class Instanceof_ extends Expr
{
/** @var Expr Expression */
public $expr;
/** @var Name|Expr Class name */
public $class;
/**
* Constructs an instanceof check node.
*
* @param Expr $expr Expression
* @param Name|Expr $class Class name
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, $class, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->class = $class;
}
public function getSubNodeNames() {
return array('expr', 'class');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Isset_ extends Expr
{
/** @var Expr[] Variables */
public $vars;
/**
* Constructs an array node.
*
* @param Expr[] $vars Variables
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}
public function getSubNodeNames() {
return array('vars');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class List_ extends Expr
{
/** @var ArrayItem[] 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
*/
public function __construct(array $items, array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}
public function getSubNodeNames() {
return array('items');
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
class MethodCall extends Expr
{
/** @var Expr Variable holding object */
public $var;
/** @var string|Expr Method name */
public $name;
/** @var Arg[] 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
*/
public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() {
return array('var', 'name', 'args');
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
class New_ extends Expr
{
/** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
public $class;
/** @var Node\Arg[] 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 $attributes Additional attributes
*/
public function __construct($class, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->args = $args;
}
public function getSubNodeNames() {
return array('class', 'args');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class PostDec extends Expr
{
/** @var Expr Variable */
public $var;
/**
* Constructs a post decrement node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() {
return array('var');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class PostInc extends Expr
{
/** @var Expr Variable */
public $var;
/**
* Constructs a post increment node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() {
return array('var');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class PreDec extends Expr
{
/** @var Expr Variable */
public $var;
/**
* Constructs a pre decrement node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() {
return array('var');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class PreInc extends Expr
{
/** @var Expr Variable */
public $var;
/**
* Constructs a pre increment node.
*
* @param Expr $var Variable
* @param array $attributes Additional attributes
*/
public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}
public function getSubNodeNames() {
return array('var');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Print_ extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs an print() node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class PropertyFetch extends Expr
{
/** @var Expr Variable holding object */
public $var;
/** @var string|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
*/
public function __construct(Expr $var, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = $name;
}
public function getSubNodeNames() {
return array('var', 'name');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class ShellExec extends Expr
{
/** @var array Encapsed string array */
public $parts;
/**
* Constructs a shell exec (backtick) node.
*
* @param array $parts Encapsed string array
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}
public function getSubNodeNames() {
return array('parts');
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr;
class StaticCall extends Expr
{
/** @var Node\Name|Expr Class name */
public $class;
/** @var string|Expr Method name */
public $name;
/** @var Node\Arg[] 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
*/
public function __construct($class, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
$this->args = $args;
}
public function getSubNodeNames() {
return array('class', 'name', 'args');
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
class StaticPropertyFetch extends Expr
{
/** @var Name|Expr Class name */
public $class;
/** @var string|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
*/
public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
}
public function getSubNodeNames() {
return array('class', 'name');
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Ternary extends Expr
{
/** @var Expr Condition */
public $cond;
/** @var null|Expr Expression for true */
public $if;
/** @var Expr Expression for false */
public $else;
/**
* Constructs a ternary operator node.
*
* @param Expr $cond Condition
* @param null|Expr $if Expression for true
* @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);
$this->cond = $cond;
$this->if = $if;
$this->else = $else;
}
public function getSubNodeNames() {
return array('cond', 'if', 'else');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class UnaryMinus extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a unary minus node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class UnaryPlus extends Expr
{
/** @var Expr Expression */
public $expr;
/**
* Constructs a unary plus node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Variable extends Expr
{
/** @var string|Expr Name */
public $name;
/**
* Constructs a variable node.
*
* @param string|Expr $name Name
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}
public function getSubNodeNames() {
return array('name');
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class YieldFrom extends Expr
{
/** @var Expr Expression to yield from */
public $expr;
/**
* Constructs an "yield from" node.
*
* @param Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}
public function getSubNodeNames() {
return array('expr');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace PhpParser\Node\Expr;
use PhpParser\Node\Expr;
class Yield_ extends Expr
{
/** @var null|Expr Key expression */
public $key;
/** @var null|Expr Value expression */
public $value;
/**
* Constructs a yield expression node.
*
* @param null|Expr $value Value expression
* @param null|Expr $key Key expression
* @param array $attributes Additional 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() {
return array('key', 'value');
}
}

View file

@ -0,0 +1,36 @@
<?php
namespace PhpParser\Node;
use PhpParser\Node;
interface FunctionLike extends Node
{
/**
* Whether to return by reference
*
* @return bool
*/
public function returnsByRef();
/**
* List of parameters
*
* @return Node\Param[]
*/
public function getParams();
/**
* Get the declared return type or null
*
* @return null|string|Node\Name|Node\NullableType
*/
public function getReturnType();
/**
* The function body
*
* @return Node\Stmt[]
*/
public function getStmts();
}

View file

@ -0,0 +1,196 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class Name extends NodeAbstract
{
/**
* @var string[] Parts of the name
*/
public $parts;
/**
* Constructs a name node.
*
* @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 = array()) {
parent::__construct($attributes);
$this->parts = self::prepareName($name);
}
public function getSubNodeNames() {
return array('parts');
}
/**
* Gets the first part of the name, i.e. everything before the first namespace separator.
*
* @return string First part of the name
*/
public function getFirst() {
return $this->parts[0];
}
/**
* Gets the last part of the name, i.e. everything after the last namespace separator.
*
* @return string Last part of the name
*/
public function getLast() {
return $this->parts[count($this->parts) - 1];
}
/**
* Checks whether the name is unqualified. (E.g. Name)
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
return 1 == count($this->parts);
}
/**
* Checks whether the name is qualified. (E.g. Name\Name)
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
return 1 < count($this->parts);
}
/**
* Checks whether the name is fully qualified. (E.g. \Name)
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
return false;
}
/**
* Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
*
* @return bool Whether the name is relative
*/
public function isRelative() {
return false;
}
/**
* 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);
}
/**
* 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);
}
/**
* Gets a slice of a name (similar to array_slice).
*
* This method returns a new instance of the same type as the original and with the same
* attributes.
*
* If the slice is empty, null is returned. The null value will be correctly handled in
* concatenations using concat().
*
* Offset and length have the same meaning as in array_slice().
*
* @param int $offset Offset to start the slice at (may be negative)
* @param int|null $length Length of the slice (may be negative)
*
* @return static|null Sliced name
*/
public function slice($offset, $length = null) {
$numParts = count($this->parts);
$realOffset = $offset < 0 ? $offset + $numParts : $offset;
if ($realOffset < 0 || $realOffset > $numParts) {
throw new \OutOfBoundsException(sprintf('Offset %d is out of bounds', $offset));
}
if (null === $length) {
$realLength = $numParts - $realOffset;
} else {
$realLength = $length < 0 ? $length + $numParts - $realOffset : $length;
if ($realLength < 0 || $realLength > $numParts) {
throw new \OutOfBoundsException(sprintf('Length %d is out of bounds', $length));
}
}
if ($realLength === 0) {
// Empty slice is represented as null
return null;
}
return new static(array_slice($this->parts, $realOffset, $realLength), $this->attributes);
}
/**
* Concatenate two names, yielding a new Name instance.
*
* The type of the generated instance depends on which class this method is called on, for
* example Name\FullyQualified::concat() will yield a Name\FullyQualified instance.
*
* If one of the arguments is null, a new instance of the other name will be returned. If both
* arguments are null, null will be returned. As such, writing
* Name::concat($namespace, $shortName)
* where $namespace is a Name node or null will work as expected.
*
* @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
*/
public static function concat($name1, $name2, array $attributes = []) {
if (null === $name1 && null === $name2) {
return null;
} elseif (null === $name1) {
return new static(self::prepareName($name2), $attributes);
} else if (null === $name2) {
return new static(self::prepareName($name1), $attributes);
} else {
return new static(
array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes
);
}
}
/**
* Prepares a (string, array or Name node) name for use in name changing methods by converting
* it to an array.
*
* @param string|array|self $name Name to prepare
*
* @return array Prepared name
*/
private static function prepareName($name) {
if (\is_string($name)) {
return explode('\\', $name);
} elseif (\is_array($name)) {
return $name;
} elseif ($name instanceof self) {
return $name->parts;
}
throw new \InvalidArgumentException(
'Expected string, array of parts or Name instance'
);
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace PhpParser\Node\Name;
class FullyQualified extends \PhpParser\Node\Name
{
/**
* Checks whether the name is unqualified. (E.g. Name)
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
return false;
}
/**
* Checks whether the name is qualified. (E.g. Name\Name)
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
return false;
}
/**
* Checks whether the name is fully qualified. (E.g. \Name)
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
return true;
}
/**
* Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
*
* @return bool Whether the name is relative
*/
public function isRelative() {
return false;
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace PhpParser\Node\Name;
class Relative extends \PhpParser\Node\Name
{
/**
* Checks whether the name is unqualified. (E.g. Name)
*
* @return bool Whether the name is unqualified
*/
public function isUnqualified() {
return false;
}
/**
* Checks whether the name is qualified. (E.g. Name\Name)
*
* @return bool Whether the name is qualified
*/
public function isQualified() {
return false;
}
/**
* Checks whether the name is fully qualified. (E.g. \Name)
*
* @return bool Whether the name is fully qualified
*/
public function isFullyQualified() {
return false;
}
/**
* Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
*
* @return bool Whether the name is relative
*/
public function isRelative() {
return true;
}
}

View file

@ -0,0 +1,26 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class NullableType extends NodeAbstract
{
/** @var string|Name Type */
public $type;
/**
* Constructs a nullable type (wrapping another type).
*
* @param string|Name $type Type
* @param array $attributes Additional attributes
*/
public function __construct($type, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
}
public function getSubNodeNames() {
return array('type');
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class Param extends NodeAbstract
{
/** @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 string Name */
public $name;
/** @var null|Expr Default value */
public $default;
/**
* Constructs a parameter node.
*
* @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($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->name = $name;
$this->default = $default;
}
public function getSubNodeNames() {
return array('type', 'byRef', 'variadic', 'name', 'default');
}
}

View file

@ -0,0 +1,7 @@
<?php
namespace PhpParser\Node;
abstract class Scalar extends Expr
{
}

View file

@ -0,0 +1,64 @@
<?php
namespace PhpParser\Node\Scalar;
use PhpParser\Node\Scalar;
class DNumber extends Scalar
{
/** @var float Number value */
public $value;
/**
* Constructs a float number scalar node.
*
* @param float $value Value of the number
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}
public function getSubNodeNames() {
return array('value');
}
/**
* @internal
*
* Parses a DNUMBER token like PHP would.
*
* @param string $str A string number
*
* @return float The parsed number
*/
public static function parse($str) {
// if string contains any of .eE just cast it to float
if (false !== strpbrk($str, '.eE')) {
return (float) $str;
}
// otherwise it's an integer notation that overflowed into a float
// if it starts with 0 it's one of the special integer notations
if ('0' === $str[0]) {
// hex
if ('x' === $str[1] || 'X' === $str[1]) {
return hexdec($str);
}
// bin
if ('b' === $str[1] || 'B' === $str[1]) {
return bindec($str);
}
// oct
// substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9)
// so that only the digits before that are used
return octdec(substr($str, 0, strcspn($str, '89')));
}
// dec
return (float) $str;
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace PhpParser\Node\Scalar;
use PhpParser\Node\Expr;
use PhpParser\Node\Scalar;
class Encapsed extends Scalar
{
/** @var Expr[] list of string parts */
public $parts;
/**
* Constructs an encapsed string node.
*
* @param array $parts Encaps list
* @param array $attributes Additional attributes
*/
public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}
public function getSubNodeNames() {
return array('parts');
}
}

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