Interface_.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class Interface_ extends ClassLike
  5. {
  6. /** @var Node\Name[] Extended interfaces */
  7. public $extends;
  8. /**
  9. * Constructs a class node.
  10. *
  11. * @param string|Node\Identifier $name Name
  12. * @param array $subNodes Array of the following optional subnodes:
  13. * 'extends' => array(): Name of extended interfaces
  14. * 'stmts' => array(): Statements
  15. * @param array $attributes Additional attributes
  16. */
  17. public function __construct($name, array $subNodes = [], array $attributes = []) {
  18. parent::__construct($attributes);
  19. $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
  20. $this->extends = $subNodes['extends'] ?? [];
  21. $this->stmts = $subNodes['stmts'] ?? [];
  22. }
  23. public function getSubNodeNames() : array {
  24. return ['name', 'extends', 'stmts'];
  25. }
  26. public function getType() : string {
  27. return 'Stmt_Interface';
  28. }
  29. }