Arg.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node;
  3. use PhpParser\Node\VariadicPlaceholder;
  4. use PhpParser\NodeAbstract;
  5. class Arg extends NodeAbstract
  6. {
  7. /** @var Identifier|null Parameter name (for named parameters) */
  8. public $name;
  9. /** @var Expr Value to pass */
  10. public $value;
  11. /** @var bool Whether to pass by ref */
  12. public $byRef;
  13. /** @var bool Whether to unpack the argument */
  14. public $unpack;
  15. /**
  16. * Constructs a function call argument node.
  17. *
  18. * @param Expr $value Value to pass
  19. * @param bool $byRef Whether to pass by ref
  20. * @param bool $unpack Whether to unpack the argument
  21. * @param array $attributes Additional attributes
  22. * @param Identifier|null $name Parameter name (for named parameters)
  23. */
  24. public function __construct(
  25. Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [],
  26. Identifier $name = null
  27. ) {
  28. $this->attributes = $attributes;
  29. $this->name = $name;
  30. $this->value = $value;
  31. $this->byRef = $byRef;
  32. $this->unpack = $unpack;
  33. }
  34. public function getSubNodeNames() : array {
  35. return ['name', 'value', 'byRef', 'unpack'];
  36. }
  37. public function getType() : string {
  38. return 'Arg';
  39. }
  40. }