Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / phpspec / prophecy / src / Prophecy / Doubler / Generator / Node / ClassNode.php
index 1499a1d325a6e26e61d401f5e4793b699aee2f34..f7bd2857a420e03b6039880722ef25952206cb1f 100644 (file)
@@ -100,7 +100,7 @@ class ClassNode
         return $this->methods;
     }
 
-    public function addMethod(MethodNode $method)
+    public function addMethod(MethodNode $method, $force = false)
     {
         if (!$this->isExtendable($method->getName())){
             $message = sprintf(
@@ -108,7 +108,10 @@ class ClassNode
             );
             throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName());
         }
-        $this->methods[$method->getName()] = $method;
+
+        if ($force || !isset($this->methods[$method->getName()])) {
+            $this->methods[$method->getName()] = $method;
+        }
     }
 
     public function removeMethod($name)