Label.php 719 B

123456789101112131415161718192021222324252627282930
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node\Identifier;
  4. use PhpParser\Node\Stmt;
  5. class Label extends Stmt {
  6. /** @var Identifier Name */
  7. public Identifier $name;
  8. /**
  9. * Constructs a label node.
  10. *
  11. * @param string|Identifier $name Name
  12. * @param array<string, mixed> $attributes Additional attributes
  13. */
  14. public function __construct($name, array $attributes = []) {
  15. $this->attributes = $attributes;
  16. $this->name = \is_string($name) ? new Identifier($name) : $name;
  17. }
  18. public function getSubNodeNames(): array {
  19. return ['name'];
  20. }
  21. public function getType(): string {
  22. return 'Stmt_Label';
  23. }
  24. }