@@ -52,7 +52,7 @@ |
||
52 | 52 | /** @var Interface_ $interface */ |
53 | 53 | $interface = $builder->getElement(); |
54 | 54 | |
55 | - if(count($interface->getMethods()) > 0) { |
|
55 | + if (count($interface->getMethods()) > 0) { |
|
56 | 56 | $builder->addH3('Methods'); |
57 | 57 | foreach ($interface->getMethods() as $method) { |
58 | 58 | $args = ''; |
@@ -69,13 +69,13 @@ |
||
69 | 69 | $apiDocBuilder->setVerboseOutput(true); |
70 | 70 | $apiDocBuilder->setDebugOutput(true); |
71 | 71 | } |
72 | - if($input->getOption('public-only')) { |
|
72 | + if ($input->getOption('public-only')) { |
|
73 | 73 | $apiDocBuilder->addExtension(PublicOnlyExtension::class); |
74 | 74 | } |
75 | - if(!$input->getOption('show-private')) { |
|
75 | + if (!$input->getOption('show-private')) { |
|
76 | 76 | $apiDocBuilder->addExtension(NoPrivateExtension::class); |
77 | 77 | } |
78 | - if($input->getOption('element-toc')) { |
|
78 | + if ($input->getOption('element-toc')) { |
|
79 | 79 | $apiDocBuilder->addExtension(TocExtension::class); |
80 | 80 | } |
81 | 81 | $apiDocBuilder->build(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | 72 | public static function getNamespace(Element $element) { |
73 | - return substr($element->getFqsen(), 0, strlen($element->getFqsen())-strlen('\\'. $element->getName())); |
|
73 | + return substr($element->getFqsen(), 0, strlen($element->getFqsen()) - strlen('\\' . $element->getName())); |
|
74 | 74 | //return str_replace('\\' . $element->getName(), '', $element->getFqsen()); |
75 | 75 | } |
76 | 76 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param Property $property |
165 | 165 | */ |
166 | 166 | private function addProperty(Property $property) { |
167 | - $modifiers = $property->isStatic() ? '' : ' static' ; |
|
167 | + $modifiers = $property->isStatic() ? '' : ' static'; |
|
168 | 168 | $this->beginPhpDomain('attr', $property->getVisibility() . $modifiers . ' ' . $property->getName()); |
169 | 169 | $docBlock = $property->getDocBlock(); |
170 | 170 | $this->addDocBlockDescription($property); |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | $args .= self::escape($type) . '|'; |
240 | 240 | } |
241 | 241 | $args = substr($args, 0, -1) . ' '; |
242 | - if($argument->isVariadic()) { |
|
242 | + if ($argument->isVariadic()) { |
|
243 | 243 | $args .= '...'; |
244 | 244 | } |
245 | - if($argument->isByReference()) { |
|
245 | + if ($argument->isByReference()) { |
|
246 | 246 | $args .= '&'; |
247 | 247 | } |
248 | 248 | $args .= '$' . $argument->getName(); |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | if ($param !== null) { |
272 | 272 | $typString = $param->getType(); |
273 | 273 | // Remove first \ to allow references |
274 | - if(0 === strpos($typString, '\\')) { |
|
274 | + if (0 === strpos($typString, '\\')) { |
|
275 | 275 | $typString = substr($typString, 1); |
276 | 276 | } |
277 | - $this->addMultiline(':param '.self::escape($typString).' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
277 | + $this->addMultiline(':param ' . self::escape($typString) . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | foreach ($docBlock->getTags() as $tag) { |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * @param $fqsen string |
291 | 291 | * @return string |
292 | 292 | */ |
293 | - public static function getLink($type, $fqsen, $description='') { |
|
294 | - if($description !== '') { |
|
293 | + public static function getLink($type, $fqsen, $description = '') { |
|
294 | + if ($description !== '') { |
|
295 | 295 | return ':php:' . $type . ':`' . RstBuilder::escape($description) . '<' . RstBuilder::escape(substr($fqsen, 1)) . '>`'; |
296 | 296 | } |
297 | 297 | return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
@@ -348,44 +348,58 @@ discard block |
||
348 | 348 | $tags = $docBlock->getTagsByName($tagName); |
349 | 349 | switch ($tagName) { |
350 | 350 | case 'return': |
351 | - if (count($tags) === 0) continue; |
|
351 | + if (count($tags) === 0) { |
|
352 | + continue; |
|
353 | + } |
|
352 | 354 | /** @var Return_ $return */ |
353 | 355 | $return = $tags[0]; |
354 | 356 | $this->addMultiline(':Returns: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
355 | 357 | break; |
356 | 358 | case 'var': |
357 | - if (count($tags) === 0) continue; |
|
359 | + if (count($tags) === 0) { |
|
360 | + continue; |
|
361 | + } |
|
358 | 362 | /** @var DocBlock\Tags\Var_ $return */ |
359 | 363 | $return = $tags[0]; |
360 | 364 | $this->addMultiline(':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
361 | 365 | break; |
362 | 366 | case 'throws': |
363 | - if (count($tags) === 0) continue; |
|
367 | + if (count($tags) === 0) { |
|
368 | + continue; |
|
369 | + } |
|
364 | 370 | /** @var Throws $tag */ |
365 | 371 | foreach ($tags as $tag) { |
366 | 372 | $this->addMultiline(':Throws: ' . $tag->getType() . ' ' . RstBuilder::escape($tag->getDescription()), true); |
367 | 373 | } |
368 | 374 | break; |
369 | 375 | case 'since': |
370 | - if (count($tags) === 0) continue; |
|
376 | + if (count($tags) === 0) { |
|
377 | + continue; |
|
378 | + } |
|
371 | 379 | /** @var Since $return */ |
372 | 380 | $return = $tags[0]; |
373 | 381 | $this->addMultiline(':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
374 | 382 | break; |
375 | 383 | case 'deprecated': |
376 | - if (count($tags) === 0) continue; |
|
384 | + if (count($tags) === 0) { |
|
385 | + continue; |
|
386 | + } |
|
377 | 387 | /** @var Deprecated $return */ |
378 | 388 | $return = $tags[0]; |
379 | 389 | $this->addMultiline(':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
380 | 390 | break; |
381 | 391 | case 'see': |
382 | - if (count($tags) === 0) continue; |
|
392 | + if (count($tags) === 0) { |
|
393 | + continue; |
|
394 | + } |
|
383 | 395 | /** @var See $return */ |
384 | 396 | $return = $tags[0]; |
385 | 397 | $this->addMultiline(':See: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
386 | 398 | break; |
387 | 399 | case 'license': |
388 | - if (count($tags) === 0) continue; |
|
400 | + if (count($tags) === 0) { |
|
401 | + continue; |
|
402 | + } |
|
389 | 403 | /** @var DocBlock\Tags\BaseTag $return */ |
390 | 404 | $return = $tags[0]; |
391 | 405 | $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -419,8 +433,9 @@ discard block |
||
419 | 433 | $result .= $type . ' | '; |
420 | 434 | continue; |
421 | 435 | } |
422 | - if (0 === strpos($type, '\\')) |
|
423 | - $type = substr($type, 1); |
|
436 | + if (0 === strpos($type, '\\')) { |
|
437 | + $type = substr($type, 1); |
|
438 | + } |
|
424 | 439 | $result .= ':any:`' . RstBuilder::escape($type) . '` | '; |
425 | 440 | } |
426 | 441 | return substr($result, 0, -3); |