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