@@ -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 */ |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $apiDocBuilder->setVerboseOutput(true); |
| 64 | 64 | $apiDocBuilder->setDebugOutput(true); |
| 65 | 65 | } |
| 66 | - if($input->getOption('public-only')) { |
|
| 66 | + if ($input->getOption('public-only')) { |
|
| 67 | 67 | $apiDocBuilder->addExtension(PublicOnlyExtension::class); |
| 68 | 68 | } |
| 69 | 69 | $apiDocBuilder->addExtension(AddFullElementNameExtension::class); |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | * @return mixed |
| 69 | 69 | */ |
| 70 | 70 | public static function getNamespace(Element $element) { |
| 71 | - return substr($element->getFqsen(), 0, strlen($element->getFqsen())-strlen('\\'. $element->getName())); |
|
| 71 | + return substr($element->getFqsen(), 0, strlen($element->getFqsen()) - strlen('\\' . $element->getName())); |
|
| 72 | 72 | //return str_replace('\\' . $element->getName(), '', $element->getFqsen()); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -249,7 +249,9 @@ discard block |
||
| 249 | 249 | foreach ($method->getArguments() as $argument) { |
| 250 | 250 | /** @var Param $param */ |
| 251 | 251 | $param = $params[$argument->getName()]; |
| 252 | - if ($param !== null) $this->addMultiline(':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 252 | + if ($param !== null) { |
|
| 253 | + $this->addMultiline(':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 254 | + } |
|
| 253 | 255 | } |
| 254 | 256 | } |
| 255 | 257 | $this->endPhpDomain('method'); |
@@ -312,44 +314,58 @@ discard block |
||
| 312 | 314 | $tags = $docBlock->getTagsByName($tagName); |
| 313 | 315 | switch ($tagName) { |
| 314 | 316 | case 'return': |
| 315 | - if (count($tags) === 0) continue; |
|
| 317 | + if (count($tags) === 0) { |
|
| 318 | + continue; |
|
| 319 | + } |
|
| 316 | 320 | /** @var Return_ $return */ |
| 317 | 321 | $return = $tags[0]; |
| 318 | 322 | $this->addMultiline(':Returns: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 319 | 323 | break; |
| 320 | 324 | case 'var': |
| 321 | - if (count($tags) === 0) continue; |
|
| 325 | + if (count($tags) === 0) { |
|
| 326 | + continue; |
|
| 327 | + } |
|
| 322 | 328 | /** @var DocBlock\Tags\Var_ $return */ |
| 323 | 329 | $return = $tags[0]; |
| 324 | 330 | $this->addMultiline(':Type: ' . self::typesToRst($return->getType()) . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 325 | 331 | break; |
| 326 | 332 | case 'throws': |
| 327 | - if (count($tags) === 0) continue; |
|
| 333 | + if (count($tags) === 0) { |
|
| 334 | + continue; |
|
| 335 | + } |
|
| 328 | 336 | /** @var Throws $tag */ |
| 329 | 337 | foreach ($tags as $tag) { |
| 330 | 338 | $this->addMultiline(':Throws: ' . $tag->getType() . ' ' . RstBuilder::escape($tag->getDescription()), true); |
| 331 | 339 | } |
| 332 | 340 | break; |
| 333 | 341 | case 'since': |
| 334 | - if (count($tags) === 0) continue; |
|
| 342 | + if (count($tags) === 0) { |
|
| 343 | + continue; |
|
| 344 | + } |
|
| 335 | 345 | /** @var Since $return */ |
| 336 | 346 | $return = $tags[0]; |
| 337 | 347 | $this->addMultiline(':Since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 338 | 348 | break; |
| 339 | 349 | case 'deprecated': |
| 340 | - if (count($tags) === 0) continue; |
|
| 350 | + if (count($tags) === 0) { |
|
| 351 | + continue; |
|
| 352 | + } |
|
| 341 | 353 | /** @var Deprecated $return */ |
| 342 | 354 | $return = $tags[0]; |
| 343 | 355 | $this->addMultiline(':Deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 344 | 356 | break; |
| 345 | 357 | case 'see': |
| 346 | - if (count($tags) === 0) continue; |
|
| 358 | + if (count($tags) === 0) { |
|
| 359 | + continue; |
|
| 360 | + } |
|
| 347 | 361 | /** @var See $return */ |
| 348 | 362 | $return = $tags[0]; |
| 349 | 363 | $this->addMultiline(':See: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 350 | 364 | break; |
| 351 | 365 | case 'license': |
| 352 | - if (count($tags) === 0) continue; |
|
| 366 | + if (count($tags) === 0) { |
|
| 367 | + continue; |
|
| 368 | + } |
|
| 353 | 369 | /** @var DocBlock\Tags\BaseTag $return */ |
| 354 | 370 | $return = $tags[0]; |
| 355 | 371 | $this->addMultiline(':License: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -379,8 +395,9 @@ discard block |
||
| 379 | 395 | $result .= $type . ' | '; |
| 380 | 396 | continue; |
| 381 | 397 | } |
| 382 | - if (0 === strpos($type, '\\')) |
|
| 383 | - $type = substr($type, 1); |
|
| 398 | + if (0 === strpos($type, '\\')) { |
|
| 399 | + $type = substr($type, 1); |
|
| 400 | + } |
|
| 384 | 401 | // we could use :any: here but resolve_any_xref is not implemented by sphinxcontrib.phpdomain |
| 385 | 402 | // FIXME: once https://github.com/markstory/sphinxcontrib-phpdomain/pull/14 is merged |
| 386 | 403 | // $result .= ':any:`' . RstBuilder::escape($type) . '` | '; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function render($type, &$builder, $element) { |
| 46 | 46 | if ($type === PhpDomainBuilder::SECTION_AFTER_DESCRIPTION) { |
| 47 | - if($element instanceof Class_ || $element instanceof Interface_ || $element instanceof Trait_) { |
|
| 47 | + if ($element instanceof Class_ || $element instanceof Interface_ || $element instanceof Trait_) { |
|
| 48 | 48 | $builder->addLine(); |
| 49 | 49 | /** @var Interface_ $interface */ |
| 50 | 50 | $interface = $builder->getElement(); |
@@ -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()) . ' {}`'); |