Completed
Pull Request — master (#290)
by Benjamin
04:53
created
src/Hal/Metric/Class_/Complexity/KanDefectVisitor.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
             $select = $while = $if = 0;
44 44
 
45
-            iterate_over_node($node, function ($node) use (&$while, &$select, &$if) {
45
+            iterate_over_node($node, function($node) use (&$while, &$select, &$if) {
46 46
                 switch (true) {
47 47
                     case $node instanceof Stmt\Do_:
48 48
                     case $node instanceof Stmt\Foreach_:
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 }
59 59
             });
60 60
 
61
-            $defect = 0.15 + 0.23 *  $while + 0.22 *  $select + 0.07 * $if;
61
+            $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if;
62 62
             $class->set('kanDefect', round($defect, 2));
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Hal\Metric\Class_\Complexity;
3 3
 
4
-use Hal\Component\Reflected\Method;
5 4
 use Hal\Metric\Metrics;
6 5
 use PhpParser\Node;
7 6
 use PhpParser\Node\Stmt;
Please login to merge, or discard this patch.
src/Hal/Metric/System/Changes/GitChanges.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         }
52 52
 
53 53
         $r = shell_exec(sprintf('%s --version', $bin));
54
-        if(!preg_match('!git version!', $r)) {
54
+        if (!preg_match('!git version!', $r)) {
55 55
             throw new ConfigException(sprintf('Git binary (%s) incorrect', $bin));
56 56
         }
57 57
 
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
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
         // build a fingerprint of the given method
49 49
         $fingerprintOfMethod = [];
50
-        iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) {
50
+        iterate_over_node($node, function($node) use (&$fingerprintOfMethod) {
51 51
 
52 52
             // avoid cast
53 53
             if ($node instanceof Cast) {
Please login to merge, or discard this patch.
artifacts/phar/build.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-chdir(__DIR__ . '/../../');
2
+chdir(__DIR__.'/../../');
3 3
 
4 4
 if (!file_exists('vendor/autoload.php')) {
5
-    echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!' . PHP_EOL;
5
+    echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!'.PHP_EOL;
6 6
     exit(1);
7 7
 }
8 8
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     if (preg_match($exclude, $file)) {
22 22
         continue;
23 23
     }
24
-    $path = str_replace(__DIR__ . '/', '', $file);
24
+    $path = str_replace(__DIR__.'/', '', $file);
25 25
     $phar->addFromString($path, file_get_contents($file));
26 26
 }
27 27
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 function rglob($pattern = '*', $flags = 0, $path = '')
54 54
 {
55
-    $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
56
-    $files = glob($path . $pattern, $flags);
55
+    $paths = glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
56
+    $files = glob($path.$pattern, $flags);
57 57
     foreach ($paths as $path) {
58 58
         $files = array_merge($files, rglob($pattern, $flags, $path));
59 59
     }
Please login to merge, or discard this patch.
src/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 /**
33 33
  * @param $node
34
- * @param $callback
34
+ * @param Closure $callback
35 35
  */
36 36
 function iterate_over_node($node, $callback)
37 37
 {
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 }
137 137
 
138 138
 /**
139
- * @param $src
140
- * @param $dst
139
+ * @param string $src
140
+ * @param string $dst
141 141
  */
142 142
 function recurse_copy($src, $dst)
143 143
 {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     }
91 91
 
92 92
     if ($node instanceof \PhpParser\Node\Name\FullyQualified) {
93
-        return (string)$node;
93
+        return (string) $node;
94 94
     }
95 95
     if ($node instanceof \PhpParser\Node\Expr\New_) {
96 96
         return getNameOfNode($node->class);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
     if ($node instanceof \PhpParser\Node\Name) {
104
-        return (string)implode($node->parts);
104
+        return (string) implode($node->parts);
105 105
     }
106 106
 
107 107
     if (isset($node->name) && $node->name instanceof \PhpParser\Node\Expr\Variable) {
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
     }
130 130
 
131 131
     if (isset($node->name) && null === $node->name) {
132
-        return 'anonymous@' . spl_object_hash($node);
132
+        return 'anonymous@'.spl_object_hash($node);
133 133
     }
134 134
 
135 135
     if (isset($node->name)) {
136
-        return (string)$node->name;
136
+        return (string) $node->name;
137 137
     }
138 138
 
139 139
     return null;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
     }
152 152
     while (false !== ($file = readdir($dir))) {
153 153
         if (($file != '.') && ($file != '..')) {
154
-            if (is_dir($src . '/' . $file)) {
155
-                recurse_copy($src . '/' . $file, $dst . '/' . $file);
154
+            if (is_dir($src.'/'.$file)) {
155
+                recurse_copy($src.'/'.$file, $dst.'/'.$file);
156 156
             } else {
157
-                copy($src . '/' . $file, $dst . '/' . $file);
157
+                copy($src.'/'.$file, $dst.'/'.$file);
158 158
             }
159 159
         }
160 160
     }
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
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         }
59 59
 
60 60
         // sums
61
-        $sum = (object)[
61
+        $sum = (object) [
62 62
             'loc' => 0,
63 63
             'cloc' => 0,
64 64
             'lloc' => 0,
65 65
             'nbMethods' => 0,
66 66
         ];
67
-        $avg = (object)[
67
+        $avg = (object) [
68 68
             'ccn' => [],
69 69
             'bugs' => [],
70 70
             'kanDefect' => [],
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                 $violations[$name]++;
125 125
             }
126 126
         }
127
-        $sum->violations = (object)$violations;
127
+        $sum->violations = (object) $violations;
128 128
 
129 129
 
130 130
         $this->avg = $avg;
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Coupling/ExternalsVisitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
             // extends
61 61
             if (isset($node->extends)) {
62 62
                 if (is_array($node->extends)) {
63
-                    foreach ((array)$node->extends as $interface) {
64
-                        array_push($dependencies, (string)$interface);
63
+                    foreach ((array) $node->extends as $interface) {
64
+                        array_push($dependencies, (string) $interface);
65 65
                     }
66 66
                 } else {
67
-                    array_push($dependencies, (string)$node->extends);
67
+                    array_push($dependencies, (string) $node->extends);
68 68
                 }
69 69
             }
70 70
 
71 71
             // implements
72 72
             if (isset($node->implements)) {
73 73
                 foreach ($node->implements as $interface) {
74
-                    array_push($dependencies, (string)$interface);
74
+                    array_push($dependencies, (string) $interface);
75 75
                 }
76 76
             }
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     // return
81 81
                     if (isset($stmt->returnType)) {
82 82
                         if ($stmt->returnType instanceof Node\Name\FullyQualified) {
83
-                            array_push($dependencies, (string)$stmt->returnType);
83
+                            array_push($dependencies, (string) $stmt->returnType);
84 84
                         }
85 85
                     }
86 86
 
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
                     foreach ($stmt->params as $param) {
89 89
                         if ($param->type) {
90 90
                             if ($param->type instanceof Node\Name\FullyQualified) {
91
-                                array_push($dependencies, (string)$param->type);
91
+                                array_push($dependencies, (string) $param->type);
92 92
                             }
93 93
                         }
94 94
                     }
95 95
 
96 96
                     // instantiations, static calls
97
-                    \iterate_over_node($stmt, function ($node) use (&$dependencies) {
97
+                    \iterate_over_node($stmt, function($node) use (&$dependencies) {
98 98
                         switch (true) {
99 99
                             case $node instanceof Node\Expr\New_:
100 100
                                 // new MyClass
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                         foreach ($matches[1] as $check) {
114 114
                             foreach ($this->uses as $use) {
115 115
                                 if ($use->alias === $check) {
116
-                                    array_push($dependencies, (string)($use->name));
116
+                                    array_push($dependencies, (string) ($use->name));
117 117
                                 }
118 118
                             }
119 119
                         }
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/loc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require __DIR__ . '/_header.php'; ?>
1
+<?php require __DIR__.'/_header.php'; ?>
2 2
 
3 3
 
4 4
 <?php
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
 // 2. percentile map
21 21
 $json = [];
22
-if(sizeof($array) > 1) {
22
+if (sizeof($array) > 1) {
23 23
     $range = range(0.5, 1, .05);
24 24
     foreach ($range as $percentile) {
25
-        $json[] = (object)[
25
+        $json[] = (object) [
26 26
             'lloc' => procentile($array, $percentile),
27 27
             'percentile' => $percentile * 100,
28 28
         ];
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 </div>
75 75
 
76 76
 
77
-<?php require __DIR__ . '/_footer.php'; ?>
77
+<?php require __DIR__.'/_footer.php'; ?>
78 78
 
79 79
 
80 80
 <script>
Please login to merge, or discard this patch.
src/Hal/Application/Analyze.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
     /**
50 50
      * Analyze constructor.
51
-     * @param OutputInterface $output
51
+     * @param Output $output
52 52
      */
53 53
     public function __construct(Config $config, Output $output, Issuer $issuer)
54 54
     {
Please login to merge, or discard this patch.