@@ -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 | ); |
@@ -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 | /** |
@@ -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 | } |
@@ -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. |
@@ -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 |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Check if the provided string begins with a tag |
| 31 | 31 | * @param string $subject |
| 32 | - * @return bool |
|
| 32 | + * @return integer |
|
| 33 | 33 | */ |
| 34 | 34 | public static function isTag($subject) |
| 35 | 35 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param string $subject |
| 43 | 43 | * @param string[] &$matches Sets $matches['tag'] and $matches['description'] |
| 44 | - * @return bool |
|
| 44 | + * @return integer |
|
| 45 | 45 | */ |
| 46 | 46 | public static function splitTagAndContent($subject, &$matches) |
| 47 | 47 | { |
@@ -101,7 +101,6 @@ discard block |
||
| 101 | 101 | * - "@tag $variable description" |
| 102 | 102 | * - "@tag type $variable description" |
| 103 | 103 | * |
| 104 | - * @param string $subject |
|
| 105 | 104 | * @param string[] &$matches Sets $matches['variable'] and |
| 106 | 105 | * $matches['description']; might set $matches['type']. |
| 107 | 106 | * @return bool |
@@ -115,10 +114,9 @@ discard block |
||
| 115 | 114 | |
| 116 | 115 | /** |
| 117 | 116 | * Determine if tag is "@tag $variable description" |
| 118 | - * @param string $subject |
|
| 119 | 117 | * @param string[] &$matches Sets $matches['variable'] and |
| 120 | 118 | * $matches['description'] |
| 121 | - * @return bool |
|
| 119 | + * @return integer |
|
| 122 | 120 | */ |
| 123 | 121 | public function hasVariableAndDescription(&$matches) |
| 124 | 122 | { |
@@ -129,10 +127,9 @@ discard block |
||
| 129 | 127 | /** |
| 130 | 128 | * Determine if tag is "@tag type $variable description" |
| 131 | 129 | * |
| 132 | - * @param string $subject |
|
| 133 | 130 | * @param string[] &$matches Sets $matches['variable'], |
| 134 | 131 | * $matches['description'] and $matches['type']. |
| 135 | - * @return bool |
|
| 132 | + * @return integer |
|
| 136 | 133 | */ |
| 137 | 134 | public function hasTypeVariableAndDescription(&$matches) |
| 138 | 135 | { |
@@ -142,10 +139,9 @@ discard block |
||
| 142 | 139 | |
| 143 | 140 | /** |
| 144 | 141 | * Determine if tag is "@tag word description" |
| 145 | - * @param string $subject |
|
| 146 | 142 | * @param string[] &$matches Sets $matches['word'] and |
| 147 | 143 | * $matches['description'] |
| 148 | - * @return bool |
|
| 144 | + * @return integer |
|
| 149 | 145 | */ |
| 150 | 146 | public function hasWordAndDescription(&$matches) |
| 151 | 147 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function splitTagAndContent($subject, &$matches) |
| 47 | 47 | { |
| 48 | - $regex = '/' . self::TAG_REGEX . self::DESCRIPTION_REGEX . '/s'; |
|
| 48 | + $regex = '/'.self::TAG_REGEX.self::DESCRIPTION_REGEX.'/s'; |
|
| 49 | 49 | return preg_match($regex, $subject, $matches); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function __toString() |
| 94 | 94 | { |
| 95 | - return '@' . $this->getTag() . ' ' . $this->getContent(); |
|
| 95 | + return '@'.$this->getTag().' '.$this->getContent(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function hasVariableAndDescription(&$matches) |
| 124 | 124 | { |
| 125 | - $regex = '/^\s*' . self::VARIABLE_OR_WORD_REGEX . self::DESCRIPTION_REGEX . '/s'; |
|
| 125 | + $regex = '/^\s*'.self::VARIABLE_OR_WORD_REGEX.self::DESCRIPTION_REGEX.'/s'; |
|
| 126 | 126 | return preg_match($regex, $this->getContent(), $matches); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function hasTypeVariableAndDescription(&$matches) |
| 138 | 138 | { |
| 139 | - $regex = '/^\s*' . self::TYPE_REGEX . self::VARIABLE_REGEX . self::DESCRIPTION_REGEX . '/s'; |
|
| 139 | + $regex = '/^\s*'.self::TYPE_REGEX.self::VARIABLE_REGEX.self::DESCRIPTION_REGEX.'/s'; |
|
| 140 | 140 | return preg_match($regex, $this->getContent(), $matches); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function hasWordAndDescription(&$matches) |
| 151 | 151 | { |
| 152 | - $regex = '/^\s*' . self::WORD_REGEX . self::DESCRIPTION_REGEX . '/s'; |
|
| 152 | + $regex = '/^\s*'.self::WORD_REGEX.self::DESCRIPTION_REGEX.'/s'; |
|
| 153 | 153 | return preg_match($regex, $this->getContent(), $matches); |
| 154 | 154 | } |
| 155 | 155 | } |