@@ -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 | ); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * Add a hook |
| 66 | 66 | * |
| 67 | - * @param mixed $callback The callback function to call |
|
| 67 | + * @param callable $callback The callback function to call |
|
| 68 | 68 | * @param string $hook The name of the hook to add |
| 69 | 69 | * @param string $name The name of the command to hook |
| 70 | 70 | * ('*' for all) |
@@ -78,12 +78,18 @@ discard block |
||
| 78 | 78 | return $this; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | + /** |
|
| 82 | + * @param \Consolidation\AnnotatedCommand\Parser\CommandInfo $commandInfo |
|
| 83 | + */ |
|
| 81 | 84 | public function recordHookOptions($commandInfo, $name) |
| 82 | 85 | { |
| 83 | 86 | $this->hookOptions[$name][] = $commandInfo; |
| 84 | 87 | return $this; |
| 85 | 88 | } |
| 86 | 89 | |
| 90 | + /** |
|
| 91 | + * @param \Consolidation\AnnotatedCommand\AnnotatedCommand $command |
|
| 92 | + */ |
|
| 87 | 93 | public static function getNames($command, $callback) |
| 88 | 94 | { |
| 89 | 95 | return array_filter( |
@@ -306,6 +312,9 @@ discard block |
||
| 306 | 312 | $command->optionsHookForHookAnnotations($commandInfoList); |
| 307 | 313 | } |
| 308 | 314 | |
| 315 | + /** |
|
| 316 | + * @param \Consolidation\AnnotatedCommand\AnnotatedCommand $command |
|
| 317 | + */ |
|
| 309 | 318 | public function getHookOptionsForCommand($command) |
| 310 | 319 | { |
| 311 | 320 | $names = $this->addWildcardHooksToNames($command->getNames(), $command->getAnnotationData()); |
@@ -417,6 +426,9 @@ discard block |
||
| 417 | 426 | return $result; |
| 418 | 427 | } |
| 419 | 428 | |
| 429 | + /** |
|
| 430 | + * @param string[] $names |
|
| 431 | + */ |
|
| 420 | 432 | protected function getCommandEventHooks($names) |
| 421 | 433 | { |
| 422 | 434 | return $this->getHooks( |
@@ -537,6 +549,7 @@ discard block |
||
| 537 | 549 | * |
| 538 | 550 | * @param string|array $names The name of the function being hooked. |
| 539 | 551 | * @param string[] $hooks A list of hooks (e.g. [HookManager::ALTER_RESULT]) |
| 552 | + * @param AnnotationData $annotationData |
|
| 540 | 553 | * |
| 541 | 554 | * @return callable[] |
| 542 | 555 | */ |
@@ -592,6 +605,10 @@ discard block |
||
| 592 | 605 | return []; |
| 593 | 606 | } |
| 594 | 607 | |
| 608 | + /** |
|
| 609 | + * @param callable $provider |
|
| 610 | + * @param InputInterface $input |
|
| 611 | + */ |
|
| 595 | 612 | protected function callInjectConfigurationHook($provider, $input, AnnotationData $annotationData) |
| 596 | 613 | { |
| 597 | 614 | if ($provider instanceof InitializeHookInterface) { |
@@ -602,6 +619,10 @@ discard block |
||
| 602 | 619 | } |
| 603 | 620 | } |
| 604 | 621 | |
| 622 | + /** |
|
| 623 | + * @param callable $optionHook |
|
| 624 | + * @param \Consolidation\AnnotatedCommand\AnnotatedCommand $command |
|
| 625 | + */ |
|
| 605 | 626 | protected function callOptionHook($optionHook, $command, AnnotationData $annotationData) |
| 606 | 627 | { |
| 607 | 628 | if ($optionHook instanceof OptionHookInterface) { |
@@ -612,6 +633,11 @@ discard block |
||
| 612 | 633 | } |
| 613 | 634 | } |
| 614 | 635 | |
| 636 | + /** |
|
| 637 | + * @param callable $interactor |
|
| 638 | + * @param InputInterface $input |
|
| 639 | + * @param OutputInterface $output |
|
| 640 | + */ |
|
| 615 | 641 | protected function callInteractor($interactor, $input, $output, AnnotationData $annotationData) |
| 616 | 642 | { |
| 617 | 643 | if ($interactor instanceof InteractorInterface) { |
@@ -622,6 +648,9 @@ discard block |
||
| 622 | 648 | } |
| 623 | 649 | } |
| 624 | 650 | |
| 651 | + /** |
|
| 652 | + * @param callable $validator |
|
| 653 | + */ |
|
| 625 | 654 | protected function callValidator($validator, CommandData $commandData) |
| 626 | 655 | { |
| 627 | 656 | if ($validator instanceof ValidatorInterface) { |
@@ -632,6 +661,9 @@ discard block |
||
| 632 | 661 | } |
| 633 | 662 | } |
| 634 | 663 | |
| 664 | + /** |
|
| 665 | + * @param callable $processor |
|
| 666 | + */ |
|
| 635 | 667 | protected function callProcessor($processor, $result, CommandData $commandData) |
| 636 | 668 | { |
| 637 | 669 | $processed = null; |
@@ -647,6 +679,9 @@ discard block |
||
| 647 | 679 | return $result; |
| 648 | 680 | } |
| 649 | 681 | |
| 682 | + /** |
|
| 683 | + * @param callable $determiner |
|
| 684 | + */ |
|
| 650 | 685 | protected function callDeterminer($determiner, $result) |
| 651 | 686 | { |
| 652 | 687 | if ($determiner instanceof StatusDeterminerInterface) { |
@@ -657,6 +692,9 @@ discard block |
||
| 657 | 692 | } |
| 658 | 693 | } |
| 659 | 694 | |
| 695 | + /** |
|
| 696 | + * @param callable $extractor |
|
| 697 | + */ |
|
| 660 | 698 | protected function callExtractor($extractor, $result) |
| 661 | 699 | { |
| 662 | 700 | if ($extractor instanceof ExtractOutputInterface) { |
@@ -231,6 +231,10 @@ |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | + /** |
|
| 235 | + * @param string $string |
|
| 236 | + * @param integer $n |
|
| 237 | + */ |
|
| 234 | 238 | protected function getNthWord($string, $n, $default = '', $delimiter = ' ') |
| 235 | 239 | { |
| 236 | 240 | $words = explode($delimiter, $string); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return []; |
| 179 | 179 | } |
| 180 | 180 | $className = get_class($commandFileInstance); |
| 181 | - $cache_data = (array) $this->getDataStore()->get($className); |
|
| 181 | + $cache_data = (array)$this->getDataStore()->get($className); |
|
| 182 | 182 | if (!$cache_data) { |
| 183 | 183 | return []; |
| 184 | 184 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | // can never be commands. |
| 233 | 233 | $commandMethodNames = array_filter( |
| 234 | 234 | get_class_methods($classNameOrInstance) ?: [], |
| 235 | - function ($m) { |
|
| 235 | + function($m) { |
|
| 236 | 236 | return !preg_match('#^_#', $m); |
| 237 | 237 | } |
| 238 | 238 | ); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | return $this->createSelectedCommandsFromClassInfo( |
| 259 | 259 | $commandInfoList, |
| 260 | 260 | $commandFileInstance, |
| 261 | - function ($commandInfo) use ($includeAllPublicMethods) { |
|
| 261 | + function($commandInfo) use ($includeAllPublicMethods) { |
|
| 262 | 262 | return static::isCommandMethod($commandInfo, $includeAllPublicMethods); |
| 263 | 263 | } |
| 264 | 264 | ); |
@@ -207,6 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * Given a docblock description in the form "$variable description", |
| 209 | 209 | * return the variable name and description via the 'match' parameter. |
| 210 | + * @param string $source |
|
| 210 | 211 | */ |
| 211 | 212 | protected function pregMatchNameAndDescription($source, &$match) |
| 212 | 213 | { |
@@ -220,6 +221,7 @@ discard block |
||
| 220 | 221 | /** |
| 221 | 222 | * Given a docblock description in the form "$variable description", |
| 222 | 223 | * return the variable name and description via the 'match' parameter. |
| 224 | + * @param string $source |
|
| 223 | 225 | */ |
| 224 | 226 | protected function pregMatchOptionNameAndDescription($source, &$match) |
| 225 | 227 | { |
@@ -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) { |
@@ -144,6 +144,9 @@ discard block |
||
| 144 | 144 | return filemtime($path) != $cache['mtime']; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $methodName |
|
| 149 | + */ |
|
| 147 | 150 | protected function constructFromClassAndMethod($classNameOrInstance, $methodName) |
| 148 | 151 | { |
| 149 | 152 | $this->otherAnnotations = new AnnotationData(); |
@@ -462,7 +465,7 @@ discard block |
||
| 462 | 465 | /** |
| 463 | 466 | * Set aliases that can be used in place of the command's primary name. |
| 464 | 467 | * |
| 465 | - * @param string|string[] $aliases |
|
| 468 | + * @param string $aliases |
|
| 466 | 469 | */ |
| 467 | 470 | public function setAliases($aliases) |
| 468 | 471 | { |
@@ -516,7 +519,7 @@ discard block |
||
| 516 | 519 | /** |
| 517 | 520 | * Return the list of refleaction parameters. |
| 518 | 521 | * |
| 519 | - * @return ReflectionParameter[] |
|
| 522 | + * @return \ReflectionParameter[] |
|
| 520 | 523 | */ |
| 521 | 524 | public function getParameters() |
| 522 | 525 | { |
@@ -647,7 +650,7 @@ discard block |
||
| 647 | 650 | * Examine the parameters of the method for this command, and |
| 648 | 651 | * build a list of commandline arguements for them. |
| 649 | 652 | * |
| 650 | - * @return array |
|
| 653 | + * @return DefaultsWithDescriptions |
|
| 651 | 654 | */ |
| 652 | 655 | protected function determineAgumentClassifications() |
| 653 | 656 | { |
@@ -667,6 +670,7 @@ discard block |
||
| 667 | 670 | * Examine the provided parameter, and determine whether it |
| 668 | 671 | * is a parameter that will be filled in with a positional |
| 669 | 672 | * commandline argument. |
| 673 | + * @param DefaultsWithDescriptions $result |
|
| 670 | 674 | */ |
| 671 | 675 | protected function addParameterToResult($result, $param) |
| 672 | 676 | { |
@@ -757,6 +761,8 @@ discard block |
||
| 757 | 761 | /** |
| 758 | 762 | * Given a list that might be 'a b c' or 'a, b, c' or 'a,b,c', |
| 759 | 763 | * convert the data into the last of these forms. |
| 764 | + * @param string $text |
|
| 765 | + * @return string |
|
| 760 | 766 | */ |
| 761 | 767 | protected static function convertListToCommaSeparated($text) |
| 762 | 768 | { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $this->name = $info_array['name']; |
| 162 | 162 | $this->methodName = $info_array['method_name']; |
| 163 | - $this->otherAnnotations = new AnnotationData((array) $info_array['annotations']); |
|
| 163 | + $this->otherAnnotations = new AnnotationData((array)$info_array['annotations']); |
|
| 164 | 164 | $this->arguments = new DefaultsWithDescriptions(); |
| 165 | 165 | $this->options = new DefaultsWithDescriptions(); |
| 166 | 166 | $this->aliases = $info_array['aliases']; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | $this->input_options = []; |
| 188 | 188 | foreach ((array)$info_array['input_options'] as $i => $option) { |
| 189 | - $option = (array) $option; |
|
| 189 | + $option = (array)$option; |
|
| 190 | 190 | $this->inputOptions[$i] = new InputOption( |
| 191 | 191 | $option['name'], |
| 192 | 192 | $option['shortcut'], |
@@ -734,8 +734,8 @@ discard block |
||
| 734 | 734 | */ |
| 735 | 735 | protected function convertName($camel) |
| 736 | 736 | { |
| 737 | - $splitter="-"; |
|
| 738 | - $camel=preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', $splitter.'$0', $camel)); |
|
| 737 | + $splitter = "-"; |
|
| 738 | + $camel = preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', $splitter.'$0', $camel)); |
|
| 739 | 739 | $camel = preg_replace("/$splitter/", ':', $camel, 1); |
| 740 | 740 | return strtolower($camel); |
| 741 | 741 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSearchDepth() |
| 249 | 249 | { |
| 250 | - return $this->searchDepth <= 0 ? '== 0' : '<= ' . $this->searchDepth; |
|
| 250 | + return $this->searchDepth <= 0 ? '== 0' : '<= '.$this->searchDepth; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | return $this->joinParts( |
| 342 | 342 | '\\', |
| 343 | 343 | $namespaceParts, |
| 344 | - function ($item) { |
|
| 344 | + function($item) { |
|
| 345 | 345 | return !is_numeric($item) && !empty($item); |
| 346 | 346 | } |
| 347 | 347 | ); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $path = $this->joinParts( |
| 361 | 361 | '/', |
| 362 | 362 | $pathParts, |
| 363 | - function ($item) { |
|
| 363 | + function($item) { |
|
| 364 | 364 | return !empty($item); |
| 365 | 365 | } |
| 366 | 366 | ); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | protected function joinParts($delimiter, $parts, $filterFunction) |
| 378 | 378 | { |
| 379 | 379 | $parts = array_map( |
| 380 | - function ($item) use ($delimiter) { |
|
| 380 | + function($item) use ($delimiter) { |
|
| 381 | 381 | return rtrim($item, $delimiter); |
| 382 | 382 | }, |
| 383 | 383 | $parts |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * For internal use only; indicates that the function to be called |
| 41 | 41 | * should be passed an InputInterface &/or an OutputInterface. |
| 42 | - * @param booean $usesInputInterface |
|
| 42 | + * @param boolean $usesInputInterface |
|
| 43 | 43 | * @param boolean $usesOutputInterface |
| 44 | 44 | * @return self |
| 45 | 45 | */ |
@@ -87,6 +87,10 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | // TODO: This should be a required constructor argument, but |
| 89 | 89 | // implementing it this way to maintain backwards compatibility. |
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @param string $filePath |
|
| 93 | + */ |
|
| 90 | 94 | public function setFilePath($filePath) |
| 91 | 95 | { |
| 92 | 96 | $this->filePath = $filePath; |