Instanceof_.php 860 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node;
  4. use PhpParser\Node\Expr;
  5. use PhpParser\Node\Name;
  6. class Instanceof_ extends Expr {
  7. /** @var Expr Expression */
  8. public Expr $expr;
  9. /** @var Name|Expr Class name */
  10. public Node $class;
  11. /**
  12. * Constructs an instanceof check node.
  13. *
  14. * @param Expr $expr Expression
  15. * @param Name|Expr $class Class name
  16. * @param array<string, mixed> $attributes Additional attributes
  17. */
  18. public function __construct(Expr $expr, Node $class, array $attributes = []) {
  19. $this->attributes = $attributes;
  20. $this->expr = $expr;
  21. $this->class = $class;
  22. }
  23. public function getSubNodeNames(): array {
  24. return ['expr', 'class'];
  25. }
  26. public function getType(): string {
  27. return 'Expr_Instanceof';
  28. }
  29. }