diff vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
line wrap: on
line diff
--- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php	Thu Feb 28 13:21:36 2019 +0000
@@ -4,6 +4,9 @@
 
 use PhpParser;
 use PhpParser\BuilderHelpers;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Name;
+use PhpParser\Node\NullableType;
 use PhpParser\Node\Stmt;
 
 class Property implements PhpParser\Builder
@@ -14,6 +17,9 @@
     protected $default = null;
     protected $attributes = [];
 
+    /** @var null|Identifier|Name|NullableType */
+    protected $type;
+
     /**
      * Creates a property builder.
      *
@@ -96,6 +102,19 @@
     }
 
     /**
+     * Sets the property type for PHP 7.4+.
+     *
+     * @param string|Name|NullableType|Identifier $type
+     *
+     * @return $this
+     */
+    public function setType($type) {
+        $this->type = BuilderHelpers::normalizeType($type);
+
+        return $this;
+    }
+
+    /**
      * Returns the built class node.
      *
      * @return Stmt\Property The built property node
@@ -106,7 +125,8 @@
             [
                 new Stmt\PropertyProperty($this->name, $this->default)
             ],
-            $this->attributes
+            $this->attributes,
+            $this->type
         );
     }
 }