@@ -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 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $docBlock = $constant->getDocBlock(); |
25 | 25 | if ($docBlock) { |
26 | 26 | foreach ($docBlock->getTags() as $tag) { |
27 | - $this->addDocblockTag( $tag->getName(), $docBlock); |
|
27 | + $this->addDocblockTag($tag->getName(), $docBlock); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | $this->endPhpDomain(); |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
39 | 39 | } |
40 | 40 | |
41 | - public function beginPhpDomain($type, $name, $indent=true) { |
|
41 | + public function beginPhpDomain($type, $name, $indent = true) { |
|
42 | 42 | // FIXME: Add checks if it is properly ended |
43 | - $this->addLine('.. php:' . $type . ':: '. $name)->addLine(); |
|
43 | + $this->addLine('.. php:' . $type . ':: ' . $name)->addLine(); |
|
44 | 44 | if ($indent === true) { |
45 | 45 | $this->indent(); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - public function endPhpDomain($type='') { |
|
49 | + public function endPhpDomain($type = '') { |
|
50 | 50 | $this->unindent(); |
51 | 51 | $this->addLine(); |
52 | 52 | } |
@@ -59,37 +59,49 @@ |
||
59 | 59 | $tags = $docBlock->getTagsByName($tag); |
60 | 60 | switch ($tag) { |
61 | 61 | case 'return': |
62 | - if (count($tags) === 0) continue; |
|
62 | + if (count($tags) === 0) { |
|
63 | + continue; |
|
64 | + } |
|
63 | 65 | /** @var Return_ $return */ |
64 | 66 | $return = $tags[0]; |
65 | 67 | $this->addMultiline(':returns: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
66 | 68 | break; |
67 | 69 | case 'throws': |
68 | - if (count($tags) === 0) continue; |
|
70 | + if (count($tags) === 0) { |
|
71 | + continue; |
|
72 | + } |
|
69 | 73 | /** @var Throws $return */ |
70 | 74 | $return = $tags[0]; |
71 | 75 | $this->addMultiline(':throws: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
72 | 76 | break; |
73 | 77 | case 'since': |
74 | - if (count($tags) === 0) continue; |
|
78 | + if (count($tags) === 0) { |
|
79 | + continue; |
|
80 | + } |
|
75 | 81 | /** @var Since $return */ |
76 | 82 | $return = $tags[0]; |
77 | 83 | $this->addMultiline(':since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
78 | 84 | break; |
79 | 85 | case 'deprecated': |
80 | - if (count($tags) === 0) continue; |
|
86 | + if (count($tags) === 0) { |
|
87 | + continue; |
|
88 | + } |
|
81 | 89 | /** @var Deprecated $return */ |
82 | 90 | $return = $tags[0]; |
83 | 91 | $this->addMultiline(':deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
84 | 92 | break; |
85 | 93 | case 'see': |
86 | - if (count($tags) === 0) continue; |
|
94 | + if (count($tags) === 0) { |
|
95 | + continue; |
|
96 | + } |
|
87 | 97 | /** @var See $return */ |
88 | 98 | $return = $tags[0]; |
89 | 99 | $this->addMultiline(':see: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
90 | 100 | break; |
91 | 101 | case 'license': |
92 | - if (count($tags) === 0) continue; |
|
102 | + if (count($tags) === 0) { |
|
103 | + continue; |
|
104 | + } |
|
93 | 105 | /** @var DocBlock\Tags\BaseTag $return */ |
94 | 106 | $return = $tags[0]; |
95 | 107 | $this->addMultiline(':license: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -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); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->addH1(self::escape($class->getFqsen())); |
39 | 39 | |
40 | 40 | $namespace = str_replace('\\' . $class->getName(), '', $class->getFqsen()); |
41 | - if($namespace !== '') { |
|
41 | + if ($namespace !== '') { |
|
42 | 42 | $this->beginPhpDomain('namespace', substr($namespace, 1), false); |
43 | 43 | } |
44 | 44 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ->addLine(); |
57 | 57 | } |
58 | 58 | |
59 | - if($class instanceof Class_) { |
|
59 | + if ($class instanceof Class_) { |
|
60 | 60 | // Add class details |
61 | 61 | $parent = $class->getParent(); |
62 | 62 | $this->addFieldList('Extends', $parent !== null ? $this->getLink('class', $parent) : ''); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | foreach ($class->getMethods() as $method) { |
94 | 94 | $docBlock = $method->getDocBlock(); |
95 | 95 | $params = []; |
96 | - if($docBlock !== null) { |
|
96 | + if ($docBlock !== null) { |
|
97 | 97 | /** @var Param $param */ |
98 | 98 | foreach ($docBlock->getTagsByName('param') as $param) { |
99 | 99 | $params[$param->getVariableName()] = $param; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /** @var Argument $argument */ |
104 | 104 | foreach ($method->getArguments() as $argument) { |
105 | 105 | // TODO: defaults, types |
106 | - $args .= ' $' . $argument->getName() . ', '; |
|
106 | + $args .= ' $' . $argument->getName() . ', '; |
|
107 | 107 | } |
108 | 108 | $args = substr($args, 0, -2); |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $modifiers .= $method->isStatic() ? ' static' : ''; |
114 | 114 | $this->addLine('.. rst-class:: ' . $modifiers)->addLine(); |
115 | 115 | $this->indent(); |
116 | - $this->beginPhpDomain('method', $method->getName().'('.$args.')'); |
|
116 | + $this->beginPhpDomain('method', $method->getName() . '(' . $args . ')'); |
|
117 | 117 | if ($docBlock) |
118 | 118 | $this->addMultiline($docBlock->getDescription()); |
119 | 119 | $this->addLine(); |
@@ -114,15 +114,17 @@ |
||
114 | 114 | $this->addLine('.. rst-class:: ' . $modifiers)->addLine(); |
115 | 115 | $this->indent(); |
116 | 116 | $this->beginPhpDomain('method', $method->getName().'('.$args.')'); |
117 | - if ($docBlock) |
|
118 | - $this->addMultiline($docBlock->getDescription()); |
|
117 | + if ($docBlock) { |
|
118 | + $this->addMultiline($docBlock->getDescription()); |
|
119 | + } |
|
119 | 120 | $this->addLine(); |
120 | 121 | if (!empty($params)) { |
121 | 122 | foreach ($method->getArguments() as $argument) { |
122 | 123 | /** @var Param $param */ |
123 | 124 | $param = $params[$argument->getName()]; |
124 | - if ($param !== null) |
|
125 | - $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
125 | + if ($param !== null) { |
|
126 | + $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
127 | + } |
|
126 | 128 | } |
127 | 129 | } |
128 | 130 | $this->endPhpDomain('method'); |
@@ -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 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | foreach ($trait->getMethods() as $method) { |
73 | 73 | $docBlock = $method->getDocBlock(); |
74 | 74 | $params = []; |
75 | - if($docBlock !== null) { |
|
75 | + if ($docBlock !== null) { |
|
76 | 76 | /** @var Param $param */ |
77 | 77 | foreach ($docBlock->getTagsByName('param') as $param) { |
78 | 78 | $params[$param->getVariableName()] = $param; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** @var Argument $argument */ |
83 | 83 | foreach ($method->getArguments() as $argument) { |
84 | 84 | // TODO: defaults, types |
85 | - $args .= ' $' . $argument->getName() . ', '; |
|
85 | + $args .= ' $' . $argument->getName() . ', '; |
|
86 | 86 | } |
87 | 87 | $args = substr($args, 0, -2); |
88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $modifiers .= $method->isStatic() ? ' static' : ''; |
93 | 93 | $this->addLine('.. rst-class:: ' . $modifiers)->addLine(); |
94 | 94 | $this->indent(); |
95 | - $this->beginPhpDomain('method', $method->getName().'('.$args.')'); |
|
95 | + $this->beginPhpDomain('method', $method->getName() . '(' . $args . ')'); |
|
96 | 96 | if ($docBlock) |
97 | 97 | $this->addMultiline($docBlock->getDescription()); |
98 | 98 | $this->addLine(); |
@@ -93,15 +93,17 @@ |
||
93 | 93 | $this->addLine('.. rst-class:: ' . $modifiers)->addLine(); |
94 | 94 | $this->indent(); |
95 | 95 | $this->beginPhpDomain('method', $method->getName().'('.$args.')'); |
96 | - if ($docBlock) |
|
97 | - $this->addMultiline($docBlock->getDescription()); |
|
96 | + if ($docBlock) { |
|
97 | + $this->addMultiline($docBlock->getDescription()); |
|
98 | + } |
|
98 | 99 | $this->addLine(); |
99 | 100 | if (!empty($params)) { |
100 | 101 | foreach ($method->getArguments() as $argument) { |
101 | 102 | /** @var Param $param */ |
102 | 103 | $param = $params[$argument->getName()]; |
103 | - if ($param !== null) |
|
104 | - $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
104 | + if ($param !== null) { |
|
105 | + $this->addMultiline(':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription(), true); |
|
106 | + } |
|
105 | 107 | } |
106 | 108 | } |
107 | 109 | $this->endPhpDomain('method'); |
@@ -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 */ |