2017-08-18 22:57:27 +02:00
|
|
|
<?php declare(strict_types=1);
|
2014-02-06 14:44:16 +01:00
|
|
|
|
|
|
|
namespace PhpParser\Node;
|
|
|
|
|
|
|
|
use PhpParser\NodeAbstract;
|
|
|
|
|
|
|
|
class Param extends NodeAbstract
|
|
|
|
{
|
2019-10-25 21:35:43 +02:00
|
|
|
/** @var null|Identifier|Name|NullableType|UnionType Type declaration */
|
2015-02-28 18:44:28 +01:00
|
|
|
public $type;
|
|
|
|
/** @var bool Whether parameter is passed by reference */
|
|
|
|
public $byRef;
|
|
|
|
/** @var bool Whether this is a variadic argument */
|
|
|
|
public $variadic;
|
2018-05-12 19:49:39 +02:00
|
|
|
/** @var Expr\Variable|Expr\Error Parameter variable */
|
2017-01-19 23:38:40 +01:00
|
|
|
public $var;
|
2015-02-28 18:44:28 +01:00
|
|
|
/** @var null|Expr Default value */
|
|
|
|
public $default;
|
2020-06-07 18:52:12 +02:00
|
|
|
/** @var int */
|
|
|
|
public $flags;
|
2020-09-13 21:01:17 +02:00
|
|
|
/** @var AttributeGroup[] PHP attribute groups */
|
|
|
|
public $attrGroups;
|
2015-02-28 18:44:28 +01:00
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
/**
|
|
|
|
* Constructs a parameter node.
|
|
|
|
*
|
2019-10-25 21:35:43 +02:00
|
|
|
* @param Expr\Variable|Expr\Error $var Parameter variable
|
|
|
|
* @param null|Expr $default Default value
|
|
|
|
* @param null|string|Identifier|Name|NullableType|UnionType $type Type declaration
|
|
|
|
* @param bool $byRef Whether is passed by reference
|
|
|
|
* @param bool $variadic Whether this is a variadic argument
|
|
|
|
* @param array $attributes Additional attributes
|
2020-09-13 21:01:17 +02:00
|
|
|
* @param int $flags Optional visibility flags
|
|
|
|
* @param AttributeGroup[] $attrGroups PHP attribute groups
|
2014-02-06 14:44:16 +01:00
|
|
|
*/
|
2017-01-19 23:32:49 +01:00
|
|
|
public function __construct(
|
2018-05-12 19:49:39 +02:00
|
|
|
$var, Expr $default = null, $type = null,
|
2020-06-07 18:52:12 +02:00
|
|
|
bool $byRef = false, bool $variadic = false,
|
|
|
|
array $attributes = [],
|
2020-09-13 21:01:17 +02:00
|
|
|
int $flags = 0,
|
|
|
|
array $attrGroups = []
|
2017-01-19 23:32:49 +01:00
|
|
|
) {
|
2019-05-12 14:55:21 +02:00
|
|
|
$this->attributes = $attributes;
|
2017-04-28 19:09:39 +02:00
|
|
|
$this->type = \is_string($type) ? new Identifier($type) : $type;
|
2015-02-28 18:44:28 +01:00
|
|
|
$this->byRef = $byRef;
|
|
|
|
$this->variadic = $variadic;
|
2017-01-19 23:38:40 +01:00
|
|
|
$this->var = $var;
|
2015-02-28 18:44:28 +01:00
|
|
|
$this->default = $default;
|
2020-06-07 18:52:12 +02:00
|
|
|
$this->flags = $flags;
|
2020-09-13 21:01:17 +02:00
|
|
|
$this->attrGroups = $attrGroups;
|
2014-02-06 14:44:16 +01:00
|
|
|
}
|
2015-02-28 18:44:28 +01:00
|
|
|
|
2017-04-28 21:40:59 +02:00
|
|
|
public function getSubNodeNames() : array {
|
2020-09-13 21:01:17 +02:00
|
|
|
return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default'];
|
2015-02-28 18:44:28 +01:00
|
|
|
}
|
2019-01-05 12:06:18 +01:00
|
|
|
|
2018-01-10 18:57:48 +01:00
|
|
|
public function getType() : string {
|
2017-11-12 21:25:57 +01:00
|
|
|
return 'Param';
|
|
|
|
}
|
2015-02-28 18:44:28 +01:00
|
|
|
}
|