Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Node / Stmt / Trait_.php
index eed5844ae1ff55be776adde8268c78ad9a0bbba2..83980a7628a4ceca50b33bc76122084f5bc7ca3f 100644 (file)
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace PhpParser\Node\Stmt;
 
@@ -9,18 +9,22 @@ class Trait_ extends ClassLike
     /**
      * Constructs a trait node.
      *
-     * @param string $name       Name
+     * @param string|Node\Identifier $name Name
      * @param array  $subNodes   Array of the following optional subnodes:
      *                           'stmts' => array(): Statements
      * @param array  $attributes Additional attributes
      */
-    public function __construct($name, array $subNodes = array(), array $attributes = array()) {
+    public function __construct($name, array $subNodes = [], array $attributes = []) {
         parent::__construct($attributes);
-        $this->name = $name;
-        $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
+        $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
+        $this->stmts = $subNodes['stmts'] ?? [];
     }
 
-    public function getSubNodeNames() {
-        return array('name', 'stmts');
+    public function getSubNodeNames() : array {
+        return ['name', 'stmts'];
+    }
+    
+    public function getType() : string {
+        return 'Stmt_Trait';
     }
 }