Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Builder / Param.php
index c029e748b74988b90f62754984a46f7cc4fb0681..eff76cb45c49057c11e4b3e79515745b9d86a605 100644 (file)
@@ -1,11 +1,12 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace PhpParser\Builder;
 
 use PhpParser;
+use PhpParser\BuilderHelpers;
 use PhpParser\Node;
 
-class Param extends PhpParser\BuilderAbstract
+class Param implements PhpParser\Builder
 {
     protected $name;
 
@@ -23,7 +24,7 @@ class Param extends PhpParser\BuilderAbstract
      *
      * @param string $name Name of the parameter
      */
-    public function __construct($name) {
+    public function __construct(string $name) {
         $this->name = $name;
     }
 
@@ -35,7 +36,7 @@ class Param extends PhpParser\BuilderAbstract
      * @return $this The builder instance (for fluid interface)
      */
     public function setDefault($value) {
-        $this->default = $this->normalizeValue($value);
+        $this->default = BuilderHelpers::normalizeValue($value);
 
         return $this;
     }
@@ -48,8 +49,8 @@ class Param extends PhpParser\BuilderAbstract
      * @return $this The builder instance (for fluid interface)
      */
     public function setTypeHint($type) {
-        $this->type = $this->normalizeType($type);
-        if ($this->type === 'void') {
+        $this->type = BuilderHelpers::normalizeType($type);
+        if ($this->type == 'void') {
             throw new \LogicException('Parameter type cannot be void');
         }
 
@@ -83,9 +84,10 @@ class Param extends PhpParser\BuilderAbstract
      *
      * @return Node\Param The built parameter node
      */
-    public function getNode() {
+    public function getNode() : Node {
         return new Node\Param(
-            $this->name, $this->default, $this->type, $this->byRef, $this->variadic
+            new Node\Expr\Variable($this->name),
+            $this->default, $this->type, $this->byRef, $this->variadic
         );
     }
 }