No Description

Enum_.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class Enum_ extends ClassLike
  5. {
  6. /** @var null|Node\Identifier Scalar Type */
  7. public $scalarType;
  8. /** @var Node\Name[] Names of implemented interfaces */
  9. public $implements;
  10. /**
  11. * @param string|Node\Identifier|null $name Name
  12. * @param array $subNodes Array of the following optional subnodes:
  13. * 'scalarType' => null : Scalar type
  14. * 'implements' => array() : Names of implemented interfaces
  15. * 'stmts' => array() : Statements
  16. * 'attrGroups' => array() : PHP attribute groups
  17. * @param array $attributes Additional attributes
  18. */
  19. public function __construct($name, array $subNodes = [], array $attributes = []) {
  20. $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
  21. $this->scalarType = $subNodes['scalarType'] ?? null;
  22. $this->implements = $subNodes['implements'] ?? [];
  23. $this->stmts = $subNodes['stmts'] ?? [];
  24. $this->attrGroups = $subNodes['attrGroups'] ?? [];
  25. parent::__construct($attributes);
  26. }
  27. public function getSubNodeNames() : array {
  28. return ['attrGroups', 'name', 'scalarType', 'implements', 'stmts'];
  29. }
  30. public function getType() : string {
  31. return 'Stmt_Enum';
  32. }
  33. }