$type
$type : null|string|\PhpParser\Node\Name|\PhpParser\Node\NullableType
$type : null|string|\PhpParser\Node\Name|\PhpParser\Node\NullableType
$default : null|\PhpParser\Node\Expr
__construct(string $name, null|\PhpParser\Node\Expr $default = null, null|string|\PhpParser\Node\Name|\PhpParser\Node\NullableType $type = null, boolean $byRef = false, boolean $variadic = false, array $attributes = array())
Constructs a parameter node.
string | $name | Name |
null|\PhpParser\Node\Expr | $default | Default value |
null|string|\PhpParser\Node\Name|\PhpParser\Node\NullableType | $type | Typehint |
boolean | $byRef | Whether is passed by reference |
boolean | $variadic | Whether this is a variadic argument |
array | $attributes | Additional attributes |
getDocComment() : null|\PhpParser\Comment\Doc
Gets the doc comment of the node.
The doc comment has to be the last comment associated with the node.
Doc comment object or null
None found |
setDocComment(\PhpParser\Comment\Doc $docComment)
Sets the doc comment of the node.
This will either replace an existing doc comment or add it to the comments array.
\PhpParser\Comment\Doc | $docComment | Doc comment to set |
None found |
setAttribute(string $key, mixed $value)
Sets an attribute on a node.
string | $key | |
mixed | $value |
None found |
hasAttribute(string $key) : boolean
Returns whether an attribute exists.
string | $key |
None found |
getAttribute(string $key, mixed $default = null) : mixed
Returns the value of an attribute.
string | $key | |
mixed | $default |
None found |
None found |
None found |
None found |
<?php
namespace PhpParser\Node;
use PhpParser\NodeAbstract;
class Param extends NodeAbstract
{
/** @var null|string|Name|NullableType Typehint */
public $type;
/** @var bool Whether parameter is passed by reference */
public $byRef;
/** @var bool Whether this is a variadic argument */
public $variadic;
/** @var string Name */
public $name;
/** @var null|Expr Default value */
public $default;
/**
* Constructs a parameter node.
*
* @param string $name Name
* @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
*/
public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->byRef = $byRef;
$this->variadic = $variadic;
$this->name = $name;
$this->default = $default;
}
public function getSubNodeNames() {
return array('type', 'byRef', 'variadic', 'name', 'default');
}
}