@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | && (string)$namespace->getFqsen() !== (string)$currentNamespaceFqsen |
42 | 42 | ) { |
43 | 43 | // only keep first level children |
44 | - $childrenPath = substr((string)$namespace->getFqsen(), strlen((string)$this->currentNamespace->getFqsen())+1); |
|
44 | + $childrenPath = substr((string)$namespace->getFqsen(), strlen((string)$this->currentNamespace->getFqsen()) + 1); |
|
45 | 45 | if (strpos($childrenPath, '\\') === false) { |
46 | 46 | $childNamespaces[] = $namespace; |
47 | 47 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | $this->addH2('Functions'); |
106 | 106 | foreach ($this->currentNamespace->getFunctions() as $function) { |
107 | - $this->beginPhpDomain('function', $function->getName(). '()'); |
|
107 | + $this->beginPhpDomain('function', $function->getName() . '()'); |
|
108 | 108 | $this->endPhpDomain('function'); |
109 | 109 | } |
110 | 110 |
@@ -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 */ |
@@ -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'); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | $docBlock = $interface->getDocBlock(); |
42 | 42 | $this->addH1(self::escape($interface->getFqsen()))->addLine(); |
43 | - if($namespace !== '') { |
|
43 | + if ($namespace !== '') { |
|
44 | 44 | $this->beginPhpDomain('namespace', substr($namespace, 1), false); |
45 | 45 | } |
46 | 46 | $this->beginPhpDomain('interface', $interface->getName(), false); |
@@ -97,7 +97,9 @@ |
||
97 | 97 | foreach ($method->getArguments() as $argument) { |
98 | 98 | /** @var Param $param */ |
99 | 99 | $param = $params[$argument->getName()]; |
100 | - if ($param !== null) $this->addMultiline(':param ' . RstBuilder::escape($param->getType()) . ' $' . $argument->getName() . ': ' . RstBuilder::escape($param->getDescription()), true); |
|
100 | + if ($param !== null) { |
|
101 | + $this->addMultiline(':param ' . RstBuilder::escape($param->getType()) . ' $' . $argument->getName() . ': ' . RstBuilder::escape($param->getDescription()), true); |
|
102 | + } |
|
101 | 103 | } |
102 | 104 | foreach ($docBlock->getTags() as $tag) { |
103 | 105 | $this->addDocblockTag($tag->getName(), $docBlock); |