ClosureUse.php 973 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node;
  3. use PhpParser\NodeAbstract;
  4. class ClosureUse extends NodeAbstract {
  5. /** @var Expr\Variable Variable to use */
  6. public Expr\Variable $var;
  7. /** @var bool Whether to use by reference */
  8. public bool $byRef;
  9. /**
  10. * Constructs a closure use node.
  11. *
  12. * @param Expr\Variable $var Variable to use
  13. * @param bool $byRef Whether to use by reference
  14. * @param array<string, mixed> $attributes Additional attributes
  15. */
  16. public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) {
  17. $this->attributes = $attributes;
  18. $this->var = $var;
  19. $this->byRef = $byRef;
  20. }
  21. public function getSubNodeNames(): array {
  22. return ['var', 'byRef'];
  23. }
  24. public function getType(): string {
  25. return 'ClosureUse';
  26. }
  27. }
  28. // @deprecated compatibility alias
  29. class_alias(ClosureUse::class, Expr\ClosureUse::class);