No Description

EnumCase.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. use PhpParser\Node\AttributeGroup;
  5. class EnumCase extends Node\Stmt
  6. {
  7. /** @var Node\Identifier Enum case name */
  8. public $name;
  9. /** @var Node\Expr|null Enum case expression */
  10. public $expr;
  11. /** @var Node\AttributeGroup[] PHP attribute groups */
  12. public $attrGroups;
  13. /**
  14. * @param string|Node\Identifier $name Enum case name
  15. * @param Node\Expr|null $expr Enum case expression
  16. * @param AttributeGroup[] $attrGroups PHP attribute groups
  17. * @param array $attributes Additional attributes
  18. */
  19. public function __construct($name, Node\Expr $expr = null, array $attrGroups = [], array $attributes = []) {
  20. parent::__construct($attributes);
  21. $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
  22. $this->expr = $expr;
  23. $this->attrGroups = $attrGroups;
  24. }
  25. public function getSubNodeNames() : array {
  26. return ['attrGroups', 'name', 'expr'];
  27. }
  28. public function getType() : string {
  29. return 'Stmt_EnumCase';
  30. }
  31. }