diff vendor/consolidation/annotated-command/src/Parser/CommandInfo.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
line wrap: on
line diff
--- a/vendor/consolidation/annotated-command/src/Parser/CommandInfo.php	Thu Feb 28 11:14:44 2019 +0000
+++ b/vendor/consolidation/annotated-command/src/Parser/CommandInfo.php	Thu Feb 28 13:11:55 2019 +0000
@@ -20,7 +20,7 @@
     /**
      * Serialization schema version. Incremented every time the serialization schema changes.
      */
-    const SERIALIZATION_SCHEMA_VERSION = 3;
+    const SERIALIZATION_SCHEMA_VERSION = 4;
 
     /**
      * @var \ReflectionMethod
@@ -89,6 +89,11 @@
     protected $returnType;
 
     /**
+     * @var string[]
+     */
+    protected $injectedClasses = [];
+
+    /**
      * Create a new CommandInfo class for a particular method of a class.
      *
      * @param string|mixed $classNameOrInstance The name of a class, or an
@@ -203,6 +208,18 @@
         return $this->returnType;
     }
 
+    public function getInjectedClasses()
+    {
+        $this->parseDocBlock();
+        return $this->injectedClasses;
+    }
+
+    public function setInjectedClasses($injectedClasses)
+    {
+        $this->injectedClasses = $injectedClasses;
+        return $this;
+    }
+
     public function setReturnType($returnType)
     {
         $this->returnType = $returnType;
@@ -634,6 +651,11 @@
         if ($this->lastParameterIsOptionsArray()) {
             array_pop($params);
         }
+        while (!empty($params) && ($params[0]->getClass() != null)) {
+            $param = array_shift($params);
+            $injectedClass = $param->getClass()->getName();
+            array_unshift($this->injectedClasses, $injectedClass);
+        }
         foreach ($params as $param) {
             $this->addParameterToResult($result, $param);
         }