@@ -32,7 +32,7 @@ |
||
| 32 | 32 | /** @var Project */ |
| 33 | 33 | protected $project; |
| 34 | 34 | |
| 35 | - public function __construct(Project &$project) { |
|
| 35 | + public function __construct(Project&$project) { |
|
| 36 | 36 | $this->project = $project; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | private $indentLevel = 0; |
| 37 | 37 | /** @var string */ |
| 38 | - protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL ; |
|
| 38 | + protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL; |
|
| 39 | 39 | |
| 40 | 40 | public function getContent() { |
| 41 | 41 | return $this->content; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function addFieldList($key, $value) { |
| 61 | - $this->addLine(':'.self::escape($key).':'); |
|
| 61 | + $this->addLine(':' . self::escape($key) . ':'); |
|
| 62 | 62 | $this->indent()->addMultiline($value, true)->unindent(); |
| 63 | 63 | return $this; |
| 64 | 64 | } |
@@ -209,7 +209,7 @@ |
||
| 209 | 209 | $this->log('Build indexes.'); |
| 210 | 210 | $namespaces = $this->project->getNamespaces(); |
| 211 | 211 | $namespaces['\\'] = $this->project->getRootNamespace(); |
| 212 | - usort($namespaces, function (Namespace_ $a, Namespace_ $b) { |
|
| 212 | + usort($namespaces, function(Namespace_ $a, Namespace_ $b) { |
|
| 213 | 213 | return strcmp($a->getFqsen(), $b->getFqsen()); |
| 214 | 214 | }); |
| 215 | 215 | /** @var Namespace_ $namespace */ |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | if ($type === PhpDomainBuilder::SECTION_BEFORE_DESCRIPTION) { |
| 50 | - if($element instanceof Class_) { |
|
| 50 | + if ($element instanceof Class_) { |
|
| 51 | 51 | $modifiers = $element->isAbstract() ? 'abstract' : ''; |
| 52 | 52 | $modifiers = $element->isFinal() ? ' final' : $modifiers; |
| 53 | 53 | $builder->addLine(':php:`' . $modifiers . ' class ' . RstBuilder::escape($builder->getElement()->getName()) . ' {}`'); |
@@ -66,10 +66,10 @@ |
||
| 66 | 66 | $apiDocBuilder->setVerboseOutput(true); |
| 67 | 67 | $apiDocBuilder->setDebugOutput(true); |
| 68 | 68 | } |
| 69 | - if($input->getOption('public-only')) { |
|
| 69 | + if ($input->getOption('public-only')) { |
|
| 70 | 70 | $apiDocBuilder->addExtension(PublicOnlyExtension::class); |
| 71 | 71 | } |
| 72 | - if($input->getOption('element-toc')) { |
|
| 72 | + if ($input->getOption('element-toc')) { |
|
| 73 | 73 | $apiDocBuilder->addExtension(TocExtension::class); |
| 74 | 74 | } |
| 75 | 75 | $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 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $param = $params[$argument->getName()]; |
| 261 | 261 | if ($param !== null) { |
| 262 | 262 | $typString = $param->getType(); |
| 263 | - $this->addMultiline(':param '.self::escape($typString).' $' . $argument->getName() . ': ' . self::typesToRst($typString) . ' ' . $param->getDescription(), true); |
|
| 263 | + $this->addMultiline(':param ' . self::escape($typString) . ' $' . $argument->getName() . ': ' . self::typesToRst($typString) . ' ' . $param->getDescription(), true); |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | foreach ($docBlock->getTags() as $tag) { |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | * @param $fqsen string |
| 277 | 277 | * @return string |
| 278 | 278 | */ |
| 279 | - public static function getLink($type, $fqsen, $description='') { |
|
| 280 | - if($description !== '') { |
|
| 279 | + public static function getLink($type, $fqsen, $description = '') { |
|
| 280 | + if ($description !== '') { |
|
| 281 | 281 | return ':php:' . $type . ':`' . RstBuilder::escape($description) . '<' . RstBuilder::escape(substr($fqsen, 1)) . '>`'; |
| 282 | 282 | } |
| 283 | 283 | return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
@@ -333,44 +333,58 @@ discard block |
||
| 333 | 333 | $tags = $docBlock->getTagsByName($tagName); |
| 334 | 334 | switch ($tagName) { |
| 335 | 335 | case 'return': |
| 336 | - if (count($tags) === 0) continue; |
|
| 336 | + if (count($tags) === 0) { |
|
| 337 | + continue; |
|
| 338 | + } |
|
| 337 | 339 | /** @var Return_ $return */ |
| 338 | 340 | $return = $tags[0]; |
| 339 | 341 | $this->addMultiline(':Returns: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 340 | 342 | break; |
| 341 | 343 | case 'var': |
| 342 | - if (count($tags) === 0) continue; |
|
| 344 | + if (count($tags) === 0) { |
|
| 345 | + continue; |
|
| 346 | + } |
|
| 343 | 347 | /** @var DocBlock\Tags\Var_ $return */ |
| 344 | 348 | $return = $tags[0]; |
| 345 | 349 | $this->addMultiline(':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 346 | 350 | break; |
| 347 | 351 | case 'throws': |
| 348 | - if (count($tags) === 0) continue; |
|
| 352 | + if (count($tags) === 0) { |
|
| 353 | + continue; |
|
| 354 | + } |
|
| 349 | 355 | /** @var Throws $tag */ |
| 350 | 356 | foreach ($tags as $tag) { |
| 351 | 357 | $this->addMultiline(':Throws: ' . $tag->getType() . ' ' . RstBuilder::escape($tag->getDescription()), true); |
| 352 | 358 | } |
| 353 | 359 | break; |
| 354 | 360 | case 'since': |
| 355 | - if (count($tags) === 0) continue; |
|
| 361 | + if (count($tags) === 0) { |
|
| 362 | + continue; |
|
| 363 | + } |
|
| 356 | 364 | /** @var Since $return */ |
| 357 | 365 | $return = $tags[0]; |
| 358 | 366 | $this->addMultiline(':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 359 | 367 | break; |
| 360 | 368 | case 'deprecated': |
| 361 | - if (count($tags) === 0) continue; |
|
| 369 | + if (count($tags) === 0) { |
|
| 370 | + continue; |
|
| 371 | + } |
|
| 362 | 372 | /** @var Deprecated $return */ |
| 363 | 373 | $return = $tags[0]; |
| 364 | 374 | $this->addMultiline(':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 365 | 375 | break; |
| 366 | 376 | case 'see': |
| 367 | - if (count($tags) === 0) continue; |
|
| 377 | + if (count($tags) === 0) { |
|
| 378 | + continue; |
|
| 379 | + } |
|
| 368 | 380 | /** @var See $return */ |
| 369 | 381 | $return = $tags[0]; |
| 370 | 382 | $this->addMultiline(':See: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 371 | 383 | break; |
| 372 | 384 | case 'license': |
| 373 | - if (count($tags) === 0) continue; |
|
| 385 | + if (count($tags) === 0) { |
|
| 386 | + continue; |
|
| 387 | + } |
|
| 374 | 388 | /** @var DocBlock\Tags\BaseTag $return */ |
| 375 | 389 | $return = $tags[0]; |
| 376 | 390 | $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -400,8 +414,9 @@ discard block |
||
| 400 | 414 | $result .= $type . ' | '; |
| 401 | 415 | continue; |
| 402 | 416 | } |
| 403 | - if (0 === strpos($type, '\\')) |
|
| 404 | - $type = substr($type, 1); |
|
| 417 | + if (0 === strpos($type, '\\')) { |
|
| 418 | + $type = substr($type, 1); |
|
| 419 | + } |
|
| 405 | 420 | $result .= ':any:`' . RstBuilder::escape($type) . '` | '; |
| 406 | 421 | } |
| 407 | 422 | return substr($result, 0, -3); |