Switch_.php 808 B

123456789101112131415161718192021222324252627282930313233
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class Switch_ extends Node\Stmt {
  5. /** @var Node\Expr Condition */
  6. public Node\Expr $cond;
  7. /** @var Case_[] Case list */
  8. public array $cases;
  9. /**
  10. * Constructs a case node.
  11. *
  12. * @param Node\Expr $cond Condition
  13. * @param Case_[] $cases Case list
  14. * @param array<string, mixed> $attributes Additional attributes
  15. */
  16. public function __construct(Node\Expr $cond, array $cases, array $attributes = []) {
  17. $this->attributes = $attributes;
  18. $this->cond = $cond;
  19. $this->cases = $cases;
  20. }
  21. public function getSubNodeNames(): array {
  22. return ['cond', 'cases'];
  23. }
  24. public function getType(): string {
  25. return 'Stmt_Switch';
  26. }
  27. }