@@ -6,29 +6,29 @@ |
||
6 | 6 | |
7 | 7 | class Array_ extends Expr |
8 | 8 | { |
9 | - // For use in "kind" attribute |
|
10 | - const KIND_LONG = 1; // array() syntax |
|
11 | - const KIND_SHORT = 2; // [] syntax |
|
9 | + // For use in "kind" attribute |
|
10 | + const KIND_LONG = 1; // array() syntax |
|
11 | + const KIND_SHORT = 2; // [] syntax |
|
12 | 12 | |
13 | - /** @var (ArrayItem|null)[] Items */ |
|
14 | - public $items; |
|
13 | + /** @var (ArrayItem|null)[] Items */ |
|
14 | + public $items; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Constructs an array node. |
|
18 | - * |
|
19 | - * @param (ArrayItem|null)[] $items Items of the array |
|
20 | - * @param array $attributes Additional attributes |
|
21 | - */ |
|
22 | - public function __construct(array $items = [], array $attributes = []) { |
|
23 | - $this->attributes = $attributes; |
|
24 | - $this->items = $items; |
|
25 | - } |
|
16 | + /** |
|
17 | + * Constructs an array node. |
|
18 | + * |
|
19 | + * @param (ArrayItem|null)[] $items Items of the array |
|
20 | + * @param array $attributes Additional attributes |
|
21 | + */ |
|
22 | + public function __construct(array $items = [], array $attributes = []) { |
|
23 | + $this->attributes = $attributes; |
|
24 | + $this->items = $items; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getSubNodeNames() : array { |
|
28 | - return ['items']; |
|
29 | - } |
|
27 | + public function getSubNodeNames() : array { |
|
28 | + return ['items']; |
|
29 | + } |
|
30 | 30 | |
31 | - public function getType() : string { |
|
32 | - return 'Expr_Array'; |
|
33 | - } |
|
31 | + public function getType() : string { |
|
32 | + return 'Expr_Array'; |
|
33 | + } |
|
34 | 34 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | class Array_ extends Expr |
8 | 8 | { |
9 | 9 | // For use in "kind" attribute |
10 | - const KIND_LONG = 1; // array() syntax |
|
10 | + const KIND_LONG = 1; // array() syntax |
|
11 | 11 | const KIND_SHORT = 2; // [] syntax |
12 | 12 | |
13 | 13 | /** @var (ArrayItem|null)[] Items */ |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | |
7 | -class Array_ extends Expr |
|
8 | -{ |
|
7 | +class Array_ extends Expr { |
|
9 | 8 | // For use in "kind" attribute |
10 | 9 | const KIND_LONG = 1; // array() syntax |
11 | 10 | const KIND_SHORT = 2; // [] syntax |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class BooleanNot extends Expr |
8 | 8 | { |
9 | - /** @var Expr Expression */ |
|
10 | - public $expr; |
|
9 | + /** @var Expr Expression */ |
|
10 | + public $expr; |
|
11 | 11 | |
12 | - /** |
|
13 | - * Constructs a boolean not node. |
|
14 | - * |
|
15 | - * @param Expr $expr Expression |
|
16 | - * @param array $attributes Additional attributes |
|
17 | - */ |
|
18 | - public function __construct(Expr $expr, array $attributes = []) { |
|
19 | - $this->attributes = $attributes; |
|
20 | - $this->expr = $expr; |
|
21 | - } |
|
12 | + /** |
|
13 | + * Constructs a boolean not node. |
|
14 | + * |
|
15 | + * @param Expr $expr Expression |
|
16 | + * @param array $attributes Additional attributes |
|
17 | + */ |
|
18 | + public function __construct(Expr $expr, array $attributes = []) { |
|
19 | + $this->attributes = $attributes; |
|
20 | + $this->expr = $expr; |
|
21 | + } |
|
22 | 22 | |
23 | - public function getSubNodeNames() : array { |
|
24 | - return ['expr']; |
|
25 | - } |
|
23 | + public function getSubNodeNames() : array { |
|
24 | + return ['expr']; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getType() : string { |
|
28 | - return 'Expr_BooleanNot'; |
|
29 | - } |
|
27 | + public function getType() : string { |
|
28 | + return 'Expr_BooleanNot'; |
|
29 | + } |
|
30 | 30 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | |
7 | -class BooleanNot extends Expr |
|
8 | -{ |
|
7 | +class BooleanNot extends Expr { |
|
9 | 8 | /** @var Expr Expression */ |
10 | 9 | public $expr; |
11 | 10 |
@@ -7,33 +7,33 @@ |
||
7 | 7 | use PhpParser\Node\VariadicPlaceholder; |
8 | 8 | |
9 | 9 | abstract class CallLike extends Expr { |
10 | - /** |
|
11 | - * Return raw arguments, which may be actual Args, or VariadicPlaceholders for first-class |
|
12 | - * callables. |
|
13 | - * |
|
14 | - * @return array<Arg|VariadicPlaceholder> |
|
15 | - */ |
|
16 | - abstract public function getRawArgs(): array; |
|
10 | + /** |
|
11 | + * Return raw arguments, which may be actual Args, or VariadicPlaceholders for first-class |
|
12 | + * callables. |
|
13 | + * |
|
14 | + * @return array<Arg|VariadicPlaceholder> |
|
15 | + */ |
|
16 | + abstract public function getRawArgs(): array; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Returns whether this call expression is actually a first class callable. |
|
20 | - */ |
|
21 | - public function isFirstClassCallable(): bool { |
|
22 | - foreach ($this->getRawArgs() as $arg) { |
|
23 | - if ($arg instanceof VariadicPlaceholder) { |
|
24 | - return true; |
|
25 | - } |
|
26 | - } |
|
27 | - return false; |
|
28 | - } |
|
18 | + /** |
|
19 | + * Returns whether this call expression is actually a first class callable. |
|
20 | + */ |
|
21 | + public function isFirstClassCallable(): bool { |
|
22 | + foreach ($this->getRawArgs() as $arg) { |
|
23 | + if ($arg instanceof VariadicPlaceholder) { |
|
24 | + return true; |
|
25 | + } |
|
26 | + } |
|
27 | + return false; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Assert that this is not a first-class callable and return only ordinary Args. |
|
32 | - * |
|
33 | - * @return Arg[] |
|
34 | - */ |
|
35 | - public function getArgs(): array { |
|
36 | - assert(!$this->isFirstClassCallable()); |
|
37 | - return $this->getRawArgs(); |
|
38 | - } |
|
30 | + /** |
|
31 | + * Assert that this is not a first-class callable and return only ordinary Args. |
|
32 | + * |
|
33 | + * @return Arg[] |
|
34 | + */ |
|
35 | + public function getArgs(): array { |
|
36 | + assert(!$this->isFirstClassCallable()); |
|
37 | + return $this->getRawArgs(); |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class PreDec extends Expr |
8 | 8 | { |
9 | - /** @var Expr Variable */ |
|
10 | - public $var; |
|
9 | + /** @var Expr Variable */ |
|
10 | + public $var; |
|
11 | 11 | |
12 | - /** |
|
13 | - * Constructs a pre decrement node. |
|
14 | - * |
|
15 | - * @param Expr $var Variable |
|
16 | - * @param array $attributes Additional attributes |
|
17 | - */ |
|
18 | - public function __construct(Expr $var, array $attributes = []) { |
|
19 | - $this->attributes = $attributes; |
|
20 | - $this->var = $var; |
|
21 | - } |
|
12 | + /** |
|
13 | + * Constructs a pre decrement node. |
|
14 | + * |
|
15 | + * @param Expr $var Variable |
|
16 | + * @param array $attributes Additional attributes |
|
17 | + */ |
|
18 | + public function __construct(Expr $var, array $attributes = []) { |
|
19 | + $this->attributes = $attributes; |
|
20 | + $this->var = $var; |
|
21 | + } |
|
22 | 22 | |
23 | - public function getSubNodeNames() : array { |
|
24 | - return ['var']; |
|
25 | - } |
|
23 | + public function getSubNodeNames() : array { |
|
24 | + return ['var']; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getType() : string { |
|
28 | - return 'Expr_PreDec'; |
|
29 | - } |
|
27 | + public function getType() : string { |
|
28 | + return 'Expr_PreDec'; |
|
29 | + } |
|
30 | 30 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | |
7 | -class PreDec extends Expr |
|
8 | -{ |
|
7 | +class PreDec extends Expr { |
|
9 | 8 | /** @var Expr Variable */ |
10 | 9 | public $var; |
11 | 10 |
@@ -12,20 +12,20 @@ |
||
12 | 12 | */ |
13 | 13 | class Error extends Expr |
14 | 14 | { |
15 | - /** |
|
16 | - * Constructs an error node. |
|
17 | - * |
|
18 | - * @param array $attributes Additional attributes |
|
19 | - */ |
|
20 | - public function __construct(array $attributes = []) { |
|
21 | - $this->attributes = $attributes; |
|
22 | - } |
|
15 | + /** |
|
16 | + * Constructs an error node. |
|
17 | + * |
|
18 | + * @param array $attributes Additional attributes |
|
19 | + */ |
|
20 | + public function __construct(array $attributes = []) { |
|
21 | + $this->attributes = $attributes; |
|
22 | + } |
|
23 | 23 | |
24 | - public function getSubNodeNames() : array { |
|
25 | - return []; |
|
26 | - } |
|
24 | + public function getSubNodeNames() : array { |
|
25 | + return []; |
|
26 | + } |
|
27 | 27 | |
28 | - public function getType() : string { |
|
29 | - return 'Expr_Error'; |
|
30 | - } |
|
28 | + public function getType() : string { |
|
29 | + return 'Expr_Error'; |
|
30 | + } |
|
31 | 31 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | * An error node may be placed at a position where an expression is required, but an error occurred. |
11 | 11 | * Error nodes will not be present if the parser is run in throwOnError mode (the default). |
12 | 12 | */ |
13 | -class Error extends Expr |
|
14 | -{ |
|
13 | +class Error extends Expr { |
|
15 | 14 | /** |
16 | 15 | * Constructs an error node. |
17 | 16 | * |
@@ -7,29 +7,29 @@ |
||
7 | 7 | |
8 | 8 | class NullsafePropertyFetch extends Expr |
9 | 9 | { |
10 | - /** @var Expr Variable holding object */ |
|
11 | - public $var; |
|
12 | - /** @var Identifier|Expr Property name */ |
|
13 | - public $name; |
|
10 | + /** @var Expr Variable holding object */ |
|
11 | + public $var; |
|
12 | + /** @var Identifier|Expr Property name */ |
|
13 | + public $name; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Constructs a nullsafe property fetch node. |
|
17 | - * |
|
18 | - * @param Expr $var Variable holding object |
|
19 | - * @param string|Identifier|Expr $name Property name |
|
20 | - * @param array $attributes Additional attributes |
|
21 | - */ |
|
22 | - public function __construct(Expr $var, $name, array $attributes = []) { |
|
23 | - $this->attributes = $attributes; |
|
24 | - $this->var = $var; |
|
25 | - $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
26 | - } |
|
15 | + /** |
|
16 | + * Constructs a nullsafe property fetch node. |
|
17 | + * |
|
18 | + * @param Expr $var Variable holding object |
|
19 | + * @param string|Identifier|Expr $name Property name |
|
20 | + * @param array $attributes Additional attributes |
|
21 | + */ |
|
22 | + public function __construct(Expr $var, $name, array $attributes = []) { |
|
23 | + $this->attributes = $attributes; |
|
24 | + $this->var = $var; |
|
25 | + $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
26 | + } |
|
27 | 27 | |
28 | - public function getSubNodeNames() : array { |
|
29 | - return ['var', 'name']; |
|
30 | - } |
|
28 | + public function getSubNodeNames() : array { |
|
29 | + return ['var', 'name']; |
|
30 | + } |
|
31 | 31 | |
32 | - public function getType() : string { |
|
33 | - return 'Expr_NullsafePropertyFetch'; |
|
34 | - } |
|
32 | + public function getType() : string { |
|
33 | + return 'Expr_NullsafePropertyFetch'; |
|
34 | + } |
|
35 | 35 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | use PhpParser\Node\Identifier; |
7 | 7 | |
8 | -class NullsafePropertyFetch extends Expr |
|
9 | -{ |
|
8 | +class NullsafePropertyFetch extends Expr { |
|
10 | 9 | /** @var Expr Variable holding object */ |
11 | 10 | public $var; |
12 | 11 | /** @var Identifier|Expr Property name */ |
@@ -7,29 +7,29 @@ |
||
7 | 7 | |
8 | 8 | class PropertyFetch extends Expr |
9 | 9 | { |
10 | - /** @var Expr Variable holding object */ |
|
11 | - public $var; |
|
12 | - /** @var Identifier|Expr Property name */ |
|
13 | - public $name; |
|
10 | + /** @var Expr Variable holding object */ |
|
11 | + public $var; |
|
12 | + /** @var Identifier|Expr Property name */ |
|
13 | + public $name; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Constructs a function call node. |
|
17 | - * |
|
18 | - * @param Expr $var Variable holding object |
|
19 | - * @param string|Identifier|Expr $name Property name |
|
20 | - * @param array $attributes Additional attributes |
|
21 | - */ |
|
22 | - public function __construct(Expr $var, $name, array $attributes = []) { |
|
23 | - $this->attributes = $attributes; |
|
24 | - $this->var = $var; |
|
25 | - $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
26 | - } |
|
15 | + /** |
|
16 | + * Constructs a function call node. |
|
17 | + * |
|
18 | + * @param Expr $var Variable holding object |
|
19 | + * @param string|Identifier|Expr $name Property name |
|
20 | + * @param array $attributes Additional attributes |
|
21 | + */ |
|
22 | + public function __construct(Expr $var, $name, array $attributes = []) { |
|
23 | + $this->attributes = $attributes; |
|
24 | + $this->var = $var; |
|
25 | + $this->name = \is_string($name) ? new Identifier($name) : $name; |
|
26 | + } |
|
27 | 27 | |
28 | - public function getSubNodeNames() : array { |
|
29 | - return ['var', 'name']; |
|
30 | - } |
|
28 | + public function getSubNodeNames() : array { |
|
29 | + return ['var', 'name']; |
|
30 | + } |
|
31 | 31 | |
32 | - public function getType() : string { |
|
33 | - return 'Expr_PropertyFetch'; |
|
34 | - } |
|
32 | + public function getType() : string { |
|
33 | + return 'Expr_PropertyFetch'; |
|
34 | + } |
|
35 | 35 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | use PhpParser\Node\Identifier; |
7 | 7 | |
8 | -class PropertyFetch extends Expr |
|
9 | -{ |
|
8 | +class PropertyFetch extends Expr { |
|
10 | 9 | /** @var Expr Variable holding object */ |
11 | 10 | public $var; |
12 | 11 | /** @var Identifier|Expr Property name */ |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class UnaryPlus extends Expr |
8 | 8 | { |
9 | - /** @var Expr Expression */ |
|
10 | - public $expr; |
|
9 | + /** @var Expr Expression */ |
|
10 | + public $expr; |
|
11 | 11 | |
12 | - /** |
|
13 | - * Constructs a unary plus node. |
|
14 | - * |
|
15 | - * @param Expr $expr Expression |
|
16 | - * @param array $attributes Additional attributes |
|
17 | - */ |
|
18 | - public function __construct(Expr $expr, array $attributes = []) { |
|
19 | - $this->attributes = $attributes; |
|
20 | - $this->expr = $expr; |
|
21 | - } |
|
12 | + /** |
|
13 | + * Constructs a unary plus node. |
|
14 | + * |
|
15 | + * @param Expr $expr Expression |
|
16 | + * @param array $attributes Additional attributes |
|
17 | + */ |
|
18 | + public function __construct(Expr $expr, array $attributes = []) { |
|
19 | + $this->attributes = $attributes; |
|
20 | + $this->expr = $expr; |
|
21 | + } |
|
22 | 22 | |
23 | - public function getSubNodeNames() : array { |
|
24 | - return ['expr']; |
|
25 | - } |
|
23 | + public function getSubNodeNames() : array { |
|
24 | + return ['expr']; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getType() : string { |
|
28 | - return 'Expr_UnaryPlus'; |
|
29 | - } |
|
27 | + public function getType() : string { |
|
28 | + return 'Expr_UnaryPlus'; |
|
29 | + } |
|
30 | 30 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | |
7 | -class UnaryPlus extends Expr |
|
8 | -{ |
|
7 | +class UnaryPlus extends Expr { |
|
9 | 8 | /** @var Expr Expression */ |
10 | 9 | public $expr; |
11 | 10 |
@@ -6,34 +6,34 @@ |
||
6 | 6 | |
7 | 7 | class Include_ extends Expr |
8 | 8 | { |
9 | - const TYPE_INCLUDE = 1; |
|
10 | - const TYPE_INCLUDE_ONCE = 2; |
|
11 | - const TYPE_REQUIRE = 3; |
|
12 | - const TYPE_REQUIRE_ONCE = 4; |
|
9 | + const TYPE_INCLUDE = 1; |
|
10 | + const TYPE_INCLUDE_ONCE = 2; |
|
11 | + const TYPE_REQUIRE = 3; |
|
12 | + const TYPE_REQUIRE_ONCE = 4; |
|
13 | 13 | |
14 | - /** @var Expr Expression */ |
|
15 | - public $expr; |
|
16 | - /** @var int Type of include */ |
|
17 | - public $type; |
|
14 | + /** @var Expr Expression */ |
|
15 | + public $expr; |
|
16 | + /** @var int Type of include */ |
|
17 | + public $type; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Constructs an include node. |
|
21 | - * |
|
22 | - * @param Expr $expr Expression |
|
23 | - * @param int $type Type of include |
|
24 | - * @param array $attributes Additional attributes |
|
25 | - */ |
|
26 | - public function __construct(Expr $expr, int $type, array $attributes = []) { |
|
27 | - $this->attributes = $attributes; |
|
28 | - $this->expr = $expr; |
|
29 | - $this->type = $type; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Constructs an include node. |
|
21 | + * |
|
22 | + * @param Expr $expr Expression |
|
23 | + * @param int $type Type of include |
|
24 | + * @param array $attributes Additional attributes |
|
25 | + */ |
|
26 | + public function __construct(Expr $expr, int $type, array $attributes = []) { |
|
27 | + $this->attributes = $attributes; |
|
28 | + $this->expr = $expr; |
|
29 | + $this->type = $type; |
|
30 | + } |
|
31 | 31 | |
32 | - public function getSubNodeNames() : array { |
|
33 | - return ['expr', 'type']; |
|
34 | - } |
|
32 | + public function getSubNodeNames() : array { |
|
33 | + return ['expr', 'type']; |
|
34 | + } |
|
35 | 35 | |
36 | - public function getType() : string { |
|
37 | - return 'Expr_Include'; |
|
38 | - } |
|
36 | + public function getType() : string { |
|
37 | + return 'Expr_Include'; |
|
38 | + } |
|
39 | 39 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use PhpParser\Node\Expr; |
6 | 6 | |
7 | -class Include_ extends Expr |
|
8 | -{ |
|
7 | +class Include_ extends Expr { |
|
9 | 8 | const TYPE_INCLUDE = 1; |
10 | 9 | const TYPE_INCLUDE_ONCE = 2; |
11 | 10 | const TYPE_REQUIRE = 3; |