@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (is_dir($namespaceDir)) |
108 | 108 | continue; |
109 | 109 | if (!mkdir($namespaceDir, 0755, true)) { |
110 | - throw new \Exception('Could not create directory '. $namespaceDir); |
|
110 | + throw new \Exception('Could not create directory ' . $namespaceDir); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public function buildToc() { |
149 | 149 | $namespaces = $this->project->getNamespaces(); |
150 | 150 | $namespaces['\\'] = $this->project->getRootNamespace(); |
151 | - usort($namespaces, function (Namespace_ $a, Namespace_ $b) { |
|
151 | + usort($namespaces, function(Namespace_ $a, Namespace_ $b) { |
|
152 | 152 | return strcmp($a->getFqsen(), $b->getFqsen()); |
153 | 153 | }); |
154 | 154 | /** @var Namespace_ $namespace */ |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | $docBlock = $interface->getDocBlock(); |
43 | 43 | $this->addH1(self::escape($interface->getFqsen()))->addLine(); |
44 | - if($namespace !== '') { |
|
44 | + if ($namespace !== '') { |
|
45 | 45 | $this->addLine('.. php:namespace:: ' . substr($namespace, 1)); |
46 | 46 | } |
47 | 47 | $this->addLine('.. php:interface:: ' . $interface->getName())->addLine(); |
@@ -95,7 +95,9 @@ |
||
95 | 95 | foreach ($method->getArguments() as $argument) { |
96 | 96 | /** @var Param $param */ |
97 | 97 | $param = $params[$argument->getName()]; |
98 | - if ($param !== null) $this->addIndentMultiline(3, ':param ' . RstBuilder::escape($param->getType()) . ' $' . $argument->getName() . ': ' . RstBuilder::escape($param->getDescription()), true); |
|
98 | + if ($param !== null) { |
|
99 | + $this->addIndentMultiline(3, ':param ' . RstBuilder::escape($param->getType()) . ' $' . $argument->getName() . ': ' . RstBuilder::escape($param->getDescription()), true); |
|
100 | + } |
|
99 | 101 | } |
100 | 102 | foreach ($docBlock->getTags() as $tag) { |
101 | 103 | $this->addDocblockTag($tag->getName(), $docBlock); |
@@ -68,15 +68,15 @@ |
||
68 | 68 | return ':php:' . $type . ':`' . RstBuilder::escape(substr($fqsen, 1)) . '`'; |
69 | 69 | } |
70 | 70 | |
71 | - public function beginPhpDomain($type, $name, $indent=true) { |
|
71 | + public function beginPhpDomain($type, $name, $indent = true) { |
|
72 | 72 | // FIXME: Add checks if it is properly ended |
73 | - $this->addLine('.. php:' . $type . ':: '. $name)->addLine(); |
|
73 | + $this->addLine('.. php:' . $type . ':: ' . $name)->addLine(); |
|
74 | 74 | if ($indent === true) { |
75 | 75 | $this->indent(); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - public function endPhpDomain($type='') { |
|
79 | + public function endPhpDomain($type = '') { |
|
80 | 80 | $this->unindent(); |
81 | 81 | $this->addLine(); |
82 | 82 | } |
@@ -90,37 +90,49 @@ |
||
90 | 90 | $tags = $docBlock->getTagsByName($tag); |
91 | 91 | switch ($tag) { |
92 | 92 | case 'return': |
93 | - if (sizeof($tags) === 0) continue; |
|
93 | + if (sizeof($tags) === 0) { |
|
94 | + continue; |
|
95 | + } |
|
94 | 96 | /** @var Return_ $return */ |
95 | 97 | $return = $tags[0]; |
96 | 98 | $this->addIndentMultiline($indent, ':returns: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
97 | 99 | break; |
98 | 100 | case 'throws': |
99 | - if (sizeof($tags) === 0) continue; |
|
101 | + if (sizeof($tags) === 0) { |
|
102 | + continue; |
|
103 | + } |
|
100 | 104 | /** @var Throws $return */ |
101 | 105 | $return = $tags[0]; |
102 | 106 | $this->addIndentMultiline($indent, ':throws: ' . $return->getType() . ' ' . RstBuilder::escape($return->getDescription()), true); |
103 | 107 | break; |
104 | 108 | case 'since': |
105 | - if (sizeof($tags) === 0) continue; |
|
109 | + if (sizeof($tags) === 0) { |
|
110 | + continue; |
|
111 | + } |
|
106 | 112 | /** @var Since $return */ |
107 | 113 | $return = $tags[0]; |
108 | 114 | $this->addIndentMultiline($indent, ':since: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
109 | 115 | break; |
110 | 116 | case 'deprecated': |
111 | - if (sizeof($tags) === 0) continue; |
|
117 | + if (sizeof($tags) === 0) { |
|
118 | + continue; |
|
119 | + } |
|
112 | 120 | /** @var Deprecated $return */ |
113 | 121 | $return = $tags[0]; |
114 | 122 | $this->addIndentMultiline($indent, ':deprecated: ' . $return->getVersion() . ' ' . RstBuilder::escape($return->getDescription()), true); |
115 | 123 | break; |
116 | 124 | case 'see': |
117 | - if (sizeof($tags) === 0) continue; |
|
125 | + if (sizeof($tags) === 0) { |
|
126 | + continue; |
|
127 | + } |
|
118 | 128 | /** @var See $return */ |
119 | 129 | $return = $tags[0]; |
120 | 130 | $this->addIndentMultiline($indent, ':see: ' . $return->getReference() . ' ' . RstBuilder::escape($return->getDescription()), true); |
121 | 131 | break; |
122 | 132 | case 'license': |
123 | - if (sizeof($tags) === 0) continue; |
|
133 | + if (sizeof($tags) === 0) { |
|
134 | + continue; |
|
135 | + } |
|
124 | 136 | /** @var DocBlock\Tags\BaseTag $return */ |
125 | 137 | $return = $tags[0]; |
126 | 138 | $this->addIndentMultiline($indent, ':license: ' . RstBuilder::escape($return->getDescription()), true); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->addH1(self::escape($class->getFqsen())); |
42 | 42 | |
43 | 43 | $namespace = str_replace('\\' . $class->getName(), '', $class->getFqsen()); |
44 | - if($namespace !== '') { |
|
44 | + if ($namespace !== '') { |
|
45 | 45 | $this->beginPhpDomain('namespace', substr($namespace, 1), false); |
46 | 46 | } |
47 | 47 | $modifiers = $class->isAbstract() ? ' abstract' : ''; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $docBlock = $constant->getDocBlock(); |
85 | 85 | if ($docBlock) { |
86 | 86 | foreach ($docBlock->getTags() as $tag) { |
87 | - $this->addDocblockTag( $tag->getName(), $docBlock); |
|
87 | + $this->addDocblockTag($tag->getName(), $docBlock); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | $this->endPhpDomain(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | foreach ($class->getMethods() as $method) { |
103 | 103 | $docBlock = $method->getDocBlock(); |
104 | 104 | $params = []; |
105 | - if($docBlock !== null) { |
|
105 | + if ($docBlock !== null) { |
|
106 | 106 | /** @var Param $param */ |
107 | 107 | foreach ($docBlock->getTagsByName('param') as $param) { |
108 | 108 | $params[$param->getVariableName()] = $param; |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | $args = ''; |
112 | 112 | /** @var Argument $argument */ |
113 | 113 | foreach ($method->getArguments() as $argument) { |
114 | - if(!empty($argument->getDefault())) { |
|
114 | + if (!empty($argument->getDefault())) { |
|
115 | 115 | echo 'ad'; |
116 | 116 | } |
117 | - $args .= ' $' . $argument->getName() . ', '; |
|
117 | + $args .= ' $' . $argument->getName() . ', '; |
|
118 | 118 | } |
119 | 119 | $args = substr($args, 0, -2); |
120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $modifiers .= $method->isFinal() ? ' final' : ''; |
124 | 124 | $modifiers .= $method->isStatic() ? ' static' : ''; |
125 | 125 | $this->addIndentLine(1, '.. rst-class:: ' . $modifiers)->addLine(); |
126 | - $this->addIndentLine(2, '.. php:method:: '.$method->getName().'('.$args.')'); |
|
126 | + $this->addIndentLine(2, '.. php:method:: ' . $method->getName() . '(' . $args . ')'); |
|
127 | 127 | $this->addLine(); |
128 | 128 | if ($docBlock) |
129 | 129 | $this->addIndentMultiline(3, $docBlock->getDescription()); |
@@ -125,16 +125,18 @@ |
||
125 | 125 | $this->addIndentLine(1, '.. rst-class:: ' . $modifiers)->addLine(); |
126 | 126 | $this->addIndentLine(2, '.. php:method:: '.$method->getName().'('.$args.')'); |
127 | 127 | $this->addLine(); |
128 | - if ($docBlock) |
|
129 | - $this->addIndentMultiline(3, $docBlock->getDescription()); |
|
128 | + if ($docBlock) { |
|
129 | + $this->addIndentMultiline(3, $docBlock->getDescription()); |
|
130 | + } |
|
130 | 131 | $this->addLine(); |
131 | 132 | |
132 | 133 | if (!empty($params)) { |
133 | 134 | foreach ($method->getArguments() as $argument) { |
134 | 135 | /** @var Param $param */ |
135 | 136 | $param = $params[$argument->getName()]; |
136 | - if ($param !== null) |
|
137 | - $this->addIndentMultiline(3, ':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription()); |
|
137 | + if ($param !== null) { |
|
138 | + $this->addIndentMultiline(3, ':param ' . $param->getType() . ' $' . $argument->getName() . ': ' . $param->getDescription()); |
|
139 | + } |
|
138 | 140 | } |
139 | 141 | } |
140 | 142 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | private $indentLevel = 0; |
32 | 32 | /** @var string */ |
33 | - protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL ; |
|
33 | + protected $content = '.. rst-class:: phpdoctorst' . PHP_EOL . PHP_EOL; |
|
34 | 34 | |
35 | 35 | public function getContent() { |
36 | 36 | return $this->content; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function addFieldList($key, $value) { |
54 | - $this->addLine(':'.self::escape($key).':'); |
|
54 | + $this->addLine(':' . self::escape($key) . ':'); |
|
55 | 55 | $this->addIndentMultiline(1, $value, true); |
56 | 56 | } |
57 | 57 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | if ($blockIndent && $i === 1) { |
86 | 86 | $indent++; |
87 | 87 | } |
88 | - $this->addIndentLine($this->indentLevel+$indent, $line); |
|
88 | + $this->addIndentLine($this->indentLevel + $indent, $line); |
|
89 | 89 | $i++; |
90 | 90 | } |
91 | 91 | return $this; |
@@ -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 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $subPath = substr($entry, strlen($currentNamespaceFqsen)); |
93 | 93 | } |
94 | 94 | $path = substr(str_replace("\\", "/", $subPath), 1); |
95 | - $this->addIndentLine(1,$entry->getName() . ' <' . $path . '>'); |
|
95 | + $this->addIndentLine(1, $entry->getName() . ' <' . $path . '>'); |
|
96 | 96 | } |
97 | 97 | $this->addLine()->addLine(); |
98 | 98 |