Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Node / Stmt / Class_.php
index 0a65e37403df96e83bc5d7df01a4140bbf9fb49b..78bd1957053faf7789df6c9016f87af274cff75e 100644 (file)
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace PhpParser\Node\Stmt;
 
@@ -15,8 +15,6 @@ class Class_ extends ClassLike
     const MODIFIER_FINAL     = 32;
 
     const VISIBILITY_MODIFIER_MASK = 7; // 1 | 2 | 4
-    /** @deprecated */
-    const VISIBILITY_MODIFER_MASK = self::VISIBILITY_MODIFIER_MASK;
 
     /** @var int Type */
     public $flags;
@@ -25,19 +23,10 @@ class Class_ extends ClassLike
     /** @var Node\Name[] Names of implemented interfaces */
     public $implements;
 
-    /** @deprecated Use $flags instead */
-    public $type;
-
-    protected static $specialNames = array(
-        'self'   => true,
-        'parent' => true,
-        'static' => true,
-    );
-
     /**
      * Constructs a class node.
      *
-     * @param string|null $name       Name
+     * @param string|Node\Identifier|null $name Name
      * @param array       $subNodes   Array of the following optional subnodes:
      *                                'flags'      => 0      : Flags
      *                                'extends'    => null   : Name of extended class
@@ -45,30 +34,43 @@ class Class_ extends ClassLike
      *                                '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->flags = isset($subNodes['flags']) ? $subNodes['flags']
-            : (isset($subNodes['type']) ? $subNodes['type'] : 0);
-        $this->type = $this->flags;
-        $this->name = $name;
-        $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null;
-        $this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array();
-        $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
+        $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0;
+        $this->name = \is_string($name) ? new Node\Identifier($name) : $name;
+        $this->extends = $subNodes['extends'] ?? null;
+        $this->implements = $subNodes['implements'] ?? [];
+        $this->stmts = $subNodes['stmts'] ?? [];
     }
 
-    public function getSubNodeNames() {
-        return array('flags', 'name', 'extends', 'implements', 'stmts');
+    public function getSubNodeNames() : array {
+        return ['flags', 'name', 'extends', 'implements', 'stmts'];
     }
 
-    public function isAbstract() {
+    /**
+     * Whether the class is explicitly abstract.
+     *
+     * @return bool
+     */
+    public function isAbstract() : bool {
         return (bool) ($this->flags & self::MODIFIER_ABSTRACT);
     }
 
-    public function isFinal() {
+    /**
+     * Whether the class is final.
+     *
+     * @return bool
+     */
+    public function isFinal() : bool {
         return (bool) ($this->flags & self::MODIFIER_FINAL);
     }
 
-    public function isAnonymous() {
+    /**
+     * Whether the class is anonymous.
+     *
+     * @return bool
+     */
+    public function isAnonymous() : bool {
         return null === $this->name;
     }
 
@@ -96,4 +98,8 @@ class Class_ extends ClassLike
             throw new Error('Cannot use the final modifier on an abstract class member');
         }
     }
+    
+    public function getType() : string {
+        return 'Stmt_Class';
+    }
 }