@@ -255,7 +255,7 @@ |
||
255 | 255 | { |
256 | 256 | $names = array_merge( |
257 | 257 | (array)$names, |
258 | - ($annotationData == null) ? [] : array_map(function ($item) { |
|
258 | + ($annotationData == null) ? [] : array_map(function($item) { |
|
259 | 259 | return "@$item"; |
260 | 260 | }, $annotationData->keys()) |
261 | 261 | ); |
@@ -38,6 +38,9 @@ discard block |
||
38 | 38 | protected $usesOutputInterface; |
39 | 39 | protected $returnType; |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $name |
|
43 | + */ |
|
41 | 44 | public function __construct($name = null) |
42 | 45 | { |
43 | 46 | $commandInfo = false; |
@@ -67,6 +70,9 @@ discard block |
||
67 | 70 | return $this; |
68 | 71 | } |
69 | 72 | |
73 | + /** |
|
74 | + * @param CommandProcessor $commandProcessor |
|
75 | + */ |
|
70 | 76 | public function setCommandProcessor($commandProcessor) |
71 | 77 | { |
72 | 78 | $this->commandProcessor = $commandProcessor; |
@@ -120,6 +126,9 @@ discard block |
||
120 | 126 | return $this; |
121 | 127 | } |
122 | 128 | |
129 | + /** |
|
130 | + * @param CommandInfo $commandInfo |
|
131 | + */ |
|
123 | 132 | public function setCommandInfo($commandInfo) |
124 | 133 | { |
125 | 134 | $this->setDescription($commandInfo->getDescription()); |
@@ -198,6 +207,10 @@ discard block |
||
198 | 207 | return $dom; |
199 | 208 | } |
200 | 209 | |
210 | + /** |
|
211 | + * @param \DOMDocument $dom |
|
212 | + * @param string $tagName |
|
213 | + */ |
|
201 | 214 | protected function getSingleElementByTagName($dom, $parent, $tagName) |
202 | 215 | { |
203 | 216 | // There should always be exactly one '<command>' element. |
@@ -275,6 +288,9 @@ discard block |
||
275 | 288 | return InputArgument::OPTIONAL; |
276 | 289 | } |
277 | 290 | |
291 | + /** |
|
292 | + * @param CommandInfo $commandInfo |
|
293 | + */ |
|
278 | 294 | public function setCommandOptions($commandInfo, $automaticOptions = []) |
279 | 295 | { |
280 | 296 | $inputOptions = $commandInfo->inputOptions(); |
@@ -345,6 +361,9 @@ discard block |
||
345 | 361 | ); |
346 | 362 | } |
347 | 363 | |
364 | + /** |
|
365 | + * @param Hooks\CommandInfo[] $commandInfoList |
|
366 | + */ |
|
348 | 367 | public function optionsHookForHookAnnotations($commandInfoList) |
349 | 368 | { |
350 | 369 | foreach ($commandInfoList as $commandInfo) { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Consolidation\AnnotatedCommand\Parser; |
3 | 3 | |
4 | 4 | use Symfony\Component\Console\Input\InputOption; |
5 | -use Consolidation\AnnotatedCommand\Parser\Internal\CommandDocBlockParser; |
|
6 | 5 | use Consolidation\AnnotatedCommand\Parser\Internal\CommandDocBlockParserFactory; |
7 | 6 | use Consolidation\AnnotatedCommand\AnnotationData; |
8 | 7 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | /** |
31 | 31 | * @var boolean |
32 | 32 | * @var string |
33 | - */ |
|
33 | + */ |
|
34 | 34 | protected $docBlockIsParsed = false; |
35 | 35 | |
36 | 36 | /** |
@@ -137,6 +137,9 @@ discard block |
||
137 | 137 | return filemtime($path) != $cache['mtime']; |
138 | 138 | } |
139 | 139 | |
140 | + /** |
|
141 | + * @param string $methodName |
|
142 | + */ |
|
140 | 143 | protected function constructFromClassAndMethod($classNameOrInstance, $methodName) |
141 | 144 | { |
142 | 145 | $this->otherAnnotations = new AnnotationData(); |
@@ -400,7 +403,7 @@ discard block |
||
400 | 403 | /** |
401 | 404 | * Return the list of refleaction parameters. |
402 | 405 | * |
403 | - * @return ReflectionParameter[] |
|
406 | + * @return \ReflectionParameter[] |
|
404 | 407 | */ |
405 | 408 | public function getParameters() |
406 | 409 | { |
@@ -540,7 +543,7 @@ discard block |
||
540 | 543 | * Examine the parameters of the method for this command, and |
541 | 544 | * build a list of commandline arguements for them. |
542 | 545 | * |
543 | - * @return array |
|
546 | + * @return DefaultsWithDescriptions |
|
544 | 547 | */ |
545 | 548 | protected function determineAgumentClassifications() |
546 | 549 | { |
@@ -560,6 +563,7 @@ discard block |
||
560 | 563 | * Examine the provided parameter, and determine whether it |
561 | 564 | * is a parameter that will be filled in with a positional |
562 | 565 | * commandline argument. |
566 | + * @param DefaultsWithDescriptions $result |
|
563 | 567 | */ |
564 | 568 | protected function addParameterToResult($result, $param) |
565 | 569 | { |
@@ -650,6 +654,8 @@ discard block |
||
650 | 654 | /** |
651 | 655 | * Given a list that might be 'a b c' or 'a, b, c' or 'a,b,c', |
652 | 656 | * convert the data into the last of these forms. |
657 | + * @param string $text |
|
658 | + * @return string |
|
653 | 659 | */ |
654 | 660 | protected static function convertListToCommaSeparated($text) |
655 | 661 | { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function replaceRawAnnotations($annotationData) |
229 | 229 | { |
230 | - $this->otherAnnotations = new AnnotationData((array) $annotationData); |
|
230 | + $this->otherAnnotations = new AnnotationData((array)$annotationData); |
|
231 | 231 | return $this; |
232 | 232 | } |
233 | 233 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | // Convert to an array and merge if there are multiple |
310 | 310 | // instances of the same annotation defined. |
311 | 311 | if (isset($this->otherAnnotations[$name])) { |
312 | - $content = array_merge((array) $this->otherAnnotations[$name], (array)$content); |
|
312 | + $content = array_merge((array)$this->otherAnnotations[$name], (array)$content); |
|
313 | 313 | } |
314 | 314 | $this->otherAnnotations[$name] = $content; |
315 | 315 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $opts = $this->options()->getValues(); |
488 | 488 | foreach ($opts as $name => $defaultValue) { |
489 | 489 | if ($defaultValue === true) { |
490 | - $key = 'no-' . $name; |
|
490 | + $key = 'no-'.$name; |
|
491 | 491 | if (!array_key_exists($key, $opts)) { |
492 | 492 | $description = "Negate --$name option."; |
493 | 493 | $this->options()->add($key, $description, false); |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | */ |
692 | 692 | protected function convertName($camel) |
693 | 693 | { |
694 | - $splitter="-"; |
|
695 | - $camel=preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', $splitter.'$0', $camel)); |
|
694 | + $splitter = "-"; |
|
695 | + $camel = preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', $splitter.'$0', $camel)); |
|
696 | 696 | $camel = preg_replace("/$splitter/", ':', $camel, 1); |
697 | 697 | return strtolower($camel); |
698 | 698 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function get($key) |
36 | 36 | { |
37 | - return (array) $this->dataStore->get($key); |
|
37 | + return (array)$this->dataStore->get($key); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function __construct($values = [], $defaultDefault = null) |
33 | 33 | { |
34 | 34 | $this->values = $values; |
35 | - $this->hasDefault = array_filter($this->values, function ($value) { |
|
35 | + $this->hasDefault = array_filter($this->values, function($value) { |
|
36 | 36 | return isset($value); |
37 | 37 | }); |
38 | 38 | $this->descriptions = []; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function hasReplaceCommandHook() |
22 | 22 | { |
23 | - return (bool) count($this->getReplaceCommandHooks()); |
|
23 | + return (bool)count($this->getReplaceCommandHooks()); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -72,6 +72,9 @@ |
||
72 | 72 | $options->setWidth($width); |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @return CommandData |
|
77 | + */ |
|
75 | 78 | protected function getTerminalWidth() |
76 | 79 | { |
77 | 80 | // Don't wrap if wrapping has been disabled. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * For internal use only; indicates that the function to be called |
42 | 42 | * should be passed an InputInterface &/or an OutputInterface. |
43 | - * @param booean $usesInputInterface |
|
43 | + * @param boolean $usesInputInterface |
|
44 | 44 | * @param boolean $usesOutputInterface |
45 | 45 | * @return self |
46 | 46 | */ |
@@ -151,6 +151,9 @@ discard block |
||
151 | 151 | return in_array($option, $this->specialDefaults); |
152 | 152 | } |
153 | 153 | |
154 | + /** |
|
155 | + * @param \Symfony\Component\Console\Input\InputDefinition $definition |
|
156 | + */ |
|
154 | 157 | public function cacheSpecialDefaults($definition) |
155 | 158 | { |
156 | 159 | foreach ($definition->getOptions() as $option => $inputOption) { |
@@ -136,7 +136,7 @@ |
||
136 | 136 | if ($value === true) { |
137 | 137 | // Check if the --no-* option exists. Note that none of the other |
138 | 138 | // alteration apply in the $value == true case, so we can exit early here. |
139 | - $negation_key = 'no-' . $option; |
|
139 | + $negation_key = 'no-'.$option; |
|
140 | 140 | return array_key_exists($negation_key, $options) && $options[$negation_key]; |
141 | 141 | } |
142 | 142 |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // can never be commands. |
247 | 247 | $commandMethodNames = array_filter( |
248 | 248 | get_class_methods($classNameOrInstance) ?: [], |
249 | - function ($m) use ($classNameOrInstance) { |
|
249 | + function($m) use ($classNameOrInstance) { |
|
250 | 250 | $reflectionMethod = new \ReflectionMethod($classNameOrInstance, $m); |
251 | 251 | return !$reflectionMethod->isStatic() && !preg_match('#^_#', $m); |
252 | 252 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | if (!static::isCommandOrHookMethod($commandInfo, $this->getIncludeAllPublicMethods())) { |
259 | 259 | $commandInfo->invalidate(); |
260 | 260 | } |
261 | - $commandInfoList[$commandMethodName] = $commandInfo; |
|
261 | + $commandInfoList[$commandMethodName] = $commandInfo; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | return $this->createSelectedCommandsFromClassInfo( |
280 | 280 | $commandInfoList, |
281 | 281 | $commandFileInstance, |
282 | - function ($commandInfo) use ($includeAllPublicMethods) { |
|
282 | + function($commandInfo) use ($includeAllPublicMethods) { |
|
283 | 283 | return static::isCommandMethod($commandInfo, $includeAllPublicMethods); |
284 | 284 | } |
285 | 285 | ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $commandInfoList = $this->filterCommandInfoList($commandInfoList, $commandSelector); |
291 | 291 | return array_map( |
292 | - function ($commandInfo) use ($commandFileInstance) { |
|
292 | + function($commandInfo) use ($commandFileInstance) { |
|
293 | 293 | return $this->createCommand($commandInfo, $commandFileInstance); |
294 | 294 | }, |
295 | 295 | $commandInfoList |