Arg.php 1.2 KB

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