1 <?php declare(strict_types=1);
3 namespace PhpParser\Node\Stmt;
7 class Trait_ extends ClassLike
10 * Constructs a trait node.
12 * @param string|Node\Identifier $name Name
13 * @param array $subNodes Array of the following optional subnodes:
14 * 'stmts' => array(): Statements
15 * @param array $attributes Additional attributes
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->stmts = $subNodes['stmts'] ?? [];
23 public function getSubNodeNames() : array {
24 return ['name', 'stmts'];
27 public function getType() : string {