Arg.php 1.3 KB

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