ClosureUse.php 881 B

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