Case_.php 869 B

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