@@ -90,7 +90,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -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 |
@@ -70,24 +70,24 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function findChildNamespaces() |
72 | 72 | { |
73 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
73 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
74 | 74 | /** @var Namespace_ $namespace */ |
75 | 75 | foreach ($this->namespaces as $namespace) { |
76 | 76 | // check if not root and doesn't start with current namespace |
77 | 77 | if ($currentNamespaceFqsen !== '\\' && strpos( |
78 | - (string) $namespace->getFqsen(), |
|
79 | - $currentNamespaceFqsen.'\\' |
|
78 | + (string)$namespace->getFqsen(), |
|
79 | + $currentNamespaceFqsen . '\\' |
|
80 | 80 | ) !== 0) { |
81 | 81 | continue; |
82 | 82 | } |
83 | - if ((string) $namespace->getFqsen() !== $currentNamespaceFqsen && strpos( |
|
84 | - (string) $namespace->getFqsen(), |
|
83 | + if ((string)$namespace->getFqsen() !== $currentNamespaceFqsen && strpos( |
|
84 | + (string)$namespace->getFqsen(), |
|
85 | 85 | $currentNamespaceFqsen |
86 | 86 | ) === 0) { |
87 | 87 | // only keep first level children |
88 | 88 | $childrenPath = substr( |
89 | - (string) $namespace->getFqsen(), |
|
90 | - strlen((string) $this->currentNamespace->getFqsen()) + 1 |
|
89 | + (string)$namespace->getFqsen(), |
|
90 | + strlen((string)$this->currentNamespace->getFqsen()) + 1 |
|
91 | 91 | ); |
92 | 92 | if (strpos($childrenPath, '\\') === false) { |
93 | 93 | $this->childNamespaces[] = $namespace; |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | |
99 | 99 | public function render() |
100 | 100 | { |
101 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
101 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
102 | 102 | if ($currentNamespaceFqsen !== '\\') { |
103 | 103 | $label = str_replace('\\', '-', $currentNamespaceFqsen); |
104 | - $this->addLine('.. _namespace'.$label.':')->addLine(); |
|
104 | + $this->addLine('.. _namespace' . $label . ':')->addLine(); |
|
105 | 105 | $this->addH1(RstBuilder::escape($this->currentNamespace->getName())); |
106 | 106 | $this->addLine(self::escape($currentNamespaceFqsen))->addLine(); |
107 | 107 | } else { |
108 | 108 | $label = 'root-namespace'; |
109 | - $this->addLine('.. _namespace-'.$label.':')->addLine(); |
|
109 | + $this->addLine('.. _namespace-' . $label . ':')->addLine(); |
|
110 | 110 | $this->addH1(RstBuilder::escape('\\')); |
111 | 111 | } |
112 | 112 | $this->addLine(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | if ($type === self::RENDER_INDEX_NAMESPACE) { |
138 | - $this->addLine($entry->getName().' <'.$entry->getName().'/index>'); |
|
138 | + $this->addLine($entry->getName() . ' <' . $entry->getName() . '/index>'); |
|
139 | 139 | } else { |
140 | 140 | $this->addElementTocEntry($entry); |
141 | 141 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | private function addElementTocEntry(Fqsen $entry) |
208 | 208 | { |
209 | - $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); |
|
209 | + $currentNamespaceFqsen = (string)$this->currentNamespace->getFqsen(); |
|
210 | 210 | $subPath = $entry; |
211 | 211 | if ($currentNamespaceFqsen !== '\\' && substr( |
212 | 212 | $entry, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $subPath = substr($entry, strlen($currentNamespaceFqsen)); |
217 | 217 | } |
218 | 218 | $path = substr(str_replace('\\', '/', $subPath), 1); |
219 | - $this->addLine($entry->getName().' <'.$path.'>'); |
|
219 | + $this->addLine($entry->getName() . ' <' . $path . '>'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | private function addFunctions() |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | /** @var Argument $argument */ |
243 | 243 | foreach ($function->getArguments() as $argument) { |
244 | 244 | // TODO: defaults, types |
245 | - $args .= '$'.$argument->getName().', '; |
|
245 | + $args .= '$' . $argument->getName() . ', '; |
|
246 | 246 | } |
247 | 247 | $args = substr($args, 0, -2); |
248 | - $this->beginPhpDomain('function', $function->getName().'('.$args.')'); |
|
248 | + $this->beginPhpDomain('function', $function->getName() . '(' . $args . ')'); |
|
249 | 249 | $this->addDocBlockDescription($function); |
250 | 250 | if (!empty($params)) { |
251 | 251 | foreach ($function->getArguments() as $argument) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $param = $params[$argument->getName()]; |
255 | 255 | if ($param !== null) { |
256 | 256 | $this->addMultiline( |
257 | - ':param '.self::escape($param->getType()).' $'.$argument->getName().': '.$param->getDescription(), |
|
257 | + ':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), |
|
258 | 258 | true |
259 | 259 | ); |
260 | 260 | } |