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