the whole shebang

This commit is contained in:
2014-11-25 16:42:40 +01:00
parent 7f74c0613e
commit ab1334c0cf
3686 changed files with 496409 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property null|PHPParser_Node_Expr $num Number of loops to break
*/
class PHPParser_Node_Stmt_Break extends PHPParser_Node_Stmt
{
/**
* Constructs a break node.
*
* @param null|PHPParser_Node_Expr $num Number of loops to break
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $num = null, array $attributes = array()) {
parent::__construct(
array(
'num' => $num,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property null|PHPParser_Node_Expr $cond Condition (null for default)
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Case extends PHPParser_Node_Stmt
{
/**
* Constructs a case node.
*
* @param null|PHPParser_Node_Expr $cond Condition (null for default)
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct($cond, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* @property PHPParser_Node_Name $type Class of exception
* @property string $var Variable for exception
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Catch extends PHPParser_Node_Stmt
{
/**
* Constructs a catch node.
*
* @param PHPParser_Node_Name $type Class of exception
* @param string $var Variable for exception
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Name $type, $var, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'type' => $type,
'var' => $var,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,102 @@
<?php
/**
* @property int $type Type
* @property string $name Name
* @property null|PHPParser_Node_Name $extends Name of extended class
* @property PHPParser_Node_Name[] $implements Names of implemented interfaces
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Class extends PHPParser_Node_Stmt
{
const MODIFIER_PUBLIC = 1;
const MODIFIER_PROTECTED = 2;
const MODIFIER_PRIVATE = 4;
const MODIFIER_STATIC = 8;
const MODIFIER_ABSTRACT = 16;
const MODIFIER_FINAL = 32;
protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);
/**
* Constructs a class node.
*
* @param string $name Name
* @param array $subNodes Array of the following optional subnodes:
* 'type' => 0 : Type
* 'extends' => null : Name of extended class
* 'implements' => array(): Names of implemented interfaces
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'type' => 0,
'extends' => null,
'implements' => array(),
'stmts' => array(),
),
$attributes
);
$this->name = $name;
if (isset(self::$specialNames[(string) $this->name])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->name));
}
if (isset(self::$specialNames[(string) $this->extends])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as class name as it is reserved', $this->extends));
}
foreach ($this->implements as $interface) {
if (isset(self::$specialNames[(string) $interface])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $interface));
}
}
}
public function isAbstract() {
return (bool) ($this->type & self::MODIFIER_ABSTRACT);
}
public function isFinal() {
return (bool) ($this->type & self::MODIFIER_FINAL);
}
public function getMethods() {
$methods = array();
foreach ($this->stmts as $stmt) {
if ($stmt instanceof PHPParser_Node_Stmt_ClassMethod) {
$methods[] = $stmt;
}
}
return $methods;
}
public static function verifyModifier($a, $b) {
if ($a & 7 && $b & 7) {
throw new PHPParser_Error('Multiple access type modifiers are not allowed');
}
if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) {
throw new PHPParser_Error('Multiple abstract modifiers are not allowed');
}
if ($a & self::MODIFIER_STATIC && $b & self::MODIFIER_STATIC) {
throw new PHPParser_Error('Multiple static modifiers are not allowed');
}
if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) {
throw new PHPParser_Error('Multiple final modifiers are not allowed');
}
if ($a & 48 && $b & 48) {
throw new PHPParser_Error('Cannot use the final and abstract modifier at the same time');
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Const[] $consts Constant declarations
*/
class PHPParser_Node_Stmt_ClassConst extends PHPParser_Node_Stmt
{
/**
* Constructs a class const list node.
*
* @param PHPParser_Node_Const[] $consts Constant declarations
* @param array $attributes Additional attributes
*/
public function __construct(array $consts, array $attributes = array()) {
parent::__construct(
array(
'consts' => $consts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* @property int $type Type
* @property bool $byRef Whether to return by reference
* @property string $name Name
* @property PHPParser_Node_Param[] $params Parameters
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_ClassMethod extends PHPParser_Node_Stmt
{
/**
* Constructs a class method node.
*
* @param string $name Name
* @param array $subNodes Array of the following optional subnodes:
* 'type' => MODIFIER_PUBLIC: Type
* 'byRef' => false : Whether to return by reference
* 'params' => array() : Parameters
* 'stmts' => array() : Statements
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'type' => PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC,
'byRef' => false,
'params' => array(),
'stmts' => array(),
),
$attributes
);
$this->name = $name;
if (($this->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC)
&& ('__construct' == $this->name || '__destruct' == $this->name || '__clone' == $this->name)
) {
throw new PHPParser_Error(sprintf('"%s" method cannot be static', $this->name));
}
}
public function isPublic() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC);
}
public function isProtected() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED);
}
public function isPrivate() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE);
}
public function isAbstract() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT);
}
public function isFinal() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_FINAL);
}
public function isStatic() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Const[] $consts Constant declarations
*/
class PHPParser_Node_Stmt_Const extends PHPParser_Node_Stmt
{
/**
* Constructs a const list node.
*
* @param PHPParser_Node_Const[] $consts Constant declarations
* @param array $attributes Additional attributes
*/
public function __construct(array $consts, array $attributes = array()) {
parent::__construct(
array(
'consts' => $consts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property null|PHPParser_Node_Expr $num Number of loops to continue
*/
class PHPParser_Node_Stmt_Continue extends PHPParser_Node_Stmt
{
/**
* Constructs a continue node.
*
* @param null|PHPParser_Node_Expr $num Number of loops to continue
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $num = null, array $attributes = array()) {
parent::__construct(
array(
'num' => $num,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Stmt_DeclareDeclare[] $declares List of declares
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Declare extends PHPParser_Node_Stmt
{
/**
* Constructs a declare node.
*
* @param PHPParser_Node_Stmt_DeclareDeclare[] $declares List of declares
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(array $declares, array $stmts, array $attributes = array()) {
parent::__construct(
array(
'declares' => $declares,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property string $key Key
* @property PHPParser_Node_Expr $value Value
*/
class PHPParser_Node_Stmt_DeclareDeclare extends PHPParser_Node_Stmt
{
/**
* Constructs a declare key=>value pair node.
*
* @param string $key Key
* @param PHPParser_Node_Expr $value Value
* @param array $attributes Additional attributes
*/
public function __construct($key, PHPParser_Node_Expr $value, array $attributes = array()) {
parent::__construct(
array(
'key' => $key,
'value' => $value,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Expr $cond Condition
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Do extends PHPParser_Node_Stmt
{
/**
* Constructs a do while node.
*
* @param PHPParser_Node_Expr $cond Condition
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Expr[] $exprs Expressions
*/
class PHPParser_Node_Stmt_Echo extends PHPParser_Node_Stmt
{
/**
* Constructs an echo node.
*
* @param PHPParser_Node_Expr[] $exprs Expressions
* @param array $attributes Additional attributes
*/
public function __construct(array $exprs, array $attributes = array()) {
parent::__construct(
array(
'exprs' => $exprs,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Else extends PHPParser_Node_Stmt
{
/**
* Constructs an else node.
*
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Expr $cond Condition
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_ElseIf extends PHPParser_Node_Stmt
{
/**
* Constructs an elseif node.
*
* @param PHPParser_Node_Expr $cond Condition
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* @property PHPParser_Node_Expr[] $init Init expressions
* @property PHPParser_Node_Expr[] $cond Loop conditions
* @property PHPParser_Node_Expr[] $loop Loop expressions
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_For extends PHPParser_Node_Stmt
{
/**
* Constructs a for loop node.
*
* @param array $subNodes Array of the following optional subnodes:
* 'init' => array(): Init expressions
* 'cond' => array(): Loop conditions
* 'loop' => array(): Loop expressions
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'init' => array(),
'cond' => array(),
'loop' => array(),
'stmts' => array(),
),
$attributes
);
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* @property PHPParser_Node_Expr $expr Expression to iterate
* @property null|PHPParser_Node_Expr $keyVar Variable to assign key to
* @property bool $byRef Whether to assign value by reference
* @property PHPParser_Node_Expr $valueVar Variable to assign value to
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Foreach extends PHPParser_Node_Stmt
{
/**
* Constructs a foreach node.
*
* @param PHPParser_Node_Expr $expr Expression to iterate
* @param PHPParser_Node_Expr $valueVar Variable to assign value to
* @param array $subNodes Array of the following optional subnodes:
* 'keyVar' => null : Variable to assign key to
* 'byRef' => false : Whether to assign value by reference
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $expr, PHPParser_Node_Expr $valueVar, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'keyVar' => null,
'byRef' => false,
'stmts' => array(),
),
$attributes
);
$this->expr = $expr;
$this->valueVar = $valueVar;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* @property bool $byRef Whether returns by reference
* @property string $name Name
* @property PHPParser_Node_Param[] $params Parameters
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Function extends PHPParser_Node_Stmt
{
/**
* Constructs a function node.
*
* @param string $name Name
* @param array $subNodes Array of the following optional subnodes:
* 'byRef' => false : Whether to return by reference
* 'params' => array(): Parameters
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'byRef' => false,
'params' => array(),
'stmts' => array(),
),
$attributes
);
$this->name = $name;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Expr[] $vars Variables
*/
class PHPParser_Node_Stmt_Global extends PHPParser_Node_Stmt
{
/**
* Constructs a global variables list node.
*
* @param PHPParser_Node_Expr[] $vars Variables to unset
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = array()) {
parent::__construct(
array(
'vars' => $vars,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property string $name Name of label to jump to
*/
class PHPParser_Node_Stmt_Goto extends PHPParser_Node_Stmt
{
/**
* Constructs a goto node.
*
* @param string $name Name of label to jump to
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property string $remaining Remaining text after halt compiler statement.
*/
class PHPParser_Node_Stmt_HaltCompiler extends PHPParser_Node_Stmt
{
/**
* Constructs a __halt_compiler node.
*
* @param string $remaining Remaining text after halt compiler statement.
* @param array $attributes Additional attributes
*/
public function __construct($remaining, array $attributes = array()) {
parent::__construct(
array(
'remaining' => $remaining,
),
$attributes
);
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* @property PHPParser_Node_Expr $cond Condition expression
* @property PHPParser_Node[] $stmts Statements
* @property PHPParser_Node_Stmt_ElseIf[] $elseifs Elseif clauses
* @property null|PHPParser_Node_Stmt_Else $else Else clause
*/
class PHPParser_Node_Stmt_If extends PHPParser_Node_Stmt
{
/**
* Constructs an if node.
*
* @param PHPParser_Node_Expr $cond Condition
* @param array $subNodes Array of the following optional subnodes:
* 'stmts' => array(): Statements
* 'elseifs' => array(): Elseif clauses
* 'else' => null : Else clause
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $cond, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'stmts' => array(),
'elseifs' => array(),
'else' => null,
),
$attributes
);
$this->cond = $cond;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property string $value String
*/
class PHPParser_Node_Stmt_InlineHTML extends PHPParser_Node_Stmt
{
/**
* Constructs an inline HTML node.
*
* @param string $value String
* @param array $attributes Additional attributes
*/
public function __construct($value, array $attributes = array()) {
parent::__construct(
array(
'value' => $value,
),
$attributes
);
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* @property string $name Name
* @property PHPParser_Node_Name[] $extends Extended interfaces
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Interface extends PHPParser_Node_Stmt
{
protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);
/**
* Constructs a class node.
*
* @param string $name Name
* @param array $subNodes Array of the following optional subnodes:
* 'extends' => array(): Name of extended interfaces
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
$subNodes + array(
'extends' => array(),
'stmts' => array(),
),
$attributes
);
$this->name = $name;
if (isset(self::$specialNames[(string) $this->name])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $this->name));
}
foreach ($this->extends as $interface) {
if (isset(self::$specialNames[(string) $interface])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as interface name as it is reserved', $interface));
}
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property string $name Name
*/
class PHPParser_Node_Stmt_Label extends PHPParser_Node_Stmt
{
/**
* Constructs a label node.
*
* @param string $name Name
* @param array $attributes Additional attributes
*/
public function __construct($name, array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
),
$attributes
);
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* @property null|PHPParser_Node_Name $name Name
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Namespace extends PHPParser_Node_Stmt
{
protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);
/**
* Constructs a namespace node.
*
* @param null|PHPParser_Node_Name $name Name
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Name $name = null, $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
'stmts' => $stmts,
),
$attributes
);
if (isset(self::$specialNames[(string) $this->name])) {
throw new PHPParser_Error(sprintf('Cannot use "%s" as namespace name as it is reserved', $this->name));
}
if (null !== $this->stmts) {
foreach ($this->stmts as $stmt) {
if ($stmt instanceof PHPParser_Node_Stmt_Namespace) {
throw new PHPParser_Error('Namespace declarations cannot be nested', $stmt->getLine());
}
}
}
}
public static function postprocess(array $stmts) {
// null = not in namespace, false = semicolon style, true = bracket style
$bracketed = null;
// whether any statements that aren't allowed before a namespace declaration are encountered
// (the only valid statement currently is a declare)
$hasNotAllowedStmts = false;
// offsets for semicolon style namespaces
// (required for transplanting the following statements into their ->stmts property)
$nsOffsets = array();
foreach ($stmts as $i => $stmt) {
if ($stmt instanceof PHPParser_Node_Stmt_Namespace) {
// ->stmts is null if semicolon style is used
$currentBracketed = null !== $stmt->stmts;
// if no namespace statement has been encountered yet
if (!isset($bracketed)) {
// set the namespacing style
$bracketed = $currentBracketed;
// and ensure that it isn't preceded by a not allowed statement
if ($hasNotAllowedStmts) {
throw new PHPParser_Error('Namespace declaration statement has to be the very first statement in the script', $stmt->getLine());
}
// otherwise ensure that the style of the current namespace matches the style of
// namespaceing used before in this document
} elseif ($bracketed !== $currentBracketed) {
throw new PHPParser_Error('Cannot mix bracketed namespace declarations with unbracketed namespace declarations', $stmt->getLine());
}
// for semicolon style namespaces remember the offset
if (!$bracketed) {
$nsOffsets[] = $i;
}
// declare() and __halt_compiler() are the only valid statements outside of namespace declarations
} elseif (!$stmt instanceof PHPParser_Node_Stmt_Declare
&& !$stmt instanceof PHPParser_Node_Stmt_HaltCompiler
) {
if (true === $bracketed) {
throw new PHPParser_Error('No code may exist outside of namespace {}', $stmt->getLine());
}
$hasNotAllowedStmts = true;
}
}
// if bracketed namespaces were used or no namespaces were used at all just return the
// original statements
if (!isset($bracketed) || true === $bracketed) {
return $stmts;
// for semicolon style transplant statements
} else {
// take all statements preceding the first namespace
$newStmts = array_slice($stmts, 0, $nsOffsets[0]);
// iterate over all following namespaces
for ($i = 0, $c = count($nsOffsets); $i < $c; ++$i) {
$newStmts[] = $nsStmt = $stmts[$nsOffsets[$i]];
// the last namespace takes all statements after it
if ($c === $i + 1) {
$nsStmt->stmts = array_slice($stmts, $nsOffsets[$i] + 1);
// if the last statement is __halt_compiler() put it outside the namespace
if (end($nsStmt->stmts) instanceof PHPParser_Node_Stmt_HaltCompiler) {
$newStmts[] = array_pop($nsStmt->stmts);
}
// and all the others take all statements between the current and the following one
} else {
$nsStmt->stmts = array_slice($stmts, $nsOffsets[$i] + 1, $nsOffsets[$i + 1] - $nsOffsets[$i] - 1);
}
}
return $newStmts;
}
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* @property int $type Modifiers
* @property PHPParser_Node_Stmt_PropertyProperty[] $props Properties
*/
class PHPParser_Node_Stmt_Property extends PHPParser_Node_Stmt
{
/**
* Constructs a class property list node.
*
* @param int $type Modifiers
* @param PHPParser_Node_Stmt_PropertyProperty[] $props Properties
* @param array $attributes Additional attributes
*/
public function __construct($type, array $props, array $attributes = array()) {
parent::__construct(
array(
'type' => $type,
'props' => $props,
),
$attributes
);
}
public function isPublic() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PUBLIC);
}
public function isProtected() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED);
}
public function isPrivate() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE);
}
public function isStatic() {
return (bool) ($this->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property string $name Name
* @property null|PHPParser_Node_Expr $default Default
*/
class PHPParser_Node_Stmt_PropertyProperty extends PHPParser_Node_Stmt
{
/**
* Constructs a class property node.
*
* @param string $name Name
* @param null|PHPParser_Node_Expr $default Default value
* @param array $attributes Additional attributes
*/
public function __construct($name, PHPParser_Node_Expr $default = null, array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
'default' => $default,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property null|PHPParser_Node_Expr $expr Expression
*/
class PHPParser_Node_Stmt_Return extends PHPParser_Node_Stmt
{
/**
* Constructs a return node.
*
* @param null|PHPParser_Node_Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $expr = null, array $attributes = array()) {
parent::__construct(
array(
'expr' => $expr,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Stmt_StaticVar[] $vars Variable definitions
*/
class PHPParser_Node_Stmt_Static extends PHPParser_Node_Stmt
{
/**
* Constructs a static variables list node.
*
* @param PHPParser_Node_Stmt_StaticVar[] $vars Variable definitions
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = array()) {
parent::__construct(
array(
'vars' => $vars,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property string $name Name
* @property null|PHPParser_Node_Expr $default Default value
*/
class PHPParser_Node_Stmt_StaticVar extends PHPParser_Node_Stmt
{
/**
* Constructs a static variable node.
*
* @param string $name Name
* @param null|PHPParser_Node_Expr $default Default value
* @param array $attributes Additional attributes
*/
public function __construct($name, PHPParser_Node_Expr $default = null, array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
'default' => $default,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Expr $cond Condition
* @property PHPParser_Node_Stmt_Case[] $cases Case list
*/
class PHPParser_Node_Stmt_Switch extends PHPParser_Node_Stmt
{
/**
* Constructs a case node.
*
* @param PHPParser_Node_Expr $cond Condition
* @param PHPParser_Node_Stmt_Case[] $cases Case list
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $cond, array $cases, array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'cases' => $cases,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Expr $expr Expression
*/
class PHPParser_Node_Stmt_Throw extends PHPParser_Node_Stmt
{
/**
* Constructs a throw node.
*
* @param PHPParser_Node_Expr $expr Expression
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $expr, array $attributes = array()) {
parent::__construct(
array(
'expr' => $expr,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property string $name Name
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_Trait extends PHPParser_Node_Stmt
{
/**
* Constructs a trait node.
*
* @param string $name Name
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct($name, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'name' => $name,
'stmts' => $stmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Name[] $traits Traits
* @property PHPParser_Node_Stmt_TraitUseAdaptation[] $adaptations Adaptations
*/
class PHPParser_Node_Stmt_TraitUse extends PHPParser_Node_Stmt
{
/**
* Constructs a trait use node.
*
* @param PHPParser_Node_Name[] $traits Traits
* @param PHPParser_Node_Stmt_TraitUseAdaptation[] $adaptations Adaptations
* @param array $attributes Additional attributes
*/
public function __construct(array $traits, array $adaptations = array(), array $attributes = array()) {
parent::__construct(
array(
'traits' => $traits,
'adaptations' => $adaptations,
),
$attributes
);
}
}

View File

@@ -0,0 +1,5 @@
<?php
abstract class PHPParser_Node_Stmt_TraitUseAdaptation extends PHPParser_Node_Stmt
{
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* @property null|PHPParser_Node_Name $trait Trait name
* @property string $method Method name
* @property null|int $newModifier New modifier
* @property null|string $newName New name
*/
class PHPParser_Node_Stmt_TraitUseAdaptation_Alias extends PHPParser_Node_Stmt_TraitUseAdaptation
{
/**
* Constructs a trait use precedence adaptation node.
*
* @param null|PHPParser_Node_Name $trait Trait name
* @param string $method Method name
* @param null|int $newModifier New modifier
* @param null|string $newName New name
* @param array $attributes Additional attributes
*/
public function __construct($trait, $method, $newModifier, $newName, array $attributes = array()) {
parent::__construct(
array(
'trait' => $trait,
'method' => $method,
'newModifier' => $newModifier,
'newName' => $newName,
),
$attributes
);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* @property PHPParser_Node_Name $trait Trait name
* @property string $method Method name
* @property PHPParser_Node_Name[] $insteadof Overwritten traits
*/
class PHPParser_Node_Stmt_TraitUseAdaptation_Precedence extends PHPParser_Node_Stmt_TraitUseAdaptation
{
/**
* Constructs a trait use precedence adaptation node.
*
* @param PHPParser_Node_Name $trait Trait name
* @param string $method Method name
* @param PHPParser_Node_Name[] $insteadof Overwritten traits
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Name $trait, $method, array $insteadof, array $attributes = array()) {
parent::__construct(
array(
'trait' => $trait,
'method' => $method,
'insteadof' => $insteadof,
),
$attributes
);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* @property PHPParser_Node[] $stmts Statements
* @property PHPParser_Node_Stmt_Catch[] $catches Catches
* @property PHPParser_Node[] $finallyStmts Finally statements
*/
class PHPParser_Node_Stmt_TryCatch extends PHPParser_Node_Stmt
{
/**
* Constructs a try catch node.
*
* @param PHPParser_Node[] $stmts Statements
* @param PHPParser_Node_Stmt_Catch[] $catches Catches
* @param PHPParser_Node[] $finallyStmts Finally statements (null means no finally clause)
* @param array|null $attributes Additional attributes
*/
public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array()) {
if (empty($catches) && null === $finallyStmts) {
throw new PHPParser_Error('Cannot use try without catch or finally');
}
parent::__construct(
array(
'stmts' => $stmts,
'catches' => $catches,
'finallyStmts' => $finallyStmts,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Expr[] $vars Variables to unset
*/
class PHPParser_Node_Stmt_Unset extends PHPParser_Node_Stmt
{
/**
* Constructs an unset node.
*
* @param PHPParser_Node_Expr[] $vars Variables to unset
* @param array $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = array()) {
parent::__construct(
array(
'vars' => $vars,
),
$attributes
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* @property PHPParser_Node_Stmt_UseUse[] $uses Aliases
*/
class PHPParser_Node_Stmt_Use extends PHPParser_Node_Stmt
{
/**
* Constructs an alias (use) list node.
*
* @param PHPParser_Node_Stmt_UseUse[] $uses Aliases
* @param array $attributes Additional attributes
*/
public function __construct(array $uses, array $attributes = array()) {
parent::__construct(
array(
'uses' => $uses,
),
$attributes
);
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* @property PHPParser_Node_Name $name Namespace/Class to alias
* @property string $alias Alias
*/
class PHPParser_Node_Stmt_UseUse extends PHPParser_Node_Stmt
{
/**
* Constructs an alias (use) node.
*
* @param PHPParser_Node_Name $name Namespace/Class to alias
* @param null|string $alias Alias
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Name $name, $alias = null, array $attributes = array()) {
if (null === $alias) {
$alias = $name->getLast();
}
if ('self' == $alias || 'parent' == $alias) {
throw new PHPParser_Error(sprintf(
'Cannot use "%s" as "%s" because "%2$s" is a special class name',
$name, $alias
));
}
parent::__construct(
array(
'name' => $name,
'alias' => $alias,
),
$attributes
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* @property PHPParser_Node_Expr $cond Condition
* @property PHPParser_Node[] $stmts Statements
*/
class PHPParser_Node_Stmt_While extends PHPParser_Node_Stmt
{
/**
* Constructs a while node.
*
* @param PHPParser_Node_Expr $cond Condition
* @param PHPParser_Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(PHPParser_Node_Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'stmts' => $stmts,
),
$attributes
);
}
}