Namespace_.php 957 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class Namespace_ extends Node\Stmt {
  5. /* For use in the "kind" attribute */
  6. public const KIND_SEMICOLON = 1;
  7. public const KIND_BRACED = 2;
  8. /** @var null|Node\Name Name */
  9. public ?Node\Name $name;
  10. /** @var Node\Stmt[] Statements */
  11. public $stmts;
  12. /**
  13. * Constructs a namespace node.
  14. *
  15. * @param null|Node\Name $name Name
  16. * @param null|Node\Stmt[] $stmts Statements
  17. * @param array<string, mixed> $attributes Additional attributes
  18. */
  19. public function __construct(?Node\Name $name = null, ?array $stmts = [], array $attributes = []) {
  20. $this->attributes = $attributes;
  21. $this->name = $name;
  22. $this->stmts = $stmts;
  23. }
  24. public function getSubNodeNames(): array {
  25. return ['name', 'stmts'];
  26. }
  27. public function getType(): string {
  28. return 'Stmt_Namespace';
  29. }
  30. }