Completed
Pull Request — master (#130)
by Greg
01:42
created
src/AnnotatedCommandFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Parser/Internal/DocblockTag.php 2 patches
Doc Comments   +5 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function splitTagAndContent($subject, &$matches)
47 47
     {
48
-        $regex = '/' . self::TAG_REGEX . self::DESCRIPTION_REGEX . '/';
48
+        $regex = '/'.self::TAG_REGEX.self::DESCRIPTION_REGEX.'/';
49 49
         return preg_match($regex, $subject, $matches);
50 50
     }
51 51
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
122 122
      */
123 123
     public function hasVariableAndDescription(&$matches)
124 124
     {
125
-        $regex = '/' . self::VARIABLE_OR_WORD_REGEX . self::DESCRIPTION_REGEX . '/';
125
+        $regex = '/'.self::VARIABLE_OR_WORD_REGEX.self::DESCRIPTION_REGEX.'/';
126 126
         return preg_match($regex, $this->getContent(), $matches);
127 127
     }
128 128
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function hasTypeVariableAndDescription(&$matches)
138 138
     {
139
-        $regex = '/' . self::TYPE_REGEX . self::VARIABLE_REGEX . self::DESCRIPTION_REGEX . '/';
139
+        $regex = '/'.self::TYPE_REGEX.self::VARIABLE_REGEX.self::DESCRIPTION_REGEX.'/';
140 140
         return preg_match($regex, $this->getContent(), $matches);
141 141
     }
142 142
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function hasWordAndDescription(&$matches)
151 151
     {
152
-        $regex = '/' . self::WORD_REGEX . self::DESCRIPTION_REGEX . '/';
152
+        $regex = '/'.self::WORD_REGEX.self::DESCRIPTION_REGEX.'/';
153 153
         return preg_match($regex, $this->getContent(), $matches);
154 154
     }
155 155
 }
Please login to merge, or discard this patch.
src/Parser/Internal/TagFactory.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -21,6 +21,9 @@
 block discarded – undo
21 21
         $this->tags = [];
22 22
     }
23 23
 
24
+    /**
25
+     * @param string $line
26
+     */
24 27
     public function parseLine($line)
25 28
     {
26 29
         if (DocblockTag::isTag($line)) {
Please login to merge, or discard this patch.
src/Parser/Internal/BespokeDocBlockParser.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -230,6 +230,9 @@
 block discarded – undo
230 230
         return !empty($nextLine);
231 231
     }
232 232
 
233
+    /**
234
+     * @param DocblockTag[] $tags
235
+     */
233 236
     protected function processAllTags($tags)
234 237
     {
235 238
         // Iterate over all of the tags, and process them as necessary.
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     protected function processCommandTag($tag)
60 60
     {
61 61
         if (!$tag->hasWordAndDescription($matches)) {
62
-            throw new \Exception('Could not determine command name from tag ' . (string)$tag);
62
+            throw new \Exception('Could not determine command name from tag '.(string)$tag);
63 63
         }
64 64
         $commandName = $matches['word'];
65 65
         $this->commandInfo->setName($commandName);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     protected function processArgumentTag($tag)
87 87
     {
88 88
         if (!$tag->hasVariable($matches)) {
89
-            throw new \Exception('Could not determine parameter name from tag ' . (string)$tag);
89
+            throw new \Exception('Could not determine parameter name from tag '.(string)$tag);
90 90
         }
91 91
         if ($matches['variable'] == $this->optionParamName()) {
92 92
             return;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     protected function processOptionTag($tag)
101 101
     {
102 102
         if (!$tag->hasVariable($matches)) {
103
-            throw new \Exception('Could not determine parameter name from tag ' . (string)$tag);
103
+            throw new \Exception('Could not determine parameter name from tag '.(string)$tag);
104 104
         }
105 105
         $this->addOptionOrArgumentTag($tag, $this->commandInfo->options(), $matches['variable'], $matches['description']);
106 106
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     protected function processDefaultTag($tag)
120 120
     {
121 121
         if (!$tag->hasWordAndDescription($matches)) {
122
-            throw new \Exception('Could not determine parameter name from tag ' . (string)$tag);
122
+            throw new \Exception('Could not determine parameter name from tag '.(string)$tag);
123 123
         }
124 124
         $variableName = $matches['word'];
125 125
         $defaultValue = $this->interpretDefaultValue($matches['description']);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $lines = explode("\n", $tag->getContent());
142 142
         $usage = trim(array_shift($lines));
143
-        $description = static::removeLineBreaks(implode("\n", array_map(function ($line) {
143
+        $description = static::removeLineBreaks(implode("\n", array_map(function($line) {
144 144
             return trim($line);
145 145
         }, $lines)));
146 146
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     protected function processReturnTag($tag)
162 162
     {
163 163
         if (!$tag->hasWordAndDescription($matches)) {
164
-            throw new \Exception('Could not determine return type from tag ' . (string)$tag);
164
+            throw new \Exception('Could not determine return type from tag '.(string)$tag);
165 165
         }
166 166
         // TODO: look at namespace and `use` statments to make returnType a fqdn
167 167
         $returnType = $matches['word'];
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         // Trim all of the lines individually.
202 202
         $lines =
203 203
             array_map(
204
-                function ($line) {
204
+                function($line) {
205 205
                     return trim($line);
206 206
                 },
207 207
                 $lines
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         // Everything up to the first blank line goes in the description.
211 211
         $description = array_shift($lines);
212 212
         while ($this->nextLineIsNotEmpty($lines)) {
213
-            $description .= ' ' . array_shift($lines);
213
+            $description .= ' '.array_shift($lines);
214 214
         }
215 215
 
216 216
         // Everything else goes in the help.
Please login to merge, or discard this patch.