@@ -51,12 +51,12 @@ |
||
| 51 | 51 | public function execute(Command $command, callable $next): object |
| 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 | //Must Return empty file object |
| 61 | 61 | return new FileElement( |
| 62 | 62 | $command->getFile()->md5(), |
@@ -43,10 +43,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /** @var Return_ $return */ |
| 233 | 233 | $return = $tags[0]; |
| 234 | 234 | $this->addMultiline( |
| 235 | - ':Returns: '.self::typesToRst($return->getType()).' '.RstBuilder::escape($return->getDescription()), |
|
| 235 | + ':Returns: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), |
|
| 236 | 236 | true |
| 237 | 237 | ); |
| 238 | 238 | break; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** @var DocBlock\Tags\Var_ $return */ |
| 241 | 241 | $return = $tags[0]; |
| 242 | 242 | $this->addMultiline( |
| 243 | - ':Type: '.self::typesToRst($return->getType()).' '.RstBuilder::escape($return->getDescription()), |
|
| 243 | + ':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), |
|
| 244 | 244 | true |
| 245 | 245 | ); |
| 246 | 246 | break; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | /** @var Throws $tag */ |
| 249 | 249 | foreach ($tags as $tag) { |
| 250 | 250 | $this->addMultiline( |
| 251 | - ':Throws: '.self::typesToRst($tag->getType()).' '.RstBuilder::escape($tag->getDescription()), |
|
| 251 | + ':Throws: ' . self::typesToRst($tag->getType()) . ' ' . RstBuilder::escape($tag->getDescription()), |
|
| 252 | 252 | true |
| 253 | 253 | ); |
| 254 | 254 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | /** @var Since $return */ |
| 258 | 258 | $return = $tags[0]; |
| 259 | 259 | $this->addMultiline( |
| 260 | - ':Since: '.$return->getVersion().' '.RstBuilder::escape($return->getDescription()), |
|
| 260 | + ':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), |
|
| 261 | 261 | true |
| 262 | 262 | ); |
| 263 | 263 | break; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | /** @var Deprecated $return */ |
| 266 | 266 | $return = $tags[0]; |
| 267 | 267 | $this->addMultiline( |
| 268 | - ':Deprecated: '.$return->getVersion().' '.RstBuilder::escape($return->getDescription()), |
|
| 268 | + ':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), |
|
| 269 | 269 | true |
| 270 | 270 | ); |
| 271 | 271 | break; |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | /** @var See $return */ |
| 274 | 274 | $return = $tags[0]; |
| 275 | 275 | $this->addMultiline( |
| 276 | - ':See: '.self::typesToRst($return->getReference()).' '.RstBuilder::escape($return->getDescription()), |
|
| 276 | + ':See: ' . self::typesToRst($return->getReference()) . ' ' . RstBuilder::escape($return->getDescription()), |
|
| 277 | 277 | true |
| 278 | 278 | ); |
| 279 | 279 | break; |
| 280 | 280 | case 'license': |
| 281 | 281 | /** @var DocBlock\Tags\BaseTag $return */ |
| 282 | 282 | $return = $tags[0]; |
| 283 | - $this->addMultiline(':License: '.RstBuilder::escape($return->getDescription()), true); |
|
| 283 | + $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true); |
|
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | foreach ($types as $typeFull) { |
| 320 | 320 | $type = str_replace('[]', '', $typeFull); |
| 321 | 321 | if (in_array($type, $whitelist, true)) { |
| 322 | - $result .= $typeFull.' | '; |
|
| 322 | + $result .= $typeFull . ' | '; |
|
| 323 | 323 | continue; |
| 324 | 324 | } |
| 325 | 325 | if (0 === strpos($type, '\\')) { |
| 326 | 326 | $type = substr($type, 1); |
| 327 | 327 | } |
| 328 | - $result .= ':any:`'.RstBuilder::escape($typeFull).' <'.RstBuilder::escape($type).'>` | '; |
|
| 328 | + $result .= ':any:`' . RstBuilder::escape($typeFull) . ' <' . RstBuilder::escape($type) . '>` | '; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | return substr($result, 0, -3); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | private function addProperty(Property $property) |
| 364 | 364 | { |
| 365 | 365 | $modifiers = $property->isStatic() ? '' : ' static'; |
| 366 | - $this->beginPhpDomain('attr', $property->getVisibility().$modifiers.' '.$property->getName()); |
|
| 366 | + $this->beginPhpDomain('attr', $property->getVisibility() . $modifiers . ' ' . $property->getName()); |
|
| 367 | 367 | $docBlock = $property->getDocBlock(); |
| 368 | 368 | $this->addDocBlockDescription($property); |
| 369 | 369 | if ($docBlock) { |
@@ -402,13 +402,13 @@ discard block |
||
| 402 | 402 | public static function getLink($type, $fqsen, $description = '') |
| 403 | 403 | { |
| 404 | 404 | if ($description !== '') { |
| 405 | - return ':php:'.$type.':`'.RstBuilder::escape($description).'<'.RstBuilder::escape(substr( |
|
| 405 | + return ':php:' . $type . ':`' . RstBuilder::escape($description) . '<' . RstBuilder::escape(substr( |
|
| 406 | 406 | $fqsen, |
| 407 | 407 | 1 |
| 408 | - )).'>`'; |
|
| 408 | + )) . '>`'; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - return ':php:'.$type.':`'.RstBuilder::escape(substr($fqsen, 1)).'`'; |
|
| 411 | + return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | { |
| 419 | 419 | $usedTraits = ''; |
| 420 | 420 | foreach ($element->getUsedTraits() as $trait) { |
| 421 | - $usedTraits .= $this->getLink('trait', $trait).' '; |
|
| 421 | + $usedTraits .= $this->getLink('trait', $trait) . ' '; |
|
| 422 | 422 | } |
| 423 | 423 | if ($usedTraits !== '') { |
| 424 | 424 | $this->addFieldList('Used traits', $usedTraits); |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | $modifiers .= $method->isFinal() ? ' final' : ''; |
| 462 | 462 | $modifiers .= $method->isStatic() ? ' static' : ''; |
| 463 | 463 | $deprecated = count($deprecated) > 0 ? ' deprecated' : ''; |
| 464 | - $this->addLine('.. rst-class:: '.$modifiers.$deprecated)->addLine(); |
|
| 464 | + $this->addLine('.. rst-class:: ' . $modifiers . $deprecated)->addLine(); |
|
| 465 | 465 | $this->indent(); |
| 466 | 466 | |
| 467 | 467 | $args = $this->processMethodArgumentTypes($method); |
| 468 | - $this->beginPhpDomain('method', $modifiers.' '.$method->getName().'('.$args.')'); |
|
| 468 | + $this->beginPhpDomain('method', $modifiers . ' ' . $method->getName() . '(' . $args . ')'); |
|
| 469 | 469 | $this->addDocBlockDescription($method); |
| 470 | 470 | $this->addLine(); |
| 471 | 471 | if (!empty($params)) { |
@@ -507,12 +507,12 @@ discard block |
||
| 507 | 507 | if ($argument->isVariadic()) { |
| 508 | 508 | $paramItem .= '...'; |
| 509 | 509 | } |
| 510 | - $paramItem .= '$'.$argument->getName().'** '; |
|
| 510 | + $paramItem .= '$' . $argument->getName() . '** '; |
|
| 511 | 511 | if ($typString !== null) { |
| 512 | - $paramItem .= '('.self::typesToRst($typString).') '; |
|
| 512 | + $paramItem .= '(' . self::typesToRst($typString) . ') '; |
|
| 513 | 513 | } |
| 514 | - $paramItem .= ' '.$param->getDescription(); |
|
| 515 | - $parameterDetails .= $paramItem.PHP_EOL; |
|
| 514 | + $paramItem .= ' ' . $param->getDescription(); |
|
| 515 | + $parameterDetails .= $paramItem . PHP_EOL; |
|
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | |
@@ -544,20 +544,20 @@ discard block |
||
| 544 | 544 | private function processMethodArgumentType(Argument $argument, string $args): string |
| 545 | 545 | { |
| 546 | 546 | foreach ($argument->getType() as $type) { |
| 547 | - $args .= self::escape($type).'|'; |
|
| 547 | + $args .= self::escape($type) . '|'; |
|
| 548 | 548 | } |
| 549 | - $args = substr($args, 0, -1).' '; |
|
| 549 | + $args = substr($args, 0, -1) . ' '; |
|
| 550 | 550 | if ($argument->isVariadic()) { |
| 551 | 551 | $args .= '...'; |
| 552 | 552 | } |
| 553 | 553 | if ($argument->isByReference()) { |
| 554 | 554 | $args .= '&'; |
| 555 | 555 | } |
| 556 | - $args .= '$'.$argument->getName(); |
|
| 556 | + $args .= '$' . $argument->getName(); |
|
| 557 | 557 | $default = $argument->getDefault(); |
| 558 | 558 | if ($default !== null) { |
| 559 | 559 | $default = $default === '' ? '""' : $default; |
| 560 | - $args .= '='.self::escape($default); |
|
| 560 | + $args .= '=' . self::escape($default); |
|
| 561 | 561 | } |
| 562 | 562 | $args .= ', '; |
| 563 | 563 | |