@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Standardize the output error when an exception occurs. |
123 | - * @param Throwable $e Throwable object we will get its message to output. |
|
123 | + * @param ConfigException $e Throwable object we will get its message to output. |
|
124 | 124 | * @return CliOutput |
125 | 125 | */ |
126 | 126 | private function outputException(Throwable $e) |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($this->config->has('version')) { |
72 | - $outputFormat = 'PhpMetrics %s <http://phpmetrics.org>' . \PHP_EOL . |
|
73 | - 'by Jean-François Lépine <https://twitter.com/Halleck45>' . \PHP_EOL; |
|
72 | + $outputFormat = 'PhpMetrics %s <http://phpmetrics.org>'.\PHP_EOL. |
|
73 | + 'by Jean-François Lépine <https://twitter.com/Halleck45>'.\PHP_EOL; |
|
74 | 74 | $this->output->writeln(\sprintf($outputFormat, \getVersion())); |
75 | 75 | exit(0); |
76 | 76 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | (new Report\Violations\Xml\Reporter($this->config, $this->output))->generate($metrics); |
116 | 116 | |
117 | 117 | // 5. Enjoy the end. |
118 | - $this->output->writeln(\PHP_EOL . 'Done' . \PHP_EOL); |
|
118 | + $this->output->writeln(\PHP_EOL.'Done'.\PHP_EOL); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -125,6 +125,6 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private function outputException(Throwable $e) |
127 | 127 | { |
128 | - return $this->output->err(\sprintf(\PHP_EOL .'<error>%s</error>' . \PHP_EOL, $e->getMessage())); |
|
128 | + return $this->output->err(\sprintf(\PHP_EOL.'<error>%s</error>'.\PHP_EOL, $e->getMessage())); |
|
129 | 129 | } |
130 | 130 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * NodeTraverser constructor. |
26 | 26 | * |
27 | 27 | * @param bool $cloneNodes |
28 | - * @param null $stopCondition |
|
28 | + * @param \Closure $stopCondition |
|
29 | 29 | */ |
30 | 30 | public function __construct($cloneNodes = false, $stopCondition = null) |
31 | 31 | { |
@@ -32,7 +32,7 @@ |
||
32 | 32 | parent::__construct($cloneNodes); |
33 | 33 | |
34 | 34 | if (null === $stopCondition) { |
35 | - $stopCondition = function ($node) { |
|
35 | + $stopCondition = function($node) { |
|
36 | 36 | return !($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_); |
37 | 37 | }; |
38 | 38 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * @param $status |
|
141 | + * @param integer $status |
|
142 | 142 | */ |
143 | 143 | protected function terminate($status) |
144 | 144 | { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | - * @param $logfile |
|
149 | + * @param string $logfile |
|
150 | 150 | * @param $log |
151 | 151 | * @return $this |
152 | 152 | */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | - * @param $debugKey |
|
164 | + * @param string $debugKey |
|
165 | 165 | * @param $value |
166 | 166 | * @return $this |
167 | 167 | */ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | - * @param $debugKey |
|
175 | + * @param string $debugKey |
|
176 | 176 | * @return $this |
177 | 177 | */ |
178 | 178 | public function clear($debugKey) |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | |
5 | 5 | use Hal\Metric\Metrics; |
6 | -use Hoa\Ruler\Model\Bag\Scalar; |
|
7 | 6 | use PhpParser\Node; |
8 | 7 | use PhpParser\Node\Stmt; |
9 | 8 | use PhpParser\NodeVisitorAbstract; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function leaveNode(Node $node) |
49 | 49 | { |
50 | 50 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
51 | - $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'. \spl_object_hash($node)); |
|
51 | + $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.\spl_object_hash($node)); |
|
52 | 52 | $classOrFunction = $this->metrics->get($name); |
53 | 53 | |
54 | 54 | if (null === $lloc = $classOrFunction->get('lloc')) { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * Reporter constructor. |
30 | 30 | * |
31 | 31 | * @param Config $config |
32 | - * @param Output|OutputInterface $output |
|
32 | + * @param Output $output |
|
33 | 33 | */ |
34 | 34 | public function __construct(Config $config, Output $output) |
35 | 35 | { |
@@ -53,7 +53,7 @@ |
||
53 | 53 | return; |
54 | 54 | } |
55 | 55 | if (!\file_exists(\dirname($logFile)) || !\is_writable(\dirname($logFile))) { |
56 | - throw new \RuntimeException('You don\'t have permissions to write CSV report in ' . $logFile); |
|
56 | + throw new \RuntimeException('You don\'t have permissions to write CSV report in '.$logFile); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $availables = (new Registry())->allForStructures(); |
@@ -116,8 +116,8 @@ |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
119 | - * @param $source |
|
120 | - * @param $destination |
|
119 | + * @param string $source |
|
120 | + * @param string $destination |
|
121 | 121 | * @param Consolidated $consolidated |
122 | 122 | * @param $history |
123 | 123 | * @return $this |
@@ -4,7 +4,6 @@ |
||
4 | 4 | use Hal\Application\Config\Config; |
5 | 5 | use Hal\Component\Output\Output; |
6 | 6 | use Hal\Metric\Consolidated; |
7 | -use Hal\Metric\Consolided; |
|
8 | 7 | use Hal\Metric\Metrics; |
9 | 8 | |
10 | 9 | /** |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $consolidated = new Consolidated($metrics); |
52 | 52 | |
53 | 53 | // history of builds |
54 | - $today = (object)[ |
|
54 | + $today = (object) [ |
|
55 | 55 | 'avg' => $consolidated->getAvg(), |
56 | 56 | 'sum' => $consolidated->getSum() |
57 | 57 | ]; |
58 | - $files = \glob($logDir . '/js/history-*.json'); |
|
58 | + $files = \glob($logDir.'/js/history-*.json'); |
|
59 | 59 | $next = \count($files) + 1; |
60 | 60 | $history = []; |
61 | 61 | \natsort($files); |
@@ -64,37 +64,37 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // copy sources |
67 | - if (!\file_exists($logDir . '/js')) { |
|
67 | + if (!\file_exists($logDir.'/js')) { |
|
68 | 68 | \mkdir($logDir.'/js', 0755, true); |
69 | 69 | } |
70 | - if (!\file_exists($logDir . '/css')) { |
|
70 | + if (!\file_exists($logDir.'/css')) { |
|
71 | 71 | \mkdir($logDir.'/css', 0755, true); |
72 | 72 | } |
73 | - if (!\file_exists($logDir . '/images')) { |
|
73 | + if (!\file_exists($logDir.'/images')) { |
|
74 | 74 | \mkdir($logDir.'/images', 0755, true); |
75 | 75 | } |
76 | - if (!\file_exists($logDir . '/fonts')) { |
|
76 | + if (!\file_exists($logDir.'/fonts')) { |
|
77 | 77 | \mkdir($logDir.'/fonts', 0755, true); |
78 | 78 | } |
79 | - \recurse_copy(__DIR__ . '/template/js', $logDir . '/js'); |
|
80 | - \recurse_copy(__DIR__ . '/template/css', $logDir . '/css'); |
|
81 | - \recurse_copy(__DIR__ . '/template/images', $logDir . '/images'); |
|
82 | - \recurse_copy(__DIR__ . '/template/fonts', $logDir . '/fonts'); |
|
79 | + \recurse_copy(__DIR__.'/template/js', $logDir.'/js'); |
|
80 | + \recurse_copy(__DIR__.'/template/css', $logDir.'/css'); |
|
81 | + \recurse_copy(__DIR__.'/template/images', $logDir.'/images'); |
|
82 | + \recurse_copy(__DIR__.'/template/fonts', $logDir.'/fonts'); |
|
83 | 83 | |
84 | 84 | // render dynamic pages |
85 | - $this->renderPage(__DIR__ . '/template/index.php', $logDir . '/index.html', $consolidated, $history); |
|
86 | - $this->renderPage(__DIR__ . '/template/loc.php', $logDir . '/loc.html', $consolidated, $history); |
|
87 | - $this->renderPage(__DIR__ . '/template/relations.php', $logDir . '/relations.html', $consolidated, $history); |
|
88 | - $this->renderPage(__DIR__ . '/template/coupling.php', $logDir . '/coupling.html', $consolidated, $history); |
|
89 | - $this->renderPage(__DIR__ . '/template/all.php', $logDir . '/all.html', $consolidated, $history); |
|
90 | - $this->renderPage(__DIR__ . '/template/oop.php', $logDir . '/oop.html', $consolidated, $history); |
|
91 | - $this->renderPage(__DIR__ . '/template/complexity.php', $logDir . '/complexity.html', $consolidated, $history); |
|
92 | - $this->renderPage(__DIR__ . '/template/panel.php', $logDir . '/panel.html', $consolidated, $history); |
|
93 | - $this->renderPage(__DIR__ . '/template/violations.php', $logDir . '/violations.html', $consolidated, $history); |
|
85 | + $this->renderPage(__DIR__.'/template/index.php', $logDir.'/index.html', $consolidated, $history); |
|
86 | + $this->renderPage(__DIR__.'/template/loc.php', $logDir.'/loc.html', $consolidated, $history); |
|
87 | + $this->renderPage(__DIR__.'/template/relations.php', $logDir.'/relations.html', $consolidated, $history); |
|
88 | + $this->renderPage(__DIR__.'/template/coupling.php', $logDir.'/coupling.html', $consolidated, $history); |
|
89 | + $this->renderPage(__DIR__.'/template/all.php', $logDir.'/all.html', $consolidated, $history); |
|
90 | + $this->renderPage(__DIR__.'/template/oop.php', $logDir.'/oop.html', $consolidated, $history); |
|
91 | + $this->renderPage(__DIR__.'/template/complexity.php', $logDir.'/complexity.html', $consolidated, $history); |
|
92 | + $this->renderPage(__DIR__.'/template/panel.php', $logDir.'/panel.html', $consolidated, $history); |
|
93 | + $this->renderPage(__DIR__.'/template/violations.php', $logDir.'/violations.html', $consolidated, $history); |
|
94 | 94 | if ($this->config->has('git')) { |
95 | - $this->renderPage(__DIR__ . '/template/git.php', $logDir . '/git.html', $consolidated, $history); |
|
95 | + $this->renderPage(__DIR__.'/template/git.php', $logDir.'/git.html', $consolidated, $history); |
|
96 | 96 | } |
97 | - $this->renderPage(__DIR__ . '/template/junit.php', $logDir . '/junit.html', $consolidated, $history); |
|
97 | + $this->renderPage(__DIR__.'/template/junit.php', $logDir.'/junit.html', $consolidated, $history); |
|
98 | 98 | |
99 | 99 | // js data |
100 | 100 | \file_put_contents( |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | |
109 | 109 | // json data |
110 | 110 | \file_put_contents( |
111 | - $logDir . '/js/classes.js', |
|
112 | - 'var classes = ' . \json_encode($consolidated->getClasses(), \JSON_PRETTY_PRINT) |
|
111 | + $logDir.'/js/classes.js', |
|
112 | + 'var classes = '.\json_encode($consolidated->getClasses(), \JSON_PRETTY_PRINT) |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | $this->output->writeln(\sprintf('HTML report generated in "%s" directory', $logDir)); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $diff = $newValue - $oldValue; |
181 | 181 | if ($diff > 0) { |
182 | - $diff = '+' . $diff; |
|
182 | + $diff = '+'.$diff; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $goodOrBad = 'neutral'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | if ($node instanceof \PhpParser\Node\Name\FullyQualified) { |
92 | - return (string)$node; |
|
92 | + return (string) $node; |
|
93 | 93 | } |
94 | 94 | if ($node instanceof \PhpParser\Node\Expr\New_) { |
95 | 95 | return getNameOfNode($node->class); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | if ($node instanceof \PhpParser\Node\Name) { |
103 | - return (string)implode($node->parts); |
|
103 | + return (string) implode($node->parts); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if (isset($node->name) && $node->name instanceof \PhpParser\Node\Expr\Variable) { |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | if (isset($node->name) && null === $node->name) { |
131 | - return 'anonymous@' . spl_object_hash($node); |
|
131 | + return 'anonymous@'.spl_object_hash($node); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | if (isset($node->name)) { |
135 | - return (string)$node->name; |
|
135 | + return (string) $node->name; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return null; |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | } |
151 | 151 | while (false !== ($file = readdir($dir))) { |
152 | 152 | if (('.' != $file) && ('..' != $file)) { |
153 | - if (is_dir($src . '/' . $file)) { |
|
154 | - recurse_copy($src . '/' . $file, $dst . '/' . $file); |
|
153 | + if (is_dir($src.'/'.$file)) { |
|
154 | + recurse_copy($src.'/'.$file, $dst.'/'.$file); |
|
155 | 155 | } else { |
156 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
156 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | // sums |
69 | - $sum = (object)[ |
|
69 | + $sum = (object) [ |
|
70 | 70 | 'loc' => 0, |
71 | 71 | 'cloc' => 0, |
72 | 72 | 'lloc' => 0, |
73 | 73 | 'nbMethods' => 0, |
74 | 74 | ]; |
75 | - $avg = (object)[ |
|
75 | + $avg = (object) [ |
|
76 | 76 | 'ccn' => [], |
77 | 77 | 'bugs' => [], |
78 | 78 | 'kanDefect' => [], |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $violations[$name]++; |
133 | 133 | } |
134 | 134 | } |
135 | - $sum->violations = (object)$violations; |
|
135 | + $sum->violations = (object) $violations; |
|
136 | 136 | |
137 | 137 | $this->avg = $avg; |
138 | 138 | $this->sum = $sum; |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $output = 0; |
51 | 51 | $fanout = []; |
52 | 52 | |
53 | - \iterate_over_node($node, function ($node) use (&$output, &$fanout) { |
|
53 | + \iterate_over_node($node, function($node) use (&$output, &$fanout) { |
|
54 | 54 | switch (true) { |
55 | 55 | case $node instanceof Stmt\Return_: |
56 | 56 | $output++; |