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