Completed
Pull Request — master (#314)
by
unknown
02:03
created
src/Hal/Application/Application.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Hal/Report/Csv/Reporter.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Hal/Report/Html/Reporter.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,8 +116,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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';
Please login to merge, or discard this patch.
src/Hal/Metric/Consolidated.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Hal/Metric/System/UnitTesting/UnitTesting.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         // JUNIT format
82 82
         foreach ($xpath->query('//testsuite[@file]') as $suite) {
83
-            $testsuites[] = (object)[
83
+            $testsuites[] = (object) [
84 84
                 'file' => $suite->getAttribute('file'),
85 85
                 'name' => $suite->getAttribute('name'),
86 86
                 'assertions' => $suite->getAttribute('assertions'),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             $attributeClass = $case->getAttribute('class');
113
-            $testsuites[$attributeClass] = (object)[
113
+            $testsuites[$attributeClass] = (object) [
114 114
                 'file' => $case->getAttribute('file'),
115 115
                 'name' => $attributeClass,
116 116
                 'assertions' => $assertions,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $traverser->addVisitor(new ExternalsVisitor($metricsOfUnitTest));
130 130
 
131 131
             if (!\file_exists($suite->file) || !\is_readable($suite->file)) {
132
-                throw new \LogicException('Cannot find source file referenced in testsuite: ' . $suite->file);
132
+                throw new \LogicException('Cannot find source file referenced in testsuite: '.$suite->file);
133 133
             }
134 134
 
135 135
             $code = \file_get_contents($suite->file);
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 
143 143
             // list of externals sources of unit test
144 144
             $metric = $metricsOfUnitTest->get($suite->name);
145
-            $externals = (array)$metric->get('externals');
145
+            $externals = (array) $metric->get('externals');
146 146
 
147 147
             // global stats for each test
148
-            $infoAboutTests[$suite->name] = (object)[
148
+            $infoAboutTests[$suite->name] = (object) [
149 149
                 'nbExternals' => \count(\array_unique($externals)),
150 150
                 'externals' => \array_unique($externals),
151 151
                 'filename' => $suite->file,
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * GitChanges constructor.
30 30
      *
31 31
      * @param Config $config
32
-     * @param array $files
32
+     * @param string[] $files
33 33
      */
34 34
     public function __construct(Config $config, array $files)
35 35
     {
Please login to merge, or discard this patch.
src/Hal/Metric/System/Packages/Composer/Composer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         foreach ($rawRequirements as $requirement => $version) {
47 47
             $package = $packagist->get($requirement);
48 48
 
49
-            $packages[$requirement] = (object)[
49
+            $packages[$requirement] = (object) [
50 50
                 'name' => $requirement,
51 51
                 'required' => $version,
52 52
                 'installed' => isset($rawInstalled[$requirement]) ? $rawInstalled[$requirement] : null,
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
             if (!\preg_match('/composer(-dist)?\.json/', $filename)) {
78 78
                 continue;
79 79
             }
80
-            $composerJson = (object)\json_decode(\file_get_contents($filename));
80
+            $composerJson = (object) \json_decode(\file_get_contents($filename));
81 81
 
82 82
             if (!isset($composerJson->require)) {
83 83
                 continue;
84 84
             }
85 85
 
86
-            $rawRequirements[] = (array)$composerJson->require;
86
+            $rawRequirements[] = (array) $composerJson->require;
87 87
         }
88 88
 
89 89
         return \call_user_func_array('\array_merge', $rawRequirements);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             if (false === \strpos($filename, 'composer.lock')) {
108 108
                 continue;
109 109
             }
110
-            $composerLockJson = (object)\json_decode(\file_get_contents($filename));
110
+            $composerLockJson = (object) \json_decode(\file_get_contents($filename));
111 111
 
112 112
             if (!isset($composerLockJson->packages)) {
113 113
                 continue;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * GitChanges constructor.
30 30
      *
31 31
      * @param Config $config
32
-     * @param array $files
32
+     * @param string[] $files
33 33
      */
34 34
     public function __construct(Config $config, array $files)
35 35
     {
Please login to merge, or discard this patch.
src/Hal/Metric/System/Packages/Composer/Packagist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
         // get latest version
37 37
         $latest = '0.0.0';
38
-        foreach ((array)$json->package->versions as $version => $datas) {
38
+        foreach ((array) $json->package->versions as $version => $datas) {
39 39
             $version = \preg_replace('([^\.\d])', '', $version);
40 40
             if (!\preg_match('!\d+\.\d+\.\d+!', $version)) {
41 41
                 continue;
Please login to merge, or discard this patch.
src/Hal/Metric/Helper/RoleOfMethodDetector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
         // build a fingerprint of the given method
51 51
         $fingerprintOfMethod = [];
52
-        \iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) {
52
+        \iterate_over_node($node, function($node) use (&$fingerprintOfMethod) {
53 53
 
54 54
             // avoid cast
55 55
             if ($node instanceof Cast) {
Please login to merge, or discard this patch.
src/Hal/Metric/Helper/MetricClassNameGenerator.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
     public static function getName(Node $node)
18 18
     {
19 19
         return ($node instanceof Node\Stmt\Class_ && $node->isAnonymous()) ?
20
-            'anonymous@' . \spl_object_hash($node) :
21
-            $node->namespacedName->toString();
20
+            'anonymous@'.\spl_object_hash($node) : $node->namespacedName->toString();
22 21
     }
23 22
 }
Please login to merge, or discard this patch.