Chris@13
|
1 <?php declare(strict_types=1);
|
Chris@0
|
2
|
Chris@0
|
3 namespace PhpParser\Node;
|
Chris@0
|
4
|
Chris@0
|
5 use PhpParser\NodeAbstract;
|
Chris@0
|
6
|
Chris@0
|
7 class Param extends NodeAbstract
|
Chris@0
|
8 {
|
Chris@17
|
9 /** @var null|Identifier|Name|NullableType Type declaration */
|
Chris@0
|
10 public $type;
|
Chris@0
|
11 /** @var bool Whether parameter is passed by reference */
|
Chris@0
|
12 public $byRef;
|
Chris@0
|
13 /** @var bool Whether this is a variadic argument */
|
Chris@0
|
14 public $variadic;
|
Chris@16
|
15 /** @var Expr\Variable|Expr\Error Parameter variable */
|
Chris@13
|
16 public $var;
|
Chris@0
|
17 /** @var null|Expr Default value */
|
Chris@0
|
18 public $default;
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Constructs a parameter node.
|
Chris@0
|
22 *
|
Chris@17
|
23 * @param Expr\Variable|Expr\Error $var Parameter variable
|
Chris@17
|
24 * @param null|Expr $default Default value
|
Chris@17
|
25 * @param null|string|Identifier|Name|NullableType $type Type declaration
|
Chris@17
|
26 * @param bool $byRef Whether is passed by reference
|
Chris@17
|
27 * @param bool $variadic Whether this is a variadic argument
|
Chris@17
|
28 * @param array $attributes Additional attributes
|
Chris@0
|
29 */
|
Chris@13
|
30 public function __construct(
|
Chris@16
|
31 $var, Expr $default = null, $type = null,
|
Chris@13
|
32 bool $byRef = false, bool $variadic = false, array $attributes = []
|
Chris@13
|
33 ) {
|
Chris@0
|
34 parent::__construct($attributes);
|
Chris@13
|
35 $this->type = \is_string($type) ? new Identifier($type) : $type;
|
Chris@0
|
36 $this->byRef = $byRef;
|
Chris@0
|
37 $this->variadic = $variadic;
|
Chris@13
|
38 $this->var = $var;
|
Chris@0
|
39 $this->default = $default;
|
Chris@0
|
40 }
|
Chris@0
|
41
|
Chris@13
|
42 public function getSubNodeNames() : array {
|
Chris@13
|
43 return ['type', 'byRef', 'variadic', 'var', 'default'];
|
Chris@13
|
44 }
|
Chris@17
|
45
|
Chris@13
|
46 public function getType() : string {
|
Chris@13
|
47 return 'Param';
|
Chris@0
|
48 }
|
Chris@0
|
49 }
|