comparison 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
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
18 class CommandInfo 18 class CommandInfo
19 { 19 {
20 /** 20 /**
21 * Serialization schema version. Incremented every time the serialization schema changes. 21 * Serialization schema version. Incremented every time the serialization schema changes.
22 */ 22 */
23 const SERIALIZATION_SCHEMA_VERSION = 3; 23 const SERIALIZATION_SCHEMA_VERSION = 4;
24 24
25 /** 25 /**
26 * @var \ReflectionMethod 26 * @var \ReflectionMethod
27 */ 27 */
28 protected $reflection; 28 protected $reflection;
85 85
86 /** 86 /**
87 * @var string 87 * @var string
88 */ 88 */
89 protected $returnType; 89 protected $returnType;
90
91 /**
92 * @var string[]
93 */
94 protected $injectedClasses = [];
90 95
91 /** 96 /**
92 * Create a new CommandInfo class for a particular method of a class. 97 * Create a new CommandInfo class for a particular method of a class.
93 * 98 *
94 * @param string|mixed $classNameOrInstance The name of a class, or an 99 * @param string|mixed $classNameOrInstance The name of a class, or an
199 204
200 public function getReturnType() 205 public function getReturnType()
201 { 206 {
202 $this->parseDocBlock(); 207 $this->parseDocBlock();
203 return $this->returnType; 208 return $this->returnType;
209 }
210
211 public function getInjectedClasses()
212 {
213 $this->parseDocBlock();
214 return $this->injectedClasses;
215 }
216
217 public function setInjectedClasses($injectedClasses)
218 {
219 $this->injectedClasses = $injectedClasses;
220 return $this;
204 } 221 }
205 222
206 public function setReturnType($returnType) 223 public function setReturnType($returnType)
207 { 224 {
208 $this->returnType = $returnType; 225 $this->returnType = $returnType;
632 $params = $this->reflection->getParameters(); 649 $params = $this->reflection->getParameters();
633 $optionsFromParameters = $this->determineOptionsFromParameters(); 650 $optionsFromParameters = $this->determineOptionsFromParameters();
634 if ($this->lastParameterIsOptionsArray()) { 651 if ($this->lastParameterIsOptionsArray()) {
635 array_pop($params); 652 array_pop($params);
636 } 653 }
654 while (!empty($params) && ($params[0]->getClass() != null)) {
655 $param = array_shift($params);
656 $injectedClass = $param->getClass()->getName();
657 array_unshift($this->injectedClasses, $injectedClass);
658 }
637 foreach ($params as $param) { 659 foreach ($params as $param) {
638 $this->addParameterToResult($result, $param); 660 $this->addParameterToResult($result, $param);
639 } 661 }
640 return $result; 662 return $result;
641 } 663 }