@@ -6,32 +6,32 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Const_ extends NodeAbstract |
| 8 | 8 | { |
| 9 | - /** @var Identifier Name */ |
|
| 10 | - public $name; |
|
| 11 | - /** @var Expr Value */ |
|
| 12 | - public $value; |
|
| 9 | + /** @var Identifier Name */ |
|
| 10 | + public $name; |
|
| 11 | + /** @var Expr Value */ |
|
| 12 | + public $value; |
|
| 13 | 13 | |
| 14 | - /** @var Name|null Namespaced name (if using NameResolver) */ |
|
| 15 | - public $namespacedName; |
|
| 14 | + /** @var Name|null Namespaced name (if using NameResolver) */ |
|
| 15 | + public $namespacedName; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Constructs a const node for use in class const and const statements. |
|
| 19 | - * |
|
| 20 | - * @param string|Identifier $name Name |
|
| 21 | - * @param Expr $value Value |
|
| 22 | - * @param array $attributes Additional attributes |
|
| 23 | - */ |
|
| 24 | - public function __construct($name, Expr $value, array $attributes = []) { |
|
| 25 | - $this->attributes = $attributes; |
|
| 26 | - $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
| 27 | - $this->value = $value; |
|
| 28 | - } |
|
| 17 | + /** |
|
| 18 | + * Constructs a const node for use in class const and const statements. |
|
| 19 | + * |
|
| 20 | + * @param string|Identifier $name Name |
|
| 21 | + * @param Expr $value Value |
|
| 22 | + * @param array $attributes Additional attributes |
|
| 23 | + */ |
|
| 24 | + public function __construct($name, Expr $value, array $attributes = []) { |
|
| 25 | + $this->attributes = $attributes; |
|
| 26 | + $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
| 27 | + $this->value = $value; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function getSubNodeNames() : array { |
|
| 31 | - return ['name', 'value']; |
|
| 32 | - } |
|
| 30 | + public function getSubNodeNames() : array { |
|
| 31 | + return ['name', 'value']; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function getType() : string { |
|
| 35 | - return 'Const'; |
|
| 36 | - } |
|
| 34 | + public function getType() : string { |
|
| 35 | + return 'Const'; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use PhpParser\NodeAbstract; |
| 6 | 6 | |
| 7 | -class Const_ extends NodeAbstract |
|
| 8 | -{ |
|
| 7 | +class Const_ extends NodeAbstract { |
|
| 9 | 8 | /** @var Identifier Name */ |
| 10 | 9 | public $name; |
| 11 | 10 | /** @var Expr Value */ |
@@ -4,25 +4,25 @@ |
||
| 4 | 4 | |
| 5 | 5 | class NullableType extends ComplexType |
| 6 | 6 | { |
| 7 | - /** @var Identifier|Name Type */ |
|
| 8 | - public $type; |
|
| 7 | + /** @var Identifier|Name Type */ |
|
| 8 | + public $type; |
|
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Constructs a nullable type (wrapping another type). |
|
| 12 | - * |
|
| 13 | - * @param string|Identifier|Name $type Type |
|
| 14 | - * @param array $attributes Additional attributes |
|
| 15 | - */ |
|
| 16 | - public function __construct($type, array $attributes = []) { |
|
| 17 | - $this->attributes = $attributes; |
|
| 18 | - $this->type = \is_string($type) ? new Identifier($type) : $type; |
|
| 19 | - } |
|
| 10 | + /** |
|
| 11 | + * Constructs a nullable type (wrapping another type). |
|
| 12 | + * |
|
| 13 | + * @param string|Identifier|Name $type Type |
|
| 14 | + * @param array $attributes Additional attributes |
|
| 15 | + */ |
|
| 16 | + public function __construct($type, array $attributes = []) { |
|
| 17 | + $this->attributes = $attributes; |
|
| 18 | + $this->type = \is_string($type) ? new Identifier($type) : $type; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function getSubNodeNames() : array { |
|
| 22 | - return ['type']; |
|
| 23 | - } |
|
| 21 | + public function getSubNodeNames() : array { |
|
| 22 | + return ['type']; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getType() : string { |
|
| 26 | - return 'NullableType'; |
|
| 27 | - } |
|
| 25 | + public function getType() : string { |
|
| 26 | + return 'NullableType'; |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -2,8 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PhpParser\Node; |
| 4 | 4 | |
| 5 | -class NullableType extends ComplexType |
|
| 6 | -{ |
|
| 5 | +class NullableType extends ComplexType { |
|
| 7 | 6 | /** @var Identifier|Name Type */ |
| 8 | 7 | public $type; |
| 9 | 8 | |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Break_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var null|Node\Expr Number of loops to break */ |
|
| 10 | - public $num; |
|
| 9 | + /** @var null|Node\Expr Number of loops to break */ |
|
| 10 | + public $num; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Constructs a break node. |
|
| 14 | - * |
|
| 15 | - * @param null|Node\Expr $num Number of loops to break |
|
| 16 | - * @param array $attributes Additional attributes |
|
| 17 | - */ |
|
| 18 | - public function __construct(?Node\Expr $num = null, array $attributes = []) { |
|
| 19 | - $this->attributes = $attributes; |
|
| 20 | - $this->num = $num; |
|
| 21 | - } |
|
| 12 | + /** |
|
| 13 | + * Constructs a break node. |
|
| 14 | + * |
|
| 15 | + * @param null|Node\Expr $num Number of loops to break |
|
| 16 | + * @param array $attributes Additional attributes |
|
| 17 | + */ |
|
| 18 | + public function __construct(?Node\Expr $num = null, array $attributes = []) { |
|
| 19 | + $this->attributes = $attributes; |
|
| 20 | + $this->num = $num; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getSubNodeNames() : array { |
|
| 24 | - return ['num']; |
|
| 25 | - } |
|
| 23 | + public function getSubNodeNames() : array { |
|
| 24 | + return ['num']; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getType() : string { |
|
| 28 | - return 'Stmt_Break'; |
|
| 29 | - } |
|
| 27 | + public function getType() : string { |
|
| 28 | + return 'Stmt_Break'; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -7,71 +7,71 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Function_ extends Node\Stmt implements FunctionLike |
| 9 | 9 | { |
| 10 | - /** @var bool Whether function returns by reference */ |
|
| 11 | - public $byRef; |
|
| 12 | - /** @var Node\Identifier Name */ |
|
| 13 | - public $name; |
|
| 14 | - /** @var Node\Param[] Parameters */ |
|
| 15 | - public $params; |
|
| 16 | - /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ |
|
| 17 | - public $returnType; |
|
| 18 | - /** @var Node\Stmt[] Statements */ |
|
| 19 | - public $stmts; |
|
| 20 | - /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 21 | - public $attrGroups; |
|
| 10 | + /** @var bool Whether function returns by reference */ |
|
| 11 | + public $byRef; |
|
| 12 | + /** @var Node\Identifier Name */ |
|
| 13 | + public $name; |
|
| 14 | + /** @var Node\Param[] Parameters */ |
|
| 15 | + public $params; |
|
| 16 | + /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ |
|
| 17 | + public $returnType; |
|
| 18 | + /** @var Node\Stmt[] Statements */ |
|
| 19 | + public $stmts; |
|
| 20 | + /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 21 | + public $attrGroups; |
|
| 22 | 22 | |
| 23 | - /** @var Node\Name|null Namespaced name (if using NameResolver) */ |
|
| 24 | - public $namespacedName; |
|
| 23 | + /** @var Node\Name|null Namespaced name (if using NameResolver) */ |
|
| 24 | + public $namespacedName; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructs a function node. |
|
| 28 | - * |
|
| 29 | - * @param string|Node\Identifier $name Name |
|
| 30 | - * @param array $subNodes Array of the following optional subnodes: |
|
| 31 | - * 'byRef' => false : Whether to return by reference |
|
| 32 | - * 'params' => array(): Parameters |
|
| 33 | - * 'returnType' => null : Return type |
|
| 34 | - * 'stmts' => array(): Statements |
|
| 35 | - * 'attrGroups' => array(): PHP attribute groups |
|
| 36 | - * @param array $attributes Additional attributes |
|
| 37 | - */ |
|
| 38 | - public function __construct($name, array $subNodes = [], array $attributes = []) { |
|
| 39 | - $this->attributes = $attributes; |
|
| 40 | - $this->byRef = $subNodes['byRef'] ?? false; |
|
| 41 | - $this->name = \is_string($name) ? new Node\Identifier($name) : $name; |
|
| 42 | - $this->params = $subNodes['params'] ?? []; |
|
| 43 | - $returnType = $subNodes['returnType'] ?? null; |
|
| 44 | - $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; |
|
| 45 | - $this->stmts = $subNodes['stmts'] ?? []; |
|
| 46 | - $this->attrGroups = $subNodes['attrGroups'] ?? []; |
|
| 47 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructs a function node. |
|
| 28 | + * |
|
| 29 | + * @param string|Node\Identifier $name Name |
|
| 30 | + * @param array $subNodes Array of the following optional subnodes: |
|
| 31 | + * 'byRef' => false : Whether to return by reference |
|
| 32 | + * 'params' => array(): Parameters |
|
| 33 | + * 'returnType' => null : Return type |
|
| 34 | + * 'stmts' => array(): Statements |
|
| 35 | + * 'attrGroups' => array(): PHP attribute groups |
|
| 36 | + * @param array $attributes Additional attributes |
|
| 37 | + */ |
|
| 38 | + public function __construct($name, array $subNodes = [], array $attributes = []) { |
|
| 39 | + $this->attributes = $attributes; |
|
| 40 | + $this->byRef = $subNodes['byRef'] ?? false; |
|
| 41 | + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; |
|
| 42 | + $this->params = $subNodes['params'] ?? []; |
|
| 43 | + $returnType = $subNodes['returnType'] ?? null; |
|
| 44 | + $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; |
|
| 45 | + $this->stmts = $subNodes['stmts'] ?? []; |
|
| 46 | + $this->attrGroups = $subNodes['attrGroups'] ?? []; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function getSubNodeNames() : array { |
|
| 50 | - return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; |
|
| 51 | - } |
|
| 49 | + public function getSubNodeNames() : array { |
|
| 50 | + return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function returnsByRef() : bool { |
|
| 54 | - return $this->byRef; |
|
| 55 | - } |
|
| 53 | + public function returnsByRef() : bool { |
|
| 54 | + return $this->byRef; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function getParams() : array { |
|
| 58 | - return $this->params; |
|
| 59 | - } |
|
| 57 | + public function getParams() : array { |
|
| 58 | + return $this->params; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function getReturnType() { |
|
| 62 | - return $this->returnType; |
|
| 63 | - } |
|
| 61 | + public function getReturnType() { |
|
| 62 | + return $this->returnType; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function getAttrGroups() : array { |
|
| 66 | - return $this->attrGroups; |
|
| 67 | - } |
|
| 65 | + public function getAttrGroups() : array { |
|
| 66 | + return $this->attrGroups; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** @return Node\Stmt[] */ |
|
| 70 | - public function getStmts() : array { |
|
| 71 | - return $this->stmts; |
|
| 72 | - } |
|
| 69 | + /** @return Node\Stmt[] */ |
|
| 70 | + public function getStmts() : array { |
|
| 71 | + return $this->stmts; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public function getType() : string { |
|
| 75 | - return 'Stmt_Function'; |
|
| 76 | - } |
|
| 74 | + public function getType() : string { |
|
| 75 | + return 'Stmt_Function'; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Continue_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var null|Node\Expr Number of loops to continue */ |
|
| 10 | - public $num; |
|
| 9 | + /** @var null|Node\Expr Number of loops to continue */ |
|
| 10 | + public $num; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Constructs a continue node. |
|
| 14 | - * |
|
| 15 | - * @param null|Node\Expr $num Number of loops to continue |
|
| 16 | - * @param array $attributes Additional attributes |
|
| 17 | - */ |
|
| 18 | - public function __construct(?Node\Expr $num = null, array $attributes = []) { |
|
| 19 | - $this->attributes = $attributes; |
|
| 20 | - $this->num = $num; |
|
| 21 | - } |
|
| 12 | + /** |
|
| 13 | + * Constructs a continue node. |
|
| 14 | + * |
|
| 15 | + * @param null|Node\Expr $num Number of loops to continue |
|
| 16 | + * @param array $attributes Additional attributes |
|
| 17 | + */ |
|
| 18 | + public function __construct(?Node\Expr $num = null, array $attributes = []) { |
|
| 19 | + $this->attributes = $attributes; |
|
| 20 | + $this->num = $num; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getSubNodeNames() : array { |
|
| 24 | - return ['num']; |
|
| 25 | - } |
|
| 23 | + public function getSubNodeNames() : array { |
|
| 24 | + return ['num']; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getType() : string { |
|
| 28 | - return 'Stmt_Continue'; |
|
| 29 | - } |
|
| 27 | + public function getType() : string { |
|
| 28 | + return 'Stmt_Continue'; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,104 +6,104 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class ClassLike extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\Identifier|null Name */ |
|
| 10 | - public $name; |
|
| 11 | - /** @var Node\Stmt[] Statements */ |
|
| 12 | - public $stmts; |
|
| 13 | - /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 14 | - public $attrGroups; |
|
| 9 | + /** @var Node\Identifier|null Name */ |
|
| 10 | + public $name; |
|
| 11 | + /** @var Node\Stmt[] Statements */ |
|
| 12 | + public $stmts; |
|
| 13 | + /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 14 | + public $attrGroups; |
|
| 15 | 15 | |
| 16 | - /** @var Node\Name|null Namespaced name (if using NameResolver) */ |
|
| 17 | - public $namespacedName; |
|
| 16 | + /** @var Node\Name|null Namespaced name (if using NameResolver) */ |
|
| 17 | + public $namespacedName; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @return TraitUse[] |
|
| 21 | - */ |
|
| 22 | - public function getTraitUses() : array { |
|
| 23 | - $traitUses = []; |
|
| 24 | - foreach ($this->stmts as $stmt) { |
|
| 25 | - if ($stmt instanceof TraitUse) { |
|
| 26 | - $traitUses[] = $stmt; |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | - return $traitUses; |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * @return TraitUse[] |
|
| 21 | + */ |
|
| 22 | + public function getTraitUses() : array { |
|
| 23 | + $traitUses = []; |
|
| 24 | + foreach ($this->stmts as $stmt) { |
|
| 25 | + if ($stmt instanceof TraitUse) { |
|
| 26 | + $traitUses[] = $stmt; |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | + return $traitUses; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return ClassConst[] |
|
| 34 | - */ |
|
| 35 | - public function getConstants() : array { |
|
| 36 | - $constants = []; |
|
| 37 | - foreach ($this->stmts as $stmt) { |
|
| 38 | - if ($stmt instanceof ClassConst) { |
|
| 39 | - $constants[] = $stmt; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - return $constants; |
|
| 43 | - } |
|
| 32 | + /** |
|
| 33 | + * @return ClassConst[] |
|
| 34 | + */ |
|
| 35 | + public function getConstants() : array { |
|
| 36 | + $constants = []; |
|
| 37 | + foreach ($this->stmts as $stmt) { |
|
| 38 | + if ($stmt instanceof ClassConst) { |
|
| 39 | + $constants[] = $stmt; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + return $constants; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @return Property[] |
|
| 47 | - */ |
|
| 48 | - public function getProperties() : array { |
|
| 49 | - $properties = []; |
|
| 50 | - foreach ($this->stmts as $stmt) { |
|
| 51 | - if ($stmt instanceof Property) { |
|
| 52 | - $properties[] = $stmt; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - return $properties; |
|
| 56 | - } |
|
| 45 | + /** |
|
| 46 | + * @return Property[] |
|
| 47 | + */ |
|
| 48 | + public function getProperties() : array { |
|
| 49 | + $properties = []; |
|
| 50 | + foreach ($this->stmts as $stmt) { |
|
| 51 | + if ($stmt instanceof Property) { |
|
| 52 | + $properties[] = $stmt; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + return $properties; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Gets property with the given name defined directly in this class/interface/trait. |
|
| 60 | - * |
|
| 61 | - * @param string $name Name of the property |
|
| 62 | - * |
|
| 63 | - * @return Property|null Property node or null if the property does not exist |
|
| 64 | - */ |
|
| 65 | - public function getProperty(string $name) { |
|
| 66 | - foreach ($this->stmts as $stmt) { |
|
| 67 | - if ($stmt instanceof Property) { |
|
| 68 | - foreach ($stmt->props as $prop) { |
|
| 69 | - if ($prop instanceof PropertyProperty && $name === $prop->name->toString()) { |
|
| 70 | - return $stmt; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - return null; |
|
| 76 | - } |
|
| 58 | + /** |
|
| 59 | + * Gets property with the given name defined directly in this class/interface/trait. |
|
| 60 | + * |
|
| 61 | + * @param string $name Name of the property |
|
| 62 | + * |
|
| 63 | + * @return Property|null Property node or null if the property does not exist |
|
| 64 | + */ |
|
| 65 | + public function getProperty(string $name) { |
|
| 66 | + foreach ($this->stmts as $stmt) { |
|
| 67 | + if ($stmt instanceof Property) { |
|
| 68 | + foreach ($stmt->props as $prop) { |
|
| 69 | + if ($prop instanceof PropertyProperty && $name === $prop->name->toString()) { |
|
| 70 | + return $stmt; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + return null; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Gets all methods defined directly in this class/interface/trait |
|
| 80 | - * |
|
| 81 | - * @return ClassMethod[] |
|
| 82 | - */ |
|
| 83 | - public function getMethods() : array { |
|
| 84 | - $methods = []; |
|
| 85 | - foreach ($this->stmts as $stmt) { |
|
| 86 | - if ($stmt instanceof ClassMethod) { |
|
| 87 | - $methods[] = $stmt; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - return $methods; |
|
| 91 | - } |
|
| 78 | + /** |
|
| 79 | + * Gets all methods defined directly in this class/interface/trait |
|
| 80 | + * |
|
| 81 | + * @return ClassMethod[] |
|
| 82 | + */ |
|
| 83 | + public function getMethods() : array { |
|
| 84 | + $methods = []; |
|
| 85 | + foreach ($this->stmts as $stmt) { |
|
| 86 | + if ($stmt instanceof ClassMethod) { |
|
| 87 | + $methods[] = $stmt; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + return $methods; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Gets method with the given name defined directly in this class/interface/trait. |
|
| 95 | - * |
|
| 96 | - * @param string $name Name of the method (compared case-insensitively) |
|
| 97 | - * |
|
| 98 | - * @return ClassMethod|null Method node or null if the method does not exist |
|
| 99 | - */ |
|
| 100 | - public function getMethod(string $name) { |
|
| 101 | - $lowerName = strtolower($name); |
|
| 102 | - foreach ($this->stmts as $stmt) { |
|
| 103 | - if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { |
|
| 104 | - return $stmt; |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - return null; |
|
| 108 | - } |
|
| 93 | + /** |
|
| 94 | + * Gets method with the given name defined directly in this class/interface/trait. |
|
| 95 | + * |
|
| 96 | + * @param string $name Name of the method (compared case-insensitively) |
|
| 97 | + * |
|
| 98 | + * @return ClassMethod|null Method node or null if the method does not exist |
|
| 99 | + */ |
|
| 100 | + public function getMethod(string $name) { |
|
| 101 | + $lowerName = strtolower($name); |
|
| 102 | + foreach ($this->stmts as $stmt) { |
|
| 103 | + if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { |
|
| 104 | + return $stmt; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + return null; |
|
| 108 | + } |
|
| 109 | 109 | } |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Const_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\Const_[] Constant declarations */ |
|
| 10 | - public $consts; |
|
| 9 | + /** @var Node\Const_[] Constant declarations */ |
|
| 10 | + public $consts; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Constructs a const list node. |
|
| 14 | - * |
|
| 15 | - * @param Node\Const_[] $consts Constant declarations |
|
| 16 | - * @param array $attributes Additional attributes |
|
| 17 | - */ |
|
| 18 | - public function __construct(array $consts, array $attributes = []) { |
|
| 19 | - $this->attributes = $attributes; |
|
| 20 | - $this->consts = $consts; |
|
| 21 | - } |
|
| 12 | + /** |
|
| 13 | + * Constructs a const list node. |
|
| 14 | + * |
|
| 15 | + * @param Node\Const_[] $consts Constant declarations |
|
| 16 | + * @param array $attributes Additional attributes |
|
| 17 | + */ |
|
| 18 | + public function __construct(array $consts, array $attributes = []) { |
|
| 19 | + $this->attributes = $attributes; |
|
| 20 | + $this->consts = $consts; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getSubNodeNames() : array { |
|
| 24 | - return ['consts']; |
|
| 25 | - } |
|
| 23 | + public function getSubNodeNames() : array { |
|
| 24 | + return ['consts']; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getType() : string { |
|
| 28 | - return 'Stmt_Const'; |
|
| 29 | - } |
|
| 27 | + public function getType() : string { |
|
| 28 | + return 'Stmt_Const'; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Echo_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\Expr[] Expressions */ |
|
| 10 | - public $exprs; |
|
| 9 | + /** @var Node\Expr[] Expressions */ |
|
| 10 | + public $exprs; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Constructs an echo node. |
|
| 14 | - * |
|
| 15 | - * @param Node\Expr[] $exprs Expressions |
|
| 16 | - * @param array $attributes Additional attributes |
|
| 17 | - */ |
|
| 18 | - public function __construct(array $exprs, array $attributes = []) { |
|
| 19 | - $this->attributes = $attributes; |
|
| 20 | - $this->exprs = $exprs; |
|
| 21 | - } |
|
| 12 | + /** |
|
| 13 | + * Constructs an echo node. |
|
| 14 | + * |
|
| 15 | + * @param Node\Expr[] $exprs Expressions |
|
| 16 | + * @param array $attributes Additional attributes |
|
| 17 | + */ |
|
| 18 | + public function __construct(array $exprs, array $attributes = []) { |
|
| 19 | + $this->attributes = $attributes; |
|
| 20 | + $this->exprs = $exprs; |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getSubNodeNames() : array { |
|
| 24 | - return ['exprs']; |
|
| 25 | - } |
|
| 23 | + public function getSubNodeNames() : array { |
|
| 24 | + return ['exprs']; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getType() : string { |
|
| 28 | - return 'Stmt_Echo'; |
|
| 29 | - } |
|
| 27 | + public function getType() : string { |
|
| 28 | + return 'Stmt_Echo'; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,32 +6,32 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Interface_ extends ClassLike |
| 8 | 8 | { |
| 9 | - /** @var Node\Name[] Extended interfaces */ |
|
| 10 | - public $extends; |
|
| 9 | + /** @var Node\Name[] Extended interfaces */ |
|
| 10 | + public $extends; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Constructs a class node. |
|
| 14 | - * |
|
| 15 | - * @param string|Node\Identifier $name Name |
|
| 16 | - * @param array $subNodes Array of the following optional subnodes: |
|
| 17 | - * 'extends' => array(): Name of extended interfaces |
|
| 18 | - * 'stmts' => array(): Statements |
|
| 19 | - * 'attrGroups' => array(): PHP attribute groups |
|
| 20 | - * @param array $attributes Additional attributes |
|
| 21 | - */ |
|
| 22 | - public function __construct($name, array $subNodes = [], array $attributes = []) { |
|
| 23 | - $this->attributes = $attributes; |
|
| 24 | - $this->name = \is_string($name) ? new Node\Identifier($name) : $name; |
|
| 25 | - $this->extends = $subNodes['extends'] ?? []; |
|
| 26 | - $this->stmts = $subNodes['stmts'] ?? []; |
|
| 27 | - $this->attrGroups = $subNodes['attrGroups'] ?? []; |
|
| 28 | - } |
|
| 12 | + /** |
|
| 13 | + * Constructs a class node. |
|
| 14 | + * |
|
| 15 | + * @param string|Node\Identifier $name Name |
|
| 16 | + * @param array $subNodes Array of the following optional subnodes: |
|
| 17 | + * 'extends' => array(): Name of extended interfaces |
|
| 18 | + * 'stmts' => array(): Statements |
|
| 19 | + * 'attrGroups' => array(): PHP attribute groups |
|
| 20 | + * @param array $attributes Additional attributes |
|
| 21 | + */ |
|
| 22 | + public function __construct($name, array $subNodes = [], array $attributes = []) { |
|
| 23 | + $this->attributes = $attributes; |
|
| 24 | + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; |
|
| 25 | + $this->extends = $subNodes['extends'] ?? []; |
|
| 26 | + $this->stmts = $subNodes['stmts'] ?? []; |
|
| 27 | + $this->attrGroups = $subNodes['attrGroups'] ?? []; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function getSubNodeNames() : array { |
|
| 31 | - return ['attrGroups', 'name', 'extends', 'stmts']; |
|
| 32 | - } |
|
| 30 | + public function getSubNodeNames() : array { |
|
| 31 | + return ['attrGroups', 'name', 'extends', 'stmts']; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function getType() : string { |
|
| 35 | - return 'Stmt_Interface'; |
|
| 36 | - } |
|
| 34 | + public function getType() : string { |
|
| 35 | + return 'Stmt_Interface'; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use PhpParser\Node; |
| 6 | 6 | |
| 7 | -class Interface_ extends ClassLike |
|
| 8 | -{ |
|
| 7 | +class Interface_ extends ClassLike { |
|
| 9 | 8 | /** @var Node\Name[] Extended interfaces */ |
| 10 | 9 | public $extends; |
| 11 | 10 | |