Passed
Push — master ( aeb9ac...77abce )
by Francesco
01:19 queued 10s
created
src/Builder/ClassFileBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     {
59 59
         $implementedInterfaces = '';
60 60
         foreach ($element->getInterfaces() as $int) {
61
-            $implementedInterfaces .= $this->getLink('interface', $int).' ';
61
+            $implementedInterfaces .= $this->getLink('interface', $int) . ' ';
62 62
         }
63 63
         if ($implementedInterfaces !== '') {
64 64
             $this->addFieldList('Implements', $implementedInterfaces);
Please login to merge, or discard this patch.
src/Builder/PhpDomainBuilder.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
  */
44 44
 class PhpDomainBuilder extends RstBuilder
45 45
 {
46
-    const SECTION_BEFORE_DESCRIPTION = self::class.'::SECTION_BEFORE_DESCRIPTION';
47
-    const SECTION_AFTER_DESCRIPTION = self::class.'::SECTION_AFTER_DESCRIPTION';
48
-    const SECTION_AFTER_TITLE = self::class.'::SECTION_AFTER_TITLE';
49
-    const SECTION_AFTER_INTRODUCTION = self::class.'::SECTION_AFTER_INTRODUCTION';
46
+    const SECTION_BEFORE_DESCRIPTION = self::class . '::SECTION_BEFORE_DESCRIPTION';
47
+    const SECTION_AFTER_DESCRIPTION = self::class . '::SECTION_AFTER_DESCRIPTION';
48
+    const SECTION_AFTER_TITLE = self::class . '::SECTION_AFTER_TITLE';
49
+    const SECTION_AFTER_INTRODUCTION = self::class . '::SECTION_AFTER_INTRODUCTION';
50 50
 
51 51
     use ExtensionBuilder {
52 52
         ExtensionBuilder::__construct as private __extensionConstructor;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function __construct($extensions)
56 56
     {
57 57
         $this->__extensionConstructor($extensions);
58
-        $this->addMultiline('.. role:: php(code)'.PHP_EOL.':language: php', true);
58
+        $this->addMultiline('.. role:: php(code)' . PHP_EOL . ':language: php', true);
59 59
         $this->addLine();
60 60
     }
61 61
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $modifiers = $element->isAbstract() ? ' abstract' : '';
75 75
             $modifiers = $element->isFinal() ? ' final' : $modifiers;
76 76
             if ($modifiers !== '') {
77
-                $this->addLine('.. rst-class:: '.$modifiers)->addLine();
77
+                $this->addLine('.. rst-class:: ' . $modifiers)->addLine();
78 78
             }
79 79
         }
80 80
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public static function getNamespace(Element $element)
95 95
     {
96
-        return substr($element->getFqsen(), 0, strlen($element->getFqsen()) - strlen('\\'.$element->getName()));
96
+        return substr($element->getFqsen(), 0, strlen($element->getFqsen()) - strlen('\\' . $element->getName()));
97 97
         //return str_replace('\\' . $element->getName(), '', $element->getFqsen());
98 98
     }
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     public function beginPhpDomain($type, $name, $indent = true)
106 106
     {
107 107
         // FIXME: Add checks if it is properly ended
108
-        $this->addLine('.. php:'.$type.':: '.$name)->addLine();
108
+        $this->addLine('.. php:' . $type . ':: ' . $name)->addLine();
109 109
         if ($indent === true) {
110 110
             $this->indent();
111 111
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     private function addConstant(Constant $constant)
170 170
     {
171
-        $this->beginPhpDomain('const', $constant->getName().' = '.self::escape($constant->getValue()));
171
+        $this->beginPhpDomain('const', $constant->getName() . ' = ' . self::escape($constant->getValue()));
172 172
         $docBlock = $constant->getDocBlock();
173 173
         $this->addDocBlockDescription($constant);
174 174
         if ($docBlock) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $this->addLine('.. rst-class:: phpdoc-description')->addLine();
196 196
             $this->indent();
197 197
             $this->addMultilineWithoutRendering(RstBuilder::escape($docBlock->getSummary()))->addLine();
198
-            if ((string) $docBlock->getDescription() !== '') {
198
+            if ((string)$docBlock->getDescription() !== '') {
199 199
                 $this->addMultilineWithoutRendering(RstBuilder::escape($docBlock->getDescription()))->addLine();
200 200
             }
201 201
             $this->unindent();
@@ -235,44 +235,44 @@  discard block
 block discarded – undo
235 235
             case 'return':
236 236
                 /** @var Return_ $return */
237 237
                 $return = $tags[0];
238
-                $this->addMultiline(':Returns: '.self::typesToRst($return->getType()).' '.RstBuilder::escape($return->getDescription()),
238
+                $this->addMultiline(':Returns: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()),
239 239
                     true);
240 240
                 break;
241 241
             case 'var':
242 242
                 /** @var DocBlock\Tags\Var_ $return */
243 243
                 $return = $tags[0];
244
-                $this->addMultiline(':Type: '.self::typesToRst($return->getType()).' '.RstBuilder::escape($return->getDescription()),
244
+                $this->addMultiline(':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()),
245 245
                     true);
246 246
                 break;
247 247
             case 'throws':
248 248
                 /** @var Throws $tag */
249 249
                 foreach ($tags as $tag) {
250
-                    $this->addMultiline(':Throws: '.self::typesToRst($tag->getType()).' '.RstBuilder::escape($tag->getDescription()),
250
+                    $this->addMultiline(':Throws: ' . self::typesToRst($tag->getType()) . ' ' . RstBuilder::escape($tag->getDescription()),
251 251
                         true);
252 252
                 }
253 253
                 break;
254 254
             case 'since':
255 255
                 /** @var Since $return */
256 256
                 $return = $tags[0];
257
-                $this->addMultiline(':Since: '.$return->getVersion().' '.RstBuilder::escape($return->getDescription()),
257
+                $this->addMultiline(':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()),
258 258
                     true);
259 259
                 break;
260 260
             case 'deprecated':
261 261
                 /** @var Deprecated $return */
262 262
                 $return = $tags[0];
263
-                $this->addMultiline(':Deprecated: '.$return->getVersion().' '.RstBuilder::escape($return->getDescription()),
263
+                $this->addMultiline(':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()),
264 264
                     true);
265 265
                 break;
266 266
             case 'see':
267 267
                 /** @var See $return */
268 268
                 $return = $tags[0];
269
-                $this->addMultiline(':See: '.self::typesToRst($return->getReference()).' '.RstBuilder::escape($return->getDescription()),
269
+                $this->addMultiline(':See: ' . self::typesToRst($return->getReference()) . ' ' . RstBuilder::escape($return->getDescription()),
270 270
                     true);
271 271
                 break;
272 272
             case 'license':
273 273
                 /** @var DocBlock\Tags\BaseTag $return */
274 274
                 $return = $tags[0];
275
-                $this->addMultiline(':License: '.RstBuilder::escape($return->getDescription()), true);
275
+                $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true);
276 276
                 break;
277 277
         }
278 278
     }
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
         foreach ($types as $typeFull) {
312 312
             $type = str_replace('[]', '', $typeFull);
313 313
             if (in_array($type, $whitelist, true)) {
314
-                $result .= $typeFull.' | ';
314
+                $result .= $typeFull . ' | ';
315 315
                 continue;
316 316
             }
317 317
             if (0 === strpos($type, '\\')) {
318 318
                 $type = substr($type, 1);
319 319
             }
320
-            $result .= ':any:`'.RstBuilder::escape($typeFull).' <'.RstBuilder::escape($type).'>` | ';
320
+            $result .= ':any:`' . RstBuilder::escape($typeFull) . ' <' . RstBuilder::escape($type) . '>` | ';
321 321
         }
322 322
 
323 323
         return substr($result, 0, -3);
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     private function addProperty(Property $property)
356 356
     {
357 357
         $modifiers = $property->isStatic() ? '' : ' static';
358
-        $this->beginPhpDomain('attr', $property->getVisibility().$modifiers.' '.$property->getName());
358
+        $this->beginPhpDomain('attr', $property->getVisibility() . $modifiers . ' ' . $property->getName());
359 359
         $docBlock = $property->getDocBlock();
360 360
         $this->addDocBlockDescription($property);
361 361
         if ($docBlock) {
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
     public static function getLink($type, $fqsen, $description = '')
395 395
     {
396 396
         if ($description !== '') {
397
-            return ':php:'.$type.':`'.RstBuilder::escape($description).'<'.RstBuilder::escape(substr($fqsen,
398
-                    1)).'>`';
397
+            return ':php:' . $type . ':`' . RstBuilder::escape($description) . '<' . RstBuilder::escape(substr($fqsen,
398
+                    1)) . '>`';
399 399
         }
400 400
 
401
-        return ':php:'.$type.':`'.RstBuilder::escape(substr($fqsen, 1)).'`';
401
+        return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`';
402 402
     }
403 403
 
404 404
     /**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     {
409 409
         $usedTraits = '';
410 410
         foreach ($element->getUsedTraits() as $trait) {
411
-            $usedTraits .= $this->getLink('trait', $trait).' ';
411
+            $usedTraits .= $this->getLink('trait', $trait) . ' ';
412 412
         }
413 413
         if ($usedTraits !== '') {
414 414
             $this->addFieldList('Used traits', $usedTraits);
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
         $modifiers .= $method->isFinal() ? ' final' : '';
450 450
         $modifiers .= $method->isStatic() ? ' static' : '';
451 451
         $deprecated = count($deprecated) > 0 ? ' deprecated' : '';
452
-        $this->addLine('.. rst-class:: '.$modifiers.$deprecated)->addLine();
452
+        $this->addLine('.. rst-class:: ' . $modifiers . $deprecated)->addLine();
453 453
         $this->indent();
454 454
 
455 455
         $args = $this->processMethodArgumentTypes($method);
456
-        $this->beginPhpDomain('method', $modifiers.' '.$method->getName().'('.$args.')');
456
+        $this->beginPhpDomain('method', $modifiers . ' ' . $method->getName() . '(' . $args . ')');
457 457
         $this->addDocBlockDescription($method);
458 458
         $this->addLine();
459 459
         if (!empty($params)) {
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
                 if ($argument->isVariadic()) {
496 496
                     $paramItem .= '...';
497 497
                 }
498
-                $paramItem .= '$'.$argument->getName().'** ';
498
+                $paramItem .= '$' . $argument->getName() . '** ';
499 499
                 if ($typString !== null) {
500
-                    $paramItem .= '('.self::typesToRst($typString).') ';
500
+                    $paramItem .= '(' . self::typesToRst($typString) . ') ';
501 501
                 }
502
-                $paramItem .= ' '.$param->getDescription();
503
-                $parameterDetails .= $paramItem.PHP_EOL;
502
+                $paramItem .= ' ' . $param->getDescription();
503
+                $parameterDetails .= $paramItem . PHP_EOL;
504 504
             }
505 505
         }
506 506
 
@@ -533,20 +533,20 @@  discard block
 block discarded – undo
533 533
     private function processMethodArgumentType(Argument $argument, string $args): string
534 534
     {
535 535
         foreach ($argument->getType() as $type) {
536
-            $args .= self::escape($type).'|';
536
+            $args .= self::escape($type) . '|';
537 537
         }
538
-        $args = substr($args, 0, -1).' ';
538
+        $args = substr($args, 0, -1) . ' ';
539 539
         if ($argument->isVariadic()) {
540 540
             $args .= '...';
541 541
         }
542 542
         if ($argument->isByReference()) {
543 543
             $args .= '&';
544 544
         }
545
-        $args .= '$'.$argument->getName();
545
+        $args .= '$' . $argument->getName();
546 546
         $default = $argument->getDefault();
547 547
         if ($default !== null) {
548 548
             $default = $default === '' ? '""' : $default;
549
-            $args .= '='.self::escape($default);
549
+            $args .= '=' . self::escape($default);
550 550
         }
551 551
         $args .= ', ';
552 552
 
Please login to merge, or discard this patch.
src/ApiDocBuilder.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     public function __construct($srcDir, $dstDir)
91 91
     {
92 92
         $this->dstDir = $dstDir;
93
-        $this->srcDir = (array) $srcDir;
93
+        $this->srcDir = (array)$srcDir;
94 94
     }
95 95
 
96 96
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 try {
126 126
                     $interfaceList[] = new LocalFile($file->getPathname());
127 127
                 } catch (Exception $e) {
128
-                    $this->log('Failed to load '.$file->getPathname().PHP_EOL);
128
+                    $this->log('Failed to load ' . $file->getPathname() . PHP_EOL);
129 129
                 }
130 130
             }
131 131
         }
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
         foreach ($this->extensionNames as $extensionName) {
152 152
             $extension = new $extensionName($this->project, $this->extensionArguments[$extensionName]);
153 153
             if (!is_subclass_of($extension, Extension::class)) {
154
-                $this->log('Failed to load extension '.$extensionName.'.');
154
+                $this->log('Failed to load extension ' . $extensionName . '.');
155 155
             }
156 156
             $this->extensions[] = $extension;
157
-            $this->log('Extension '.$extensionName.' loaded.');
157
+            $this->log('Extension ' . $extensionName . ' loaded.');
158 158
         }
159 159
     }
160 160
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     public function log($message)
167 167
     {
168 168
         if ($this->verboseOutput) {
169
-            echo $message.PHP_EOL;
169
+            echo $message . PHP_EOL;
170 170
         }
171 171
     }
172 172
 
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
     private function createDirectoryStructure()
179 179
     {
180 180
         foreach ($this->project->getNamespaces() as $namespace) {
181
-            $namespaceDir = $this->dstDir.str_replace('\\', '/', $namespace->getFqsen());
181
+            $namespaceDir = $this->dstDir . str_replace('\\', '/', $namespace->getFqsen());
182 182
             if (is_dir($namespaceDir)) {
183 183
                 continue;
184 184
             }
185 185
             if (!mkdir($namespaceDir, 0755, true)) {
186
-                throw new WriteException('Could not create directory '.$namespaceDir);
186
+                throw new WriteException('Could not create directory ' . $namespaceDir);
187 187
             }
188 188
         }
189 189
     }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public function debug($message)
220 220
     {
221 221
         if ($this->debugOutput) {
222
-            echo $message.PHP_EOL;
222
+            echo $message . PHP_EOL;
223 223
         }
224 224
     }
225 225
 
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
         $this->log('Build indexes.');
229 229
         $namespaces = $this->project->getNamespaces();
230 230
         $namespaces['\\'] = $this->project->getRootNamespace();
231
-        usort($namespaces, function (Namespace_ $a, Namespace_ $b) {
231
+        usort($namespaces, function(Namespace_ $a, Namespace_ $b) {
232 232
             return strcmp($a->getFqsen(), $b->getFqsen());
233 233
         });
234 234
         /** @var Namespace_ $namespace */
235 235
         foreach ($namespaces as $namespace) {
236
-            $fqsen = (string) $namespace->getFqsen();
237
-            $this->debug('Build namespace index for '.$fqsen);
236
+            $fqsen = (string)$namespace->getFqsen();
237
+            $this->debug('Build namespace index for ' . $fqsen);
238 238
             $functions = [];
239 239
             $constants = [];
240 240
             if (array_key_exists($fqsen, $this->functions)) {
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
             }
246 246
             $builder = new NamespaceIndexBuilder($this->extensions, $namespaces, $namespace, $functions, $constants);
247 247
             $builder->render();
248
-            $path = $this->dstDir.str_replace('\\', '/', $fqsen).'/index.rst';
248
+            $path = $this->dstDir . str_replace('\\', '/', $fqsen) . '/index.rst';
249 249
             file_put_contents($path, $builder->getContent());
250 250
         }
251 251
 
252 252
         $this->log('Build main index files.');
253 253
         $builder = new MainIndexBuilder($namespaces);
254 254
         $builder->render();
255
-        $path = $this->dstDir.'/index-namespaces-all.rst';
255
+        $path = $this->dstDir . '/index-namespaces-all.rst';
256 256
         file_put_contents($path, $builder->getContent());
257 257
     }
258 258
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
         foreach ($file->getInterfaces() as $interface) {
296 296
             $fqsen = $interface->getFqsen();
297 297
             $builder = new InterfaceFileBuilder($file, $interface, $this->extensions);
298
-            $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst';
298
+            $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst';
299 299
             file_put_contents($filename, $builder->getContent());
300
-            $this->docFiles[(string) $interface->getFqsen()] = str_replace('\\', '/', $fqsen);
300
+            $this->docFiles[(string)$interface->getFqsen()] = str_replace('\\', '/', $fqsen);
301 301
 
302 302
             // also build root namespace in indexes
303
-            if (strpos((string) substr($fqsen, 1), '\\') === false) {
303
+            if (strpos((string)substr($fqsen, 1), '\\') === false) {
304 304
                 $this->project->getRootNamespace()->addInterface($fqsen);
305 305
             }
306
-            $this->debug('Written interface documentation to '.$filename);
306
+            $this->debug('Written interface documentation to ' . $filename);
307 307
         }
308 308
     }
309 309
 
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
         foreach ($file->getClasses() as $class) {
316 316
             $fqsen = $class->getFqsen();
317 317
             $builder = new ClassFileBuilder($file, $class, $this->extensions);
318
-            $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst';
318
+            $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst';
319 319
             file_put_contents($filename, $builder->getContent());
320
-            $this->docFiles[(string) $class->getFqsen()] = str_replace('\\', '/', $fqsen);
320
+            $this->docFiles[(string)$class->getFqsen()] = str_replace('\\', '/', $fqsen);
321 321
 
322 322
             // also build root namespace in indexes
323
-            if (strpos((string) substr($class->getFqsen(), 1), '\\') === false) {
323
+            if (strpos((string)substr($class->getFqsen(), 1), '\\') === false) {
324 324
                 $this->project->getRootNamespace()->addClass($fqsen);
325 325
             }
326
-            $this->debug('Written class documentation to '.$filename);
326
+            $this->debug('Written class documentation to ' . $filename);
327 327
         }
328 328
     }
329 329
 
@@ -335,15 +335,15 @@  discard block
 block discarded – undo
335 335
         foreach ($file->getTraits() as $trait) {
336 336
             $fqsen = $trait->getFqsen();
337 337
             $builder = new TraitFileBuilder($file, $trait, $this->extensions);
338
-            $filename = $this->dstDir.str_replace('\\', '/', $fqsen).'.rst';
338
+            $filename = $this->dstDir . str_replace('\\', '/', $fqsen) . '.rst';
339 339
             file_put_contents($filename, $builder->getContent());
340
-            $this->docFiles[(string) $trait->getFqsen()] = str_replace('\\', '/', $fqsen);
340
+            $this->docFiles[(string)$trait->getFqsen()] = str_replace('\\', '/', $fqsen);
341 341
 
342 342
             // also build root namespace in indexes
343
-            if (strpos((string) substr($fqsen, 1), '\\') === false) {
343
+            if (strpos((string)substr($fqsen, 1), '\\') === false) {
344 344
                 $this->project->getRootNamespace()->addTrait($fqsen);
345 345
             }
346
-            $this->debug('Written trait documentation to '.$filename);
346
+            $this->debug('Written trait documentation to ' . $filename);
347 347
         }
348 348
     }
349 349
 
Please login to merge, or discard this patch.
src/Middleware/ErrorHandlingMiddleware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@
 block discarded – undo
51 51
     public function execute(Command $command, callable $next)
52 52
     {
53 53
         $filename = $command->getFile()->path();
54
-        $this->apiDocBuilder->debug('Starting to parse file: '.$filename);
54
+        $this->apiDocBuilder->debug('Starting to parse file: ' . $filename);
55 55
 
56 56
         try {
57 57
             return $next($command);
58 58
         } catch (Exception $e) {
59
-            $this->apiDocBuilder->log('Unable to parse file "'.$filename.'", '.$e->getMessage());
59
+            $this->apiDocBuilder->log('Unable to parse file "' . $filename . '", ' . $e->getMessage());
60 60
         }
61 61
     }
62 62
 }
Please login to merge, or discard this patch.