@@ -6,33 +6,33 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Namespace_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /* For use in the "kind" attribute */ |
|
| 10 | - const KIND_SEMICOLON = 1; |
|
| 11 | - const KIND_BRACED = 2; |
|
| 9 | + /* For use in the "kind" attribute */ |
|
| 10 | + const KIND_SEMICOLON = 1; |
|
| 11 | + const KIND_BRACED = 2; |
|
| 12 | 12 | |
| 13 | - /** @var null|Node\Name Name */ |
|
| 14 | - public $name; |
|
| 15 | - /** @var Node\Stmt[] Statements */ |
|
| 16 | - public $stmts; |
|
| 13 | + /** @var null|Node\Name Name */ |
|
| 14 | + public $name; |
|
| 15 | + /** @var Node\Stmt[] Statements */ |
|
| 16 | + public $stmts; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructs a namespace node. |
|
| 20 | - * |
|
| 21 | - * @param null|Node\Name $name Name |
|
| 22 | - * @param null|Node\Stmt[] $stmts Statements |
|
| 23 | - * @param array $attributes Additional attributes |
|
| 24 | - */ |
|
| 25 | - public function __construct(?Node\Name $name = null, $stmts = [], array $attributes = []) { |
|
| 26 | - $this->attributes = $attributes; |
|
| 27 | - $this->name = $name; |
|
| 28 | - $this->stmts = $stmts; |
|
| 29 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructs a namespace node. |
|
| 20 | + * |
|
| 21 | + * @param null|Node\Name $name Name |
|
| 22 | + * @param null|Node\Stmt[] $stmts Statements |
|
| 23 | + * @param array $attributes Additional attributes |
|
| 24 | + */ |
|
| 25 | + public function __construct(?Node\Name $name = null, $stmts = [], array $attributes = []) { |
|
| 26 | + $this->attributes = $attributes; |
|
| 27 | + $this->name = $name; |
|
| 28 | + $this->stmts = $stmts; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function getSubNodeNames() : array { |
|
| 32 | - return ['name', 'stmts']; |
|
| 33 | - } |
|
| 31 | + public function getSubNodeNames() : array { |
|
| 32 | + return ['name', 'stmts']; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function getType() : string { |
|
| 36 | - return 'Stmt_Namespace'; |
|
| 37 | - } |
|
| 35 | + public function getType() : string { |
|
| 36 | + return 'Stmt_Namespace'; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Switch_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\Expr Condition */ |
|
| 10 | - public $cond; |
|
| 11 | - /** @var Case_[] Case list */ |
|
| 12 | - public $cases; |
|
| 9 | + /** @var Node\Expr Condition */ |
|
| 10 | + public $cond; |
|
| 11 | + /** @var Case_[] Case list */ |
|
| 12 | + public $cases; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Constructs a case node. |
|
| 16 | - * |
|
| 17 | - * @param Node\Expr $cond Condition |
|
| 18 | - * @param Case_[] $cases Case list |
|
| 19 | - * @param array $attributes Additional attributes |
|
| 20 | - */ |
|
| 21 | - public function __construct(Node\Expr $cond, array $cases, array $attributes = []) { |
|
| 22 | - $this->attributes = $attributes; |
|
| 23 | - $this->cond = $cond; |
|
| 24 | - $this->cases = $cases; |
|
| 25 | - } |
|
| 14 | + /** |
|
| 15 | + * Constructs a case node. |
|
| 16 | + * |
|
| 17 | + * @param Node\Expr $cond Condition |
|
| 18 | + * @param Case_[] $cases Case list |
|
| 19 | + * @param array $attributes Additional attributes |
|
| 20 | + */ |
|
| 21 | + public function __construct(Node\Expr $cond, array $cases, array $attributes = []) { |
|
| 22 | + $this->attributes = $attributes; |
|
| 23 | + $this->cond = $cond; |
|
| 24 | + $this->cases = $cases; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getSubNodeNames() : array { |
|
| 28 | - return ['cond', 'cases']; |
|
| 29 | - } |
|
| 27 | + public function getSubNodeNames() : array { |
|
| 28 | + return ['cond', 'cases']; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function getType() : string { |
|
| 32 | - return 'Stmt_Switch'; |
|
| 33 | - } |
|
| 31 | + public function getType() : string { |
|
| 32 | + return 'Stmt_Switch'; |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | |
| 7 | 7 | class PropertyProperty extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\VarLikeIdentifier Name */ |
|
| 10 | - public $name; |
|
| 11 | - /** @var null|Node\Expr Default */ |
|
| 12 | - public $default; |
|
| 9 | + /** @var Node\VarLikeIdentifier Name */ |
|
| 10 | + public $name; |
|
| 11 | + /** @var null|Node\Expr Default */ |
|
| 12 | + public $default; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Constructs a class property node. |
|
| 16 | - * |
|
| 17 | - * @param string|Node\VarLikeIdentifier $name Name |
|
| 18 | - * @param null|Node\Expr $default Default value |
|
| 19 | - * @param array $attributes Additional attributes |
|
| 20 | - */ |
|
| 21 | - public function __construct($name, ?Node\Expr $default = null, array $attributes = []) { |
|
| 22 | - $this->attributes = $attributes; |
|
| 23 | - $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; |
|
| 24 | - $this->default = $default; |
|
| 25 | - } |
|
| 14 | + /** |
|
| 15 | + * Constructs a class property node. |
|
| 16 | + * |
|
| 17 | + * @param string|Node\VarLikeIdentifier $name Name |
|
| 18 | + * @param null|Node\Expr $default Default value |
|
| 19 | + * @param array $attributes Additional attributes |
|
| 20 | + */ |
|
| 21 | + public function __construct($name, ?Node\Expr $default = null, array $attributes = []) { |
|
| 22 | + $this->attributes = $attributes; |
|
| 23 | + $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; |
|
| 24 | + $this->default = $default; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function getSubNodeNames() : array { |
|
| 28 | - return ['name', 'default']; |
|
| 29 | - } |
|
| 27 | + public function getSubNodeNames() : array { |
|
| 28 | + return ['name', 'default']; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function getType() : string { |
|
| 32 | - return 'Stmt_PropertyProperty'; |
|
| 33 | - } |
|
| 31 | + public function getType() : string { |
|
| 32 | + return 'Stmt_PropertyProperty'; |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -7,35 +7,35 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Catch_ extends Node\Stmt |
| 9 | 9 | { |
| 10 | - /** @var Node\Name[] Types of exceptions to catch */ |
|
| 11 | - public $types; |
|
| 12 | - /** @var Expr\Variable|null Variable for exception */ |
|
| 13 | - public $var; |
|
| 14 | - /** @var Node\Stmt[] Statements */ |
|
| 15 | - public $stmts; |
|
| 10 | + /** @var Node\Name[] Types of exceptions to catch */ |
|
| 11 | + public $types; |
|
| 12 | + /** @var Expr\Variable|null Variable for exception */ |
|
| 13 | + public $var; |
|
| 14 | + /** @var Node\Stmt[] Statements */ |
|
| 15 | + public $stmts; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Constructs a catch node. |
|
| 19 | - * |
|
| 20 | - * @param Node\Name[] $types Types of exceptions to catch |
|
| 21 | - * @param Expr\Variable|null $var Variable for exception |
|
| 22 | - * @param Node\Stmt[] $stmts Statements |
|
| 23 | - * @param array $attributes Additional attributes |
|
| 24 | - */ |
|
| 25 | - public function __construct( |
|
| 26 | - array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = [] |
|
| 27 | - ) { |
|
| 28 | - $this->attributes = $attributes; |
|
| 29 | - $this->types = $types; |
|
| 30 | - $this->var = $var; |
|
| 31 | - $this->stmts = $stmts; |
|
| 32 | - } |
|
| 17 | + /** |
|
| 18 | + * Constructs a catch node. |
|
| 19 | + * |
|
| 20 | + * @param Node\Name[] $types Types of exceptions to catch |
|
| 21 | + * @param Expr\Variable|null $var Variable for exception |
|
| 22 | + * @param Node\Stmt[] $stmts Statements |
|
| 23 | + * @param array $attributes Additional attributes |
|
| 24 | + */ |
|
| 25 | + public function __construct( |
|
| 26 | + array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = [] |
|
| 27 | + ) { |
|
| 28 | + $this->attributes = $attributes; |
|
| 29 | + $this->types = $types; |
|
| 30 | + $this->var = $var; |
|
| 31 | + $this->stmts = $stmts; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function getSubNodeNames() : array { |
|
| 35 | - return ['types', 'var', 'stmts']; |
|
| 36 | - } |
|
| 34 | + public function getSubNodeNames() : array { |
|
| 35 | + return ['types', 'var', 'stmts']; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function getType() : string { |
|
| 39 | - return 'Stmt_Catch'; |
|
| 40 | - } |
|
| 38 | + public function getType() : string { |
|
| 39 | + return 'Stmt_Catch'; |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -7,25 +7,25 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Goto_ extends Stmt |
| 9 | 9 | { |
| 10 | - /** @var Identifier Name of label to jump to */ |
|
| 11 | - public $name; |
|
| 10 | + /** @var Identifier Name of label to jump to */ |
|
| 11 | + public $name; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Constructs a goto node. |
|
| 15 | - * |
|
| 16 | - * @param string|Identifier $name Name of label to jump to |
|
| 17 | - * @param array $attributes Additional attributes |
|
| 18 | - */ |
|
| 19 | - public function __construct($name, array $attributes = []) { |
|
| 20 | - $this->attributes = $attributes; |
|
| 21 | - $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
| 22 | - } |
|
| 13 | + /** |
|
| 14 | + * Constructs a goto node. |
|
| 15 | + * |
|
| 16 | + * @param string|Identifier $name Name of label to jump to |
|
| 17 | + * @param array $attributes Additional attributes |
|
| 18 | + */ |
|
| 19 | + public function __construct($name, array $attributes = []) { |
|
| 20 | + $this->attributes = $attributes; |
|
| 21 | + $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function getSubNodeNames() : array { |
|
| 25 | - return ['name']; |
|
| 26 | - } |
|
| 24 | + public function getSubNodeNames() : array { |
|
| 25 | + return ['name']; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function getType() : string { |
|
| 29 | - return 'Stmt_Goto'; |
|
| 30 | - } |
|
| 28 | + public function getType() : string { |
|
| 29 | + return 'Stmt_Goto'; |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -5,8 +5,7 @@ |
||
| 5 | 5 | use PhpParser\Node\Identifier; |
| 6 | 6 | use PhpParser\Node\Stmt; |
| 7 | 7 | |
| 8 | -class Goto_ extends Stmt |
|
| 9 | -{ |
|
| 8 | +class Goto_ extends Stmt { |
|
| 10 | 9 | /** @var Identifier Name of label to jump to */ |
| 11 | 10 | public $name; |
| 12 | 11 | |
@@ -6,80 +6,80 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClassConst extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var int Modifiers */ |
|
| 10 | - public $flags; |
|
| 11 | - /** @var Node\Const_[] Constant declarations */ |
|
| 12 | - public $consts; |
|
| 13 | - /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 14 | - public $attrGroups; |
|
| 15 | - /** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */ |
|
| 16 | - public $type; |
|
| 9 | + /** @var int Modifiers */ |
|
| 10 | + public $flags; |
|
| 11 | + /** @var Node\Const_[] Constant declarations */ |
|
| 12 | + public $consts; |
|
| 13 | + /** @var Node\AttributeGroup[] PHP attribute groups */ |
|
| 14 | + public $attrGroups; |
|
| 15 | + /** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */ |
|
| 16 | + public $type; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructs a class const list node. |
|
| 20 | - * |
|
| 21 | - * @param Node\Const_[] $consts Constant declarations |
|
| 22 | - * @param int $flags Modifiers |
|
| 23 | - * @param array $attributes Additional attributes |
|
| 24 | - * @param Node\AttributeGroup[] $attrGroups PHP attribute groups |
|
| 25 | - * @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration |
|
| 26 | - */ |
|
| 27 | - public function __construct( |
|
| 28 | - array $consts, |
|
| 29 | - int $flags = 0, |
|
| 30 | - array $attributes = [], |
|
| 31 | - array $attrGroups = [], |
|
| 32 | - $type = null |
|
| 33 | - ) { |
|
| 34 | - $this->attributes = $attributes; |
|
| 35 | - $this->flags = $flags; |
|
| 36 | - $this->consts = $consts; |
|
| 37 | - $this->attrGroups = $attrGroups; |
|
| 38 | - $this->type = \is_string($type) ? new Node\Identifier($type) : $type; |
|
| 39 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructs a class const list node. |
|
| 20 | + * |
|
| 21 | + * @param Node\Const_[] $consts Constant declarations |
|
| 22 | + * @param int $flags Modifiers |
|
| 23 | + * @param array $attributes Additional attributes |
|
| 24 | + * @param Node\AttributeGroup[] $attrGroups PHP attribute groups |
|
| 25 | + * @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration |
|
| 26 | + */ |
|
| 27 | + public function __construct( |
|
| 28 | + array $consts, |
|
| 29 | + int $flags = 0, |
|
| 30 | + array $attributes = [], |
|
| 31 | + array $attrGroups = [], |
|
| 32 | + $type = null |
|
| 33 | + ) { |
|
| 34 | + $this->attributes = $attributes; |
|
| 35 | + $this->flags = $flags; |
|
| 36 | + $this->consts = $consts; |
|
| 37 | + $this->attrGroups = $attrGroups; |
|
| 38 | + $this->type = \is_string($type) ? new Node\Identifier($type) : $type; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function getSubNodeNames() : array { |
|
| 42 | - return ['attrGroups', 'flags', 'type', 'consts']; |
|
| 43 | - } |
|
| 41 | + public function getSubNodeNames() : array { |
|
| 42 | + return ['attrGroups', 'flags', 'type', 'consts']; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Whether constant is explicitly or implicitly public. |
|
| 47 | - * |
|
| 48 | - * @return bool |
|
| 49 | - */ |
|
| 50 | - public function isPublic() : bool { |
|
| 51 | - return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 |
|
| 52 | - || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Whether constant is explicitly or implicitly public. |
|
| 47 | + * |
|
| 48 | + * @return bool |
|
| 49 | + */ |
|
| 50 | + public function isPublic() : bool { |
|
| 51 | + return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 |
|
| 52 | + || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Whether constant is protected. |
|
| 57 | - * |
|
| 58 | - * @return bool |
|
| 59 | - */ |
|
| 60 | - public function isProtected() : bool { |
|
| 61 | - return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
|
| 62 | - } |
|
| 55 | + /** |
|
| 56 | + * Whether constant is protected. |
|
| 57 | + * |
|
| 58 | + * @return bool |
|
| 59 | + */ |
|
| 60 | + public function isProtected() : bool { |
|
| 61 | + return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Whether constant is private. |
|
| 66 | - * |
|
| 67 | - * @return bool |
|
| 68 | - */ |
|
| 69 | - public function isPrivate() : bool { |
|
| 70 | - return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
|
| 71 | - } |
|
| 64 | + /** |
|
| 65 | + * Whether constant is private. |
|
| 66 | + * |
|
| 67 | + * @return bool |
|
| 68 | + */ |
|
| 69 | + public function isPrivate() : bool { |
|
| 70 | + return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Whether constant is final. |
|
| 75 | - * |
|
| 76 | - * @return bool |
|
| 77 | - */ |
|
| 78 | - public function isFinal() : bool { |
|
| 79 | - return (bool) ($this->flags & Class_::MODIFIER_FINAL); |
|
| 80 | - } |
|
| 73 | + /** |
|
| 74 | + * Whether constant is final. |
|
| 75 | + * |
|
| 76 | + * @return bool |
|
| 77 | + */ |
|
| 78 | + public function isFinal() : bool { |
|
| 79 | + return (bool) ($this->flags & Class_::MODIFIER_FINAL); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - public function getType() : string { |
|
| 83 | - return 'Stmt_ClassConst'; |
|
| 84 | - } |
|
| 82 | + public function getType() : string { |
|
| 83 | + return 'Stmt_ClassConst'; |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | 60 | public function isProtected() : bool { |
| 61 | - return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
|
| 61 | + return (bool)($this->flags & Class_::MODIFIER_PROTECTED); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return bool |
| 68 | 68 | */ |
| 69 | 69 | public function isPrivate() : bool { |
| 70 | - return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
|
| 70 | + return (bool)($this->flags & Class_::MODIFIER_PRIVATE); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @return bool |
| 77 | 77 | */ |
| 78 | 78 | public function isFinal() : bool { |
| 79 | - return (bool) ($this->flags & Class_::MODIFIER_FINAL); |
|
| 79 | + return (bool)($this->flags & Class_::MODIFIER_FINAL); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function getType() : string { |
@@ -7,46 +7,46 @@ |
||
| 7 | 7 | |
| 8 | 8 | class UseUse extends Node\Stmt |
| 9 | 9 | { |
| 10 | - /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ |
|
| 11 | - public $type; |
|
| 12 | - /** @var Node\Name Namespace, class, function or constant to alias */ |
|
| 13 | - public $name; |
|
| 14 | - /** @var Identifier|null Alias */ |
|
| 15 | - public $alias; |
|
| 10 | + /** @var int One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses */ |
|
| 11 | + public $type; |
|
| 12 | + /** @var Node\Name Namespace, class, function or constant to alias */ |
|
| 13 | + public $name; |
|
| 14 | + /** @var Identifier|null Alias */ |
|
| 15 | + public $alias; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Constructs an alias (use) node. |
|
| 19 | - * |
|
| 20 | - * @param Node\Name $name Namespace/Class to alias |
|
| 21 | - * @param null|string|Identifier $alias Alias |
|
| 22 | - * @param int $type Type of the use element (for mixed group use only) |
|
| 23 | - * @param array $attributes Additional attributes |
|
| 24 | - */ |
|
| 25 | - public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) { |
|
| 26 | - $this->attributes = $attributes; |
|
| 27 | - $this->type = $type; |
|
| 28 | - $this->name = $name; |
|
| 29 | - $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; |
|
| 30 | - } |
|
| 17 | + /** |
|
| 18 | + * Constructs an alias (use) node. |
|
| 19 | + * |
|
| 20 | + * @param Node\Name $name Namespace/Class to alias |
|
| 21 | + * @param null|string|Identifier $alias Alias |
|
| 22 | + * @param int $type Type of the use element (for mixed group use only) |
|
| 23 | + * @param array $attributes Additional attributes |
|
| 24 | + */ |
|
| 25 | + public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) { |
|
| 26 | + $this->attributes = $attributes; |
|
| 27 | + $this->type = $type; |
|
| 28 | + $this->name = $name; |
|
| 29 | + $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function getSubNodeNames() : array { |
|
| 33 | - return ['type', 'name', 'alias']; |
|
| 34 | - } |
|
| 32 | + public function getSubNodeNames() : array { |
|
| 33 | + return ['type', 'name', 'alias']; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Get alias. If not explicitly given this is the last component of the used name. |
|
| 38 | - * |
|
| 39 | - * @return Identifier |
|
| 40 | - */ |
|
| 41 | - public function getAlias() : Identifier { |
|
| 42 | - if (null !== $this->alias) { |
|
| 43 | - return $this->alias; |
|
| 44 | - } |
|
| 36 | + /** |
|
| 37 | + * Get alias. If not explicitly given this is the last component of the used name. |
|
| 38 | + * |
|
| 39 | + * @return Identifier |
|
| 40 | + */ |
|
| 41 | + public function getAlias() : Identifier { |
|
| 42 | + if (null !== $this->alias) { |
|
| 43 | + return $this->alias; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return new Identifier($this->name->getLast()); |
|
| 47 | - } |
|
| 46 | + return new Identifier($this->name->getLast()); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function getType() : string { |
|
| 50 | - return 'Stmt_UseUse'; |
|
| 51 | - } |
|
| 49 | + public function getType() : string { |
|
| 50 | + return 'Stmt_UseUse'; |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -6,38 +6,38 @@ |
||
| 6 | 6 | |
| 7 | 7 | class For_ extends Node\Stmt |
| 8 | 8 | { |
| 9 | - /** @var Node\Expr[] Init expressions */ |
|
| 10 | - public $init; |
|
| 11 | - /** @var Node\Expr[] Loop conditions */ |
|
| 12 | - public $cond; |
|
| 13 | - /** @var Node\Expr[] Loop expressions */ |
|
| 14 | - public $loop; |
|
| 15 | - /** @var Node\Stmt[] Statements */ |
|
| 16 | - public $stmts; |
|
| 9 | + /** @var Node\Expr[] Init expressions */ |
|
| 10 | + public $init; |
|
| 11 | + /** @var Node\Expr[] Loop conditions */ |
|
| 12 | + public $cond; |
|
| 13 | + /** @var Node\Expr[] Loop expressions */ |
|
| 14 | + public $loop; |
|
| 15 | + /** @var Node\Stmt[] Statements */ |
|
| 16 | + public $stmts; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructs a for loop node. |
|
| 20 | - * |
|
| 21 | - * @param array $subNodes Array of the following optional subnodes: |
|
| 22 | - * 'init' => array(): Init expressions |
|
| 23 | - * 'cond' => array(): Loop conditions |
|
| 24 | - * 'loop' => array(): Loop expressions |
|
| 25 | - * 'stmts' => array(): Statements |
|
| 26 | - * @param array $attributes Additional attributes |
|
| 27 | - */ |
|
| 28 | - public function __construct(array $subNodes = [], array $attributes = []) { |
|
| 29 | - $this->attributes = $attributes; |
|
| 30 | - $this->init = $subNodes['init'] ?? []; |
|
| 31 | - $this->cond = $subNodes['cond'] ?? []; |
|
| 32 | - $this->loop = $subNodes['loop'] ?? []; |
|
| 33 | - $this->stmts = $subNodes['stmts'] ?? []; |
|
| 34 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructs a for loop node. |
|
| 20 | + * |
|
| 21 | + * @param array $subNodes Array of the following optional subnodes: |
|
| 22 | + * 'init' => array(): Init expressions |
|
| 23 | + * 'cond' => array(): Loop conditions |
|
| 24 | + * 'loop' => array(): Loop expressions |
|
| 25 | + * 'stmts' => array(): Statements |
|
| 26 | + * @param array $attributes Additional attributes |
|
| 27 | + */ |
|
| 28 | + public function __construct(array $subNodes = [], array $attributes = []) { |
|
| 29 | + $this->attributes = $attributes; |
|
| 30 | + $this->init = $subNodes['init'] ?? []; |
|
| 31 | + $this->cond = $subNodes['cond'] ?? []; |
|
| 32 | + $this->loop = $subNodes['loop'] ?? []; |
|
| 33 | + $this->stmts = $subNodes['stmts'] ?? []; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function getSubNodeNames() : array { |
|
| 37 | - return ['init', 'cond', 'loop', 'stmts']; |
|
| 38 | - } |
|
| 36 | + public function getSubNodeNames() : array { |
|
| 37 | + return ['init', 'cond', 'loop', 'stmts']; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function getType() : string { |
|
| 41 | - return 'Stmt_For'; |
|
| 42 | - } |
|
| 40 | + public function getType() : string { |
|
| 41 | + return 'Stmt_For'; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -6,42 +6,42 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Use_ extends Stmt |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be |
|
| 11 | - * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the |
|
| 12 | - * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations. |
|
| 13 | - */ |
|
| 14 | - const TYPE_UNKNOWN = 0; |
|
| 15 | - /** Class or namespace import */ |
|
| 16 | - const TYPE_NORMAL = 1; |
|
| 17 | - /** Function import */ |
|
| 18 | - const TYPE_FUNCTION = 2; |
|
| 19 | - /** Constant import */ |
|
| 20 | - const TYPE_CONSTANT = 3; |
|
| 9 | + /** |
|
| 10 | + * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be |
|
| 11 | + * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the |
|
| 12 | + * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations. |
|
| 13 | + */ |
|
| 14 | + const TYPE_UNKNOWN = 0; |
|
| 15 | + /** Class or namespace import */ |
|
| 16 | + const TYPE_NORMAL = 1; |
|
| 17 | + /** Function import */ |
|
| 18 | + const TYPE_FUNCTION = 2; |
|
| 19 | + /** Constant import */ |
|
| 20 | + const TYPE_CONSTANT = 3; |
|
| 21 | 21 | |
| 22 | - /** @var int Type of alias */ |
|
| 23 | - public $type; |
|
| 24 | - /** @var UseUse[] Aliases */ |
|
| 25 | - public $uses; |
|
| 22 | + /** @var int Type of alias */ |
|
| 23 | + public $type; |
|
| 24 | + /** @var UseUse[] Aliases */ |
|
| 25 | + public $uses; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Constructs an alias (use) list node. |
|
| 29 | - * |
|
| 30 | - * @param UseUse[] $uses Aliases |
|
| 31 | - * @param int $type Type of alias |
|
| 32 | - * @param array $attributes Additional attributes |
|
| 33 | - */ |
|
| 34 | - public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) { |
|
| 35 | - $this->attributes = $attributes; |
|
| 36 | - $this->type = $type; |
|
| 37 | - $this->uses = $uses; |
|
| 38 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructs an alias (use) list node. |
|
| 29 | + * |
|
| 30 | + * @param UseUse[] $uses Aliases |
|
| 31 | + * @param int $type Type of alias |
|
| 32 | + * @param array $attributes Additional attributes |
|
| 33 | + */ |
|
| 34 | + public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) { |
|
| 35 | + $this->attributes = $attributes; |
|
| 36 | + $this->type = $type; |
|
| 37 | + $this->uses = $uses; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function getSubNodeNames() : array { |
|
| 41 | - return ['type', 'uses']; |
|
| 42 | - } |
|
| 40 | + public function getSubNodeNames() : array { |
|
| 41 | + return ['type', 'uses']; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function getType() : string { |
|
| 45 | - return 'Stmt_Use'; |
|
| 46 | - } |
|
| 44 | + public function getType() : string { |
|
| 45 | + return 'Stmt_Use'; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use PhpParser\Node\Stmt; |
| 6 | 6 | |
| 7 | -class Use_ extends Stmt |
|
| 8 | -{ |
|
| 7 | +class Use_ extends Stmt { |
|
| 9 | 8 | /** |
| 10 | 9 | * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be |
| 11 | 10 | * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the |