| 1 | <?php |
||
| 8 | class Param extends NodeAbstract |
||
| 9 | { |
||
| 10 | /** @var null|string|Name Typehint */ |
||
| 11 | public $type; |
||
| 12 | /** @var bool Whether parameter is passed by reference */ |
||
| 13 | public $byRef; |
||
| 14 | /** @var bool Whether this is a variadic argument */ |
||
| 15 | public $variadic; |
||
| 16 | /** @var string Name */ |
||
| 17 | public $name; |
||
| 18 | /** @var null|Expr Default value */ |
||
| 19 | public $default; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Constructs a parameter node. |
||
| 23 | * |
||
| 24 | * @param string $name Name |
||
| 25 | * @param null|Expr $default Default value |
||
| 26 | * @param null|string|Name $type Typehint |
||
| 27 | * @param bool $byRef Whether is passed by reference |
||
| 28 | * @param bool $variadic Whether this is a variadic argument |
||
| 29 | * @param array $attributes Additional attributes |
||
| 30 | */ |
||
| 31 | public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) { |
||
| 32 | parent::__construct($attributes); |
||
| 33 | $this->type = $type; |
||
| 34 | $this->byRef = $byRef; |
||
| 35 | $this->variadic = $variadic; |
||
| 36 | $this->name = $name; |
||
| 37 | $this->default = $default; |
||
| 38 | |||
| 39 | if ($variadic && null !== $default) { |
||
| 40 | throw new Error('Variadic parameter cannot have a default value', $default->getAttributes()); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | public function getSubNodeNames() { |
||
| 47 | } |
||
| 48 |