Param.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace PhpParser\Node;
  3. use PhpParser\NodeAbstract;
  4. class Param extends NodeAbstract
  5. {
  6. /** @var null|string|Name|NullableType Typehint */
  7. public $type;
  8. /** @var bool Whether parameter is passed by reference */
  9. public $byRef;
  10. /** @var bool Whether this is a variadic argument */
  11. public $variadic;
  12. /** @var string Name */
  13. public $name;
  14. /** @var null|Expr Default value */
  15. public $default;
  16. /**
  17. * Constructs a parameter node.
  18. *
  19. * @param string $name Name
  20. * @param null|Expr $default Default value
  21. * @param null|string|Name|NullableType $type Typehint
  22. * @param bool $byRef Whether is passed by reference
  23. * @param bool $variadic Whether this is a variadic argument
  24. * @param array $attributes Additional attributes
  25. */
  26. public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
  27. parent::__construct($attributes);
  28. $this->type = $type;
  29. $this->byRef = $byRef;
  30. $this->variadic = $variadic;
  31. $this->name = $name;
  32. $this->default = $default;
  33. }
  34. public function getSubNodeNames() {
  35. return array('type', 'byRef', 'variadic', 'name', 'default');
  36. }
  37. }