Skip to content

Latest commit

 

History

History
2563 lines (1520 loc) · 38.2 KB

nodes_overview.md

File metadata and controls

2563 lines (1520 loc) · 38.2 KB

Node Overview

Expressions

PhpParser\Node\Expr\ArrayDimFetch

  • requires arguments on construct

Example PHP Code

$someVariable[0]

Public Properties

  • $var - /** @var Expr Variable */
  • $dim - /** @var null|Expr Array index / dim */

PhpParser\Node\Expr\ArrayItem

  • requires arguments on construct

Example PHP Code

'name' => $Tom

Public Properties

  • $key - /** @var null|Expr Key */
  • $value - /** @var Expr Value */
  • $byRef - /** @var bool Whether to assign by reference */
  • $unpack - /** @var bool Whether to unpack the argument */

PhpParser\Node\Expr\Array_

Example PHP Code

[]

Public Properties

  • $items - /** @var ArrayItem[] Items */

PhpParser\Node\Expr\ArrowFunction

Example PHP Code

fn() => 1

Public Properties

  • $static - /** @var bool */
  • $byRef - /** @var bool */
  • $params - /** @var Node\Param[] */
  • $returnType - /** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType */
  • $expr - /** @var Expr */

PhpParser\Node\Expr\Assign

  • requires arguments on construct

Example PHP Code

$someVariable = 'some value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignRef

  • requires arguments on construct

Example PHP Code

$someVariable =& $someOtherVariable

Public Properties

  • $var - /** @var Expr Variable reference is assigned to */
  • $expr - /** @var Expr Variable which is referenced */

PhpParser\Node\Expr\BitwiseNot

  • requires arguments on construct

Example PHP Code

~$someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\BooleanNot

  • requires arguments on construct

Example PHP Code

!true

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\ClassConstFetch

  • requires arguments on construct

Example PHP Code

SomeClass::SOME_CONSTANT

Public Properties

  • $class - /** @var Name|Expr Class name */
  • $name - /** @var Identifier|Error Constant name */

PhpParser\Node\Expr\Clone_

  • requires arguments on construct

Example PHP Code

clone $someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Closure

Example PHP Code

function () {
}

Public Properties

  • $static - /** @var bool Whether the closure is static */
  • $byRef - /** @var bool Whether to return by reference */
  • $params - /** @var Node\Param[] Parameters */
  • $uses - /** @var ClosureUse[] use()s */
  • $returnType - /** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Expr\ClosureUse

  • requires arguments on construct

Example PHP Code

$someVariable

Public Properties

  • $var - /** @var Expr\Variable Variable to use */
  • $byRef - /** @var bool Whether to use by reference */

PhpParser\Node\Expr\ConstFetch

  • requires arguments on construct

Example PHP Code

true

Public Properties

  • $name - /** @var Name Constant name */

PhpParser\Node\Expr\Empty_

  • requires arguments on construct

Example PHP Code

empty($someVariable)

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\ErrorSuppress

  • requires arguments on construct

Example PHP Code

@$someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Eval_

  • requires arguments on construct

Example PHP Code

eval('Some php code')

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Exit_

Example PHP Code

die

Public Properties

  • $expr - /** @var null|Expr Expression */

PhpParser\Node\Expr\FuncCall

  • requires arguments on construct

Example PHP Code

functionCall()

Public Properties

  • $name - /** @var Node\Name|Expr Function name */
  • $args - /** @var Node\Arg[] Arguments */

PhpParser\Node\Expr\Include_

  • requires arguments on construct

Example PHP Code

include $someVariable

Public Properties

  • $expr - /** @var Expr Expression */
  • $type - /** @var int Type of include */

PhpParser\Node\Expr\Instanceof_

  • requires arguments on construct

Example PHP Code

$someVariable instanceof SomeClass

Public Properties

  • $expr - /** @var Expr Expression */
  • $class - /** @var Name|Expr Class name */

PhpParser\Node\Expr\Isset_

  • requires arguments on construct

Example PHP Code

isset($variable)

Public Properties

  • $vars - /** @var Expr[] Variables */

PhpParser\Node\Expr\List_

  • requires arguments on construct

Example PHP Code

list($someVariable)

Public Properties

  • $items - /** @var (ArrayItem|null)[] List of items to assign to */

PhpParser\Node\Expr\MethodCall

  • requires arguments on construct

Example PHP Code

$someObject->methodName()

Public Properties

  • $var - /** @var Expr Variable holding object */
  • $name - /** @var Identifier|Expr Method name */
  • $args - /** @var Arg[] Arguments */

PhpParser\Node\Expr\New_

  • requires arguments on construct

Example PHP Code

new class
{
}

Public Properties

  • $class - /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
  • $args - /** @var Node\Arg[] Arguments */

PhpParser\Node\Expr\PostDec

  • requires arguments on construct

Example PHP Code

$someVariable--

Public Properties

  • $var - /** @var Expr Variable */

PhpParser\Node\Expr\PostInc

  • requires arguments on construct

Example PHP Code

$someVariable++

Public Properties

  • $var - /** @var Expr Variable */

PhpParser\Node\Expr\PreDec

  • requires arguments on construct

Example PHP Code

--$someVariable

Public Properties

  • $var - /** @var Expr Variable */

PhpParser\Node\Expr\PreInc

  • requires arguments on construct

Example PHP Code

++$someVariable

Public Properties

  • $var - /** @var Expr Variable */

PhpParser\Node\Expr\Print_

  • requires arguments on construct

Example PHP Code

print $someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\PropertyFetch

  • requires arguments on construct

Example PHP Code

$someVariable->propertyName

Public Properties

  • $var - /** @var Expr Variable holding object */
  • $name - /** @var Identifier|Expr Property name */

PhpParser\Node\Expr\ShellExec

  • requires arguments on construct

Example PHP Code

`encapsedstring`

Public Properties

  • $parts - /** @var array Encapsed string array */

PhpParser\Node\Expr\StaticCall

  • requires arguments on construct

Example PHP Code

SomeClass::methodName()

Public Properties

  • $class - /** @var Node\Name|Expr Class name */
  • $name - /** @var Identifier|Expr Method name */
  • $args - /** @var Node\Arg[] Arguments */

PhpParser\Node\Expr\StaticPropertyFetch

  • requires arguments on construct

Example PHP Code

SomeClass::$someProperty

Public Properties

  • $class - /** @var Name|Expr Class name */
  • $name - /** @var VarLikeIdentifier|Expr Property name */

PhpParser\Node\Expr\Ternary

  • requires arguments on construct

Example PHP Code

$someVariable ? true : false

Public Properties

  • $cond - /** @var Expr Condition */
  • $if - /** @var null|Expr Expression for true */
  • $else - /** @var Expr Expression for false */

PhpParser\Node\Expr\UnaryMinus

  • requires arguments on construct

Example PHP Code

-$someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\UnaryPlus

  • requires arguments on construct

Example PHP Code

+$someVariable

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Variable

  • requires arguments on construct

Example PHP Code

$someVariable

Public Properties

  • $name - /** @var string|Expr Name */

PhpParser\Node\Expr\YieldFrom

  • requires arguments on construct

Example PHP Code

yield from $someVariable

Public Properties

  • $expr - /** @var Expr Expression to yield from */

PhpParser\Node\Expr\Yield_

Example PHP Code

yield

Public Properties

  • $key - /** @var null|Expr Key expression */
  • $value - /** @var null|Expr Value expression */

Children of "PhpParser\Node\Expr\AssignOp"

PhpParser\Node\Expr\AssignOp\BitwiseAnd

  • requires arguments on construct

Example PHP Code

$variable &= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\BitwiseOr

  • requires arguments on construct

Example PHP Code

$variable |= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\BitwiseXor

  • requires arguments on construct

Example PHP Code

$variable ^= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Coalesce

  • requires arguments on construct

Example PHP Code

$variable ??= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Concat

  • requires arguments on construct

Example PHP Code

$variable .= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Div

  • requires arguments on construct

Example PHP Code

$variable /= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Minus

  • requires arguments on construct

Example PHP Code

$variable -= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Mod

  • requires arguments on construct

Example PHP Code

$variable %= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Mul

  • requires arguments on construct

Example PHP Code

$variable *= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Plus

  • requires arguments on construct

Example PHP Code

$variable += 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\Pow

  • requires arguments on construct

Example PHP Code

$variable **= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\ShiftLeft

  • requires arguments on construct

Example PHP Code

$variable <<= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\AssignOp\ShiftRight

  • requires arguments on construct

Example PHP Code

$variable >>= 'value'

Public Properties

  • $var - /** @var Expr Variable */
  • $expr - /** @var Expr Expression */

Children of "PhpParser\Node\Expr\BinaryOp"

PhpParser\Node\Expr\BinaryOp\BitwiseAnd

  • requires arguments on construct

Example PHP Code

1 & 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\BitwiseOr

  • requires arguments on construct

Example PHP Code

1 | 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\BitwiseXor

  • requires arguments on construct

Example PHP Code

1 ^ 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\BooleanAnd

  • requires arguments on construct

Example PHP Code

1 && 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\BooleanOr

  • requires arguments on construct

Example PHP Code

1 || 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Coalesce

  • requires arguments on construct

Example PHP Code

1 ?? 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Concat

  • requires arguments on construct

Example PHP Code

1 . 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Div

  • requires arguments on construct

Example PHP Code

1 / 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Equal

  • requires arguments on construct

Example PHP Code

1 == 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Greater

  • requires arguments on construct

Example PHP Code

1 > 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\GreaterOrEqual

  • requires arguments on construct

Example PHP Code

1 >= 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Identical

  • requires arguments on construct

Example PHP Code

1 === 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\LogicalAnd

  • requires arguments on construct

Example PHP Code

1 and 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\LogicalOr

  • requires arguments on construct

Example PHP Code

1 or 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\LogicalXor

  • requires arguments on construct

Example PHP Code

1 xor 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Minus

  • requires arguments on construct

Example PHP Code

1 - 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Mod

  • requires arguments on construct

Example PHP Code

1 % 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Mul

  • requires arguments on construct

Example PHP Code

1 * 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\NotEqual

  • requires arguments on construct

Example PHP Code

1 != 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\NotIdentical

  • requires arguments on construct

Example PHP Code

1 !== 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Plus

  • requires arguments on construct

Example PHP Code

1 + 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Pow

  • requires arguments on construct

Example PHP Code

1 ** 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\ShiftLeft

  • requires arguments on construct

Example PHP Code

1 << 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\ShiftRight

  • requires arguments on construct

Example PHP Code

1 >> 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Smaller

  • requires arguments on construct

Example PHP Code

1 < 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\SmallerOrEqual

  • requires arguments on construct

Example PHP Code

1 <= 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

PhpParser\Node\Expr\BinaryOp\Spaceship

  • requires arguments on construct

Example PHP Code

1 <=> 'a'

Public Properties

  • $left - /** @var Expr The left hand side expression */
  • $right - /** @var Expr The right hand side expression */

Children of "PhpParser\Node\Expr\Cast"

PhpParser\Node\Expr\Cast\Array_

  • requires arguments on construct

Example PHP Code

(array) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\Bool_

  • requires arguments on construct

Example PHP Code

(bool) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\Double

  • requires arguments on construct

Example PHP Code

(double) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\Int_

  • requires arguments on construct

Example PHP Code

(int) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\Object_

  • requires arguments on construct

Example PHP Code

(object) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\String_

  • requires arguments on construct

Example PHP Code

(string) $value

Public Properties

  • $expr - /** @var Expr Expression */

PhpParser\Node\Expr\Cast\Unset_

  • requires arguments on construct

Example PHP Code

(unset) $value

Public Properties

  • $expr - /** @var Expr Expression */

Children of "PhpParser\Node\Name"

PhpParser\Node\Name

  • requires arguments on construct

Example PHP Code

name

Public Properties

  • $parts - /** @var string[] Parts of the name */
  • $specialClassNames - ``

PhpParser\Node\Name\FullyQualified

  • requires arguments on construct

Example PHP Code

\name

Public Properties

  • $parts - /** @var string[] Parts of the name */

PhpParser\Node\Name\Relative

  • requires arguments on construct

Example PHP Code

namespace\name

Public Properties

  • $parts - /** @var string[] Parts of the name */

Scalar nodes

PhpParser\Node\Scalar\DNumber

  • requires arguments on construct

Example PHP Code

10.5

Public Properties

  • $value - /** @var float Number value */

PhpParser\Node\Scalar\Encapsed

  • requires arguments on construct

Example PHP Code

"{$enscapsed}"

Public Properties

  • $parts - /** @var Expr[] list of string parts */

PhpParser\Node\Scalar\EncapsedStringPart

  • requires arguments on construct

Example PHP Code

UNABLE_TO_PRINT_ENCAPSED_STRING

Public Properties

  • $value - /** @var string String value */

PhpParser\Node\Scalar\LNumber

  • requires arguments on construct

Example PHP Code

100

Public Properties

  • $value - /** @var int Number value */

PhpParser\Node\Scalar\MagicConst\Class_

Example PHP Code

__CLASS__

PhpParser\Node\Scalar\MagicConst\Dir

Example PHP Code

__DIR__

PhpParser\Node\Scalar\MagicConst\File

Example PHP Code

__FILE__

PhpParser\Node\Scalar\MagicConst\Function_

Example PHP Code

__FUNCTION__

PhpParser\Node\Scalar\MagicConst\Line

Example PHP Code

__LINE__

PhpParser\Node\Scalar\MagicConst\Method

Example PHP Code

__METHOD__

PhpParser\Node\Scalar\MagicConst\Namespace_

Example PHP Code

__NAMESPACE__

PhpParser\Node\Scalar\MagicConst\Trait_

Example PHP Code

__TRAIT__

PhpParser\Node\Scalar\String_

  • requires arguments on construct

Example PHP Code

'string'

Public Properties

  • $value - /** @var string String value */
  • $replacements - ``

Statements

PhpParser\Node\Stmt\Break_

Example PHP Code

break;

Public Properties

  • $num - /** @var null|Node\Expr Number of loops to break */

PhpParser\Node\Stmt\Case_

  • requires arguments on construct

Example PHP Code

case true:

Public Properties

  • $cond - /** @var null|Node\Expr Condition (null for default) */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Catch_

  • requires arguments on construct

Example PHP Code

catch (CatchedType $catchedVariable) {
}

Public Properties

  • $types - /** @var Node\Name[] Types of exceptions to catch */
  • $var - /** @var Expr\Variable Variable for exception */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\ClassConst

  • requires arguments on construct

Example PHP Code

const SOME_CLASS_CONSTANT = 'default value';

Public Properties

  • $flags - /** @var int Modifiers */
  • $consts - /** @var Node\Const_[] Constant declarations */

PhpParser\Node\Stmt\ClassMethod

  • requires arguments on construct

Example PHP Code

public function someMethod()
{
}

Public Properties

  • $flags - /** @var int Flags */
  • $byRef - /** @var bool Whether to return by reference */
  • $name - /** @var Node\Identifier Name */
  • $params - /** @var Node\Param[] Parameters */
  • $returnType - /** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */
  • $stmts - /** @var Node\Stmt[]|null Statements */
  • $magicNames - ``

PhpParser\Node\Stmt\Class_

  • requires arguments on construct

Example PHP Code

class ClassName
{
}

Public Properties

  • $flags - /** @var int Type */
  • $extends - /** @var null|Node\Name Name of extended class */
  • $implements - /** @var Node\Name[] Names of implemented interfaces */
  • $name - /** @var Node\Identifier|null Name */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Const_

  • requires arguments on construct

Example PHP Code

const CONSTANT_IN_CLASS = 'default value';

Public Properties

  • $consts - /** @var Node\Const_[] Constant declarations */

PhpParser\Node\Stmt\Continue_

Example PHP Code

continue;

Public Properties

  • $num - /** @var null|Node\Expr Number of loops to continue */

PhpParser\Node\Stmt\DeclareDeclare

  • requires arguments on construct

Example PHP Code

strict_types=1

Public Properties

  • $key - /** @var Node\Identifier Key */
  • $value - /** @var Node\Expr Value */

PhpParser\Node\Stmt\Declare_

  • requires arguments on construct

Example PHP Code

declare(strict_types=1);

Public Properties

  • $declares - /** @var DeclareDeclare[] List of declares */
  • $stmts - /** @var Node\Stmt[]|null Statements */

PhpParser\Node\Stmt\Do_

  • requires arguments on construct

Example PHP Code

do {
} while ($variable);

Public Properties

  • $stmts - /** @var Node\Stmt[] Statements */
  • $cond - /** @var Node\Expr Condition */

PhpParser\Node\Stmt\Echo_

  • requires arguments on construct

Example PHP Code

echo 'hello';

Public Properties

  • $exprs - /** @var Node\Expr[] Expressions */

PhpParser\Node\Stmt\ElseIf_

  • requires arguments on construct

Example PHP Code

elseif (true) {
}

Public Properties

  • $cond - /** @var Node\Expr Condition */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Else_

Example PHP Code

else {
}

Public Properties

  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Expression

  • requires arguments on construct

Example PHP Code

$someVariable;

Public Properties

  • $expr - /** @var Node\Expr Expression */

PhpParser\Node\Stmt\Finally_

Example PHP Code

finally {
}

Public Properties

  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\For_

Example PHP Code

for (;;) {
}

Public Properties

  • $init - /** @var Node\Expr[] Init expressions */
  • $cond - /** @var Node\Expr[] Loop conditions */
  • $loop - /** @var Node\Expr[] Loop expressions */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Foreach_

  • requires arguments on construct

Example PHP Code

foreach ($variables as $value) {
}

Public Properties

  • $expr - /** @var Node\Expr Expression to iterate */
  • $keyVar - /** @var null|Node\Expr Variable to assign key to */
  • $byRef - /** @var bool Whether to assign value by reference */
  • $valueVar - /** @var Node\Expr Variable to assign value to */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Function_

  • requires arguments on construct

Example PHP Code

function some_function()
{
}

Public Properties

  • $byRef - /** @var bool Whether function returns by reference */
  • $name - /** @var Node\Identifier Name */
  • $params - /** @var Node\Param[] Parameters */
  • $returnType - /** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Global_

  • requires arguments on construct

Example PHP Code

global $globalVariable;

Public Properties

  • $vars - /** @var Node\Expr[] Variables */

PhpParser\Node\Stmt\Goto_

  • requires arguments on construct

Example PHP Code

goto goto_break;

Public Properties

  • $name - /** @var Identifier Name of label to jump to */

PhpParser\Node\Stmt\GroupUse

  • requires arguments on construct

Example PHP Code

use prefix\{UsedNamespace};

Public Properties

  • $type - /** @var int Type of group use */
  • $prefix - /** @var Name Prefix for uses */
  • $uses - /** @var UseUse[] Uses */

PhpParser\Node\Stmt\HaltCompiler

  • requires arguments on construct

Example PHP Code

__halt_compiler();remaining

Public Properties

  • $remaining - /** @var string Remaining text after halt compiler statement. */

PhpParser\Node\Stmt\If_

  • requires arguments on construct

Example PHP Code

if (true) {
}

Public Properties

  • $cond - /** @var Node\Expr Condition expression */
  • $stmts - /** @var Node\Stmt[] Statements */
  • $elseifs - /** @var ElseIf_[] Elseif clauses */
  • $else - /** @var null|Else_ Else clause */

PhpParser\Node\Stmt\InlineHTML

  • requires arguments on construct

Example PHP Code

?>
<strong>feel</strong><?php

Public Properties

  • $value - /** @var string String */

PhpParser\Node\Stmt\Interface_

  • requires arguments on construct

Example PHP Code

interface SomeInterface
{
}

Public Properties

  • $extends - /** @var Node\Name[] Extended interfaces */
  • $name - /** @var Node\Identifier|null Name */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Label

  • requires arguments on construct

Example PHP Code

label:

Public Properties

  • $name - /** @var Identifier Name */

PhpParser\Node\Stmt\Namespace_

Example PHP Code

namespace {
}

Public Properties

  • $name - /** @var null|Node\Name Name */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\Nop

Example PHP Code


PhpParser\Node\Stmt\Property

  • requires arguments on construct

Example PHP Code

var $property;

Public Properties

  • $flags - /** @var int Modifiers */
  • $props - /** @var PropertyProperty[] Properties */
  • $type - /** @var null|Identifier|Name|NullableType|UnionType Type declaration */

PhpParser\Node\Stmt\PropertyProperty

  • requires arguments on construct

Example PHP Code

$someProperty

Public Properties

  • $name - /** @var Node\VarLikeIdentifier Name */
  • $default - /** @var null|Node\Expr Default */

PhpParser\Node\Stmt\Return_

Example PHP Code

return;

Public Properties

  • $expr - /** @var null|Node\Expr Expression */

PhpParser\Node\Stmt\StaticVar

  • requires arguments on construct

Example PHP Code

$variable

Public Properties

  • $var - /** @var Expr\Variable Variable */
  • $default - /** @var null|Node\Expr Default value */

PhpParser\Node\Stmt\Static_

  • requires arguments on construct

Example PHP Code

static $static;

Public Properties

  • $vars - /** @var StaticVar[] Variable definitions */

PhpParser\Node\Stmt\Switch_

  • requires arguments on construct

Example PHP Code

switch ($variable) {
    case 1:
}

Public Properties

  • $cond - /** @var Node\Expr Condition */
  • $cases - /** @var Case_[] Case list */

PhpParser\Node\Stmt\Throw_

  • requires arguments on construct

Example PHP Code

throw new \SomeException();

Public Properties

  • $expr - /** @var Node\Expr Expression */

PhpParser\Node\Stmt\TraitUse

  • requires arguments on construct

Example PHP Code

use trait;

Public Properties

  • $traits - /** @var Node\Name[] Traits */
  • $adaptations - /** @var TraitUseAdaptation[] Adaptations */

PhpParser\Node\Stmt\TraitUseAdaptation\Alias

  • requires arguments on construct

Example PHP Code

SomeTrait::method as public aliasedMethod;

Public Properties

  • $newModifier - /** @var null|int New modifier */
  • $newName - /** @var null|Node\Identifier New name */
  • $trait - /** @var Node\Name|null Trait name */
  • $method - /** @var Node\Identifier Method name */

PhpParser\Node\Stmt\TraitUseAdaptation\Precedence

  • requires arguments on construct

Example PHP Code

SomeTrait::someMethod insteadof overriddenTrait;

Public Properties

  • $insteadof - /** @var Node\Name[] Overwritten traits */
  • $trait - /** @var Node\Name|null Trait name */
  • $method - /** @var Node\Identifier Method name */

PhpParser\Node\Stmt\Trait_

  • requires arguments on construct

Example PHP Code

trait TraitName
{
}

Public Properties

  • $name - /** @var Node\Identifier|null Name */
  • $stmts - /** @var Node\Stmt[] Statements */

PhpParser\Node\Stmt\TryCatch

  • requires arguments on construct

Example PHP Code

try {
    function someFunction()
    {
    }
} catch (\SomeType $someTypeException) {
}

Public Properties

  • $stmts - /** @var Node\Stmt[] Statements */
  • $catches - /** @var Catch_[] Catches */
  • $finally - /** @var null|Finally_ Optional finally node */

PhpParser\Node\Stmt\Unset_

  • requires arguments on construct

Example PHP Code

unset($variable);

Public Properties

  • $vars - /** @var Node\Expr[] Variables to unset */

PhpParser\Node\Stmt\UseUse

  • requires arguments on construct

Example PHP Code

UsedNamespace

Public Properties

  • $type - /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */
  • $name - /** @var Node\Name Namespace, class, function or constant to alias */
  • $alias - /** @var Identifier|null Alias */

PhpParser\Node\Stmt\Use_

  • requires arguments on construct

Example PHP Code

use UsedNamespace;

Public Properties

  • $type - /** @var int Type of alias */
  • $uses - /** @var UseUse[] Aliases */

PhpParser\Node\Stmt\While_

  • requires arguments on construct

Example PHP Code

while ($variable) {
}

Public Properties

  • $cond - /** @var Node\Expr Condition */
  • $stmts - /** @var Node\Stmt[] Statements */

Various

PhpParser\Node\Arg

  • requires arguments on construct

Example PHP Code

$someVariable

Public Properties

  • $value - /** @var Expr Value to pass */
  • $byRef - /** @var bool Whether to pass by ref */
  • $unpack - /** @var bool Whether to unpack the argument */

PhpParser\Node\Const_

  • requires arguments on construct

Example PHP Code

CONSTANT_NAME = 'default'

Public Properties

  • $name - /** @var Identifier Name */
  • $value - /** @var Expr Value */

PhpParser\Node\Identifier

  • requires arguments on construct

Example PHP Code

identifier

Public Properties

  • $name - /** @var string Identifier as string */
  • $specialClassNames - ``

PhpParser\Node\NullableType

  • requires arguments on construct

Example PHP Code

?SomeType

Public Properties

  • $type - /** @var Identifier|Name Type */

PhpParser\Node\Param

  • requires arguments on construct

Example PHP Code

$someVariable

Public Properties

  • $type - /** @var null|Identifier|Name|NullableType|UnionType Type declaration */
  • $byRef - /** @var bool Whether parameter is passed by reference */
  • $variadic - /** @var bool Whether this is a variadic argument */
  • $var - /** @var Expr\Variable|Expr\Error Parameter variable */
  • $default - /** @var null|Expr Default value */

PhpParser\Node\UnionType

  • requires arguments on construct

Example PHP Code

string|null

Public Properties

  • $types - /** @var (Identifier|Name)[] Types */