2014-02-06 14:44:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PhpParser\Node;
|
|
|
|
|
|
|
|
use PhpParser\NodeAbstract;
|
|
|
|
|
|
|
|
class Param extends NodeAbstract
|
|
|
|
{
|
2017-04-28 19:09:39 +02:00
|
|
|
/** @var null|Identifier|Name|NullableType Typehint */
|
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;
|
2017-01-19 23:38:40 +01:00
|
|
|
/** @var Expr\Variable Parameter variable */
|
|
|
|
public $var;
|
2015-02-28 18:44:28 +01:00
|
|
|
/** @var null|Expr Default value */
|
|
|
|
public $default;
|
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
/**
|
|
|
|
* Constructs a parameter node.
|
|
|
|
*
|
2017-01-19 23:38:40 +01:00
|
|
|
* @param Expr\Variable $var Parameter variable
|
2016-12-05 13:30:29 +01:00
|
|
|
* @param null|Expr $default Default value
|
|
|
|
* @param null|string|Name|NullableType $type Typehint
|
|
|
|
* @param bool $byRef Whether is passed by reference
|
|
|
|
* @param bool $variadic Whether this is a variadic argument
|
|
|
|
* @param array $attributes Additional attributes
|
2014-02-06 14:44:16 +01:00
|
|
|
*/
|
2017-01-19 23:32:49 +01:00
|
|
|
public function __construct(
|
2017-01-19 23:38:40 +01:00
|
|
|
Expr\Variable $var, Expr $default = null, $type = null,
|
2017-04-28 21:40:59 +02:00
|
|
|
bool $byRef = false, bool $variadic = false, array $attributes = array()
|
2017-01-19 23:32:49 +01:00
|
|
|
) {
|
2015-05-02 22:17:34 +02:00
|
|
|
parent::__construct($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;
|
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 {
|
2017-01-19 23:38:40 +01:00
|
|
|
return array('type', 'byRef', 'variadic', 'var', 'default');
|
2015-02-28 18:44:28 +01:00
|
|
|
}
|
|
|
|
}
|