@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $apiDocBuilder->setVerboseOutput(true); |
| 63 | 63 | $apiDocBuilder->setDebugOutput(true); |
| 64 | 64 | } |
| 65 | - if($input->getOption('public-only')) { |
|
| 65 | + if ($input->getOption('public-only')) { |
|
| 66 | 66 | $apiDocBuilder->addExtension(PublicOnlyExtension::class); |
| 67 | 67 | } |
| 68 | 68 | $apiDocBuilder->build(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->addH1(self::escape($trait->getFqsen())); |
| 40 | 40 | |
| 41 | 41 | $namespace = str_replace('\\' . $trait->getName(), '', $trait->getFqsen()); |
| 42 | - if($namespace !== '') { |
|
| 42 | + if ($namespace !== '') { |
|
| 43 | 43 | $this->beginPhpDomain('namespace', substr($namespace, 1), false); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | foreach ($trait->getMethods() as $method) { |
| 70 | 70 | $docBlock = $method->getDocBlock(); |
| 71 | 71 | $params = []; |
| 72 | - if($docBlock !== null) { |
|
| 72 | + if ($docBlock !== null) { |
|
| 73 | 73 | /** @var Param $param */ |
| 74 | 74 | foreach ($docBlock->getTagsByName('param') as $param) { |
| 75 | 75 | $params[$param->getVariableName()] = $param; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** @var Argument $argument */ |
| 80 | 80 | foreach ($method->getArguments() as $argument) { |
| 81 | 81 | // TODO: defaults, types |
| 82 | - $args .= ' $' . $argument->getName() . ', '; |
|
| 82 | + $args .= ' $' . $argument->getName() . ', '; |
|
| 83 | 83 | } |
| 84 | 84 | $args = substr($args, 0, -2); |
| 85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $modifiers .= $method->isStatic() ? ' static' : ''; |
| 90 | 90 | $this->addLine('.. rst-class:: ' . $modifiers)->addLine(); |
| 91 | 91 | $this->indent(); |
| 92 | - $this->beginPhpDomain('method', $method->getName().'('.$args.')'); |
|
| 92 | + $this->beginPhpDomain('method', $method->getName() . '(' . $args . ')'); |
|
| 93 | 93 | $this->addDocBlockDescription($docBlock); |
| 94 | 94 | if (!empty($params)) { |
| 95 | 95 | foreach ($method->getArguments() as $argument) { |
@@ -95,8 +95,9 @@ |
||
| 95 | 95 | foreach ($method->getArguments() as $argument) { |
| 96 | 96 | /** @var Param $param */ |
| 97 | 97 | $param = $params[$argument->getName()]; |
| 98 | - if ($param !== null) |
|
| 99 | - $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 98 | + if ($param !== null) { |
|
| 99 | + $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 100 | + } |
|
| 100 | 101 | } |
| 101 | 102 | } |
| 102 | 103 | $this->endPhpDomain('method'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $docBlock = $constant->getDocBlock(); |
| 56 | 56 | if ($docBlock) { |
| 57 | 57 | foreach ($docBlock->getTags() as $tag) { |
| 58 | - $this->addDocblockTag( $tag->getName(), $docBlock); |
|
| 58 | + $this->addDocblockTag($tag->getName(), $docBlock); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | $this->endPhpDomain(); |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @param $name string |
| 98 | 98 | * @param $indent bool Should indent after the section started |
| 99 | 99 | */ |
| 100 | - public function beginPhpDomain($type, $name, $indent=true) { |
|
| 100 | + public function beginPhpDomain($type, $name, $indent = true) { |
|
| 101 | 101 | // FIXME: Add checks if it is properly ended |
| 102 | - $this->addLine('.. php:' . $type . ':: '. $name)->addLine(); |
|
| 102 | + $this->addLine('.. php:' . $type . ':: ' . $name)->addLine(); |
|
| 103 | 103 | if ($indent === true) { |
| 104 | 104 | $this->indent(); |
| 105 | 105 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @param string $type |
| 110 | 110 | */ |
| 111 | - public function endPhpDomain($type='') { |
|
| 111 | + public function endPhpDomain($type = '') { |
|
| 112 | 112 | $this->unindent(); |
| 113 | 113 | $this->addLine(); |
| 114 | 114 | } |
@@ -134,38 +134,50 @@ |
||
| 134 | 134 | $tags = $docBlock->getTagsByName($tagName); |
| 135 | 135 | switch ($tagName) { |
| 136 | 136 | case 'return': |
| 137 | - if (count($tags) === 0) continue; |
|
| 137 | + if (count($tags) === 0) { |
|
| 138 | + continue; |
|
| 139 | + } |
|
| 138 | 140 | /** @var Return_ $return */ |
| 139 | 141 | $return = $tags[0]; |
| 140 | 142 | $this->addMultiline(':returns: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 141 | 143 | break; |
| 142 | 144 | case 'throws': |
| 143 | - if (count($tags) === 0) continue; |
|
| 145 | + if (count($tags) === 0) { |
|
| 146 | + continue; |
|
| 147 | + } |
|
| 144 | 148 | /** @var Throws $tag */ |
| 145 | 149 | foreach ($tags as $tag) { |
| 146 | 150 | $this->addMultiline(':throws: ' . $tag->getType() . ' ' . RstBuilder::escape($tag->getDescription()), true); |
| 147 | 151 | } |
| 148 | 152 | break; |
| 149 | 153 | case 'since': |
| 150 | - if (count($tags) === 0) continue; |
|
| 154 | + if (count($tags) === 0) { |
|
| 155 | + continue; |
|
| 156 | + } |
|
| 151 | 157 | /** @var Since $return */ |
| 152 | 158 | $return = $tags[0]; |
| 153 | 159 | $this->addMultiline(':since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 154 | 160 | break; |
| 155 | 161 | case 'deprecated': |
| 156 | - if (count($tags) === 0) continue; |
|
| 162 | + if (count($tags) === 0) { |
|
| 163 | + continue; |
|
| 164 | + } |
|
| 157 | 165 | /** @var Deprecated $return */ |
| 158 | 166 | $return = $tags[0]; |
| 159 | 167 | $this->addMultiline(':deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 160 | 168 | break; |
| 161 | 169 | case 'see': |
| 162 | - if (count($tags) === 0) continue; |
|
| 170 | + if (count($tags) === 0) { |
|
| 171 | + continue; |
|
| 172 | + } |
|
| 163 | 173 | /** @var See $return */ |
| 164 | 174 | $return = $tags[0]; |
| 165 | 175 | $this->addMultiline(':see: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
| 166 | 176 | break; |
| 167 | 177 | case 'license': |
| 168 | - if (count($tags) === 0) continue; |
|
| 178 | + if (count($tags) === 0) { |
|
| 179 | + continue; |
|
| 180 | + } |
|
| 169 | 181 | /** @var DocBlock\Tags\BaseTag $return */ |
| 170 | 182 | $return = $tags[0]; |
| 171 | 183 | $this->addMultiline(':license: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $this->addH1(self::escape($class->getName())); |
| 44 | 44 | |
| 45 | - $namespace = substr($class->getFqsen(), 0, strlen($class->getFqsen())-strlen('\\' . $class->getName())); |
|
| 46 | - if($namespace !== '') { |
|
| 45 | + $namespace = substr($class->getFqsen(), 0, strlen($class->getFqsen()) - strlen('\\' . $class->getName())); |
|
| 46 | + if ($namespace !== '') { |
|
| 47 | 47 | $this->beginPhpDomain('namespace', substr($namespace, 1), false); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->indent(); |
| 58 | 58 | $this->addDocBlockDescription($docBlock); |
| 59 | 59 | |
| 60 | - if($class instanceof Class_) { |
|
| 60 | + if ($class instanceof Class_) { |
|
| 61 | 61 | // Add class details |
| 62 | 62 | $parent = $class->getParent(); |
| 63 | 63 | if ($parent !== null) { |
@@ -132,7 +132,9 @@ |
||
| 132 | 132 | foreach ($method->getArguments() as $argument) { |
| 133 | 133 | /** @var Param $param */ |
| 134 | 134 | $param = $params[$argument->getName()]; |
| 135 | - if ($param !== null) $this->addMultiline(':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 135 | + if ($param !== null) { |
|
| 136 | + $this->addMultiline(':param ' . self::escape($param->getType()) . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
| 137 | + } |
|
| 136 | 138 | } |
| 137 | 139 | } |
| 138 | 140 | $this->endPhpDomain('method'); |