Completed
Pull Request — master (#370)
by Löki
04:56
created
src/Hal/Violation/Class_/TooComplexClassCode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function apply(Metric $metric)
27 27
     {
28
-        if (! $metric instanceof ClassMetric) {
28
+        if (!$metric instanceof ClassMetric) {
29 29
             return;
30 30
         }
31 31
 
Please login to merge, or discard this patch.
src/Hal/Component/Ast/NodeTraverser.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
     /**
46 46
      * @param array $nodes
47
-     * @param array|NodeVisitor[] $visitors
47
+     * @param NodeVisitor[] $visitors
48 48
      * @return array
49 49
      */
50 50
     public function traverseArray(array $nodes, array $visitors) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct(Mother $traverser, $stopCondition = null)
30 30
     {
31
-        if(null === $stopCondition) {
31
+        if (null === $stopCondition) {
32 32
             $stopCondition = function($node) {
33 33
                 if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) {
34 34
                     return false;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 }
97 97
 
98 98
 if (PHP_VERSION_ID >= 70000) {
99
-    class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
99
+    class_alias(Php7NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser');
100 100
 } else {
101
-    class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
101
+    class_alias(Php5NodeTraverser::class, __NAMESPACE__.'\\NodeTraverser');
102 102
 }
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
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
         }
68 68
 
69 69
         // sums
70
-        $sum = (object)[
70
+        $sum = (object) [
71 71
             'loc' => 0,
72 72
             'cloc' => 0,
73 73
             'lloc' => 0,
74 74
             'nbMethods' => 0,
75 75
         ];
76
-        $avg = (object)[
76
+        $avg = (object) [
77 77
             'wmc' => [],
78 78
             'ccn' => [],
79 79
             'bugs' => [],
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 $violations[$name]++;
166 166
             }
167 167
         }
168
-        $sum->violations = (object)$violations;
168
+        $sum->violations = (object) $violations;
169 169
 
170 170
 
171 171
         $this->avg = $avg;
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Coupling/ExternalsVisitor.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -136,6 +136,9 @@
 block discarded – undo
136 136
         }
137 137
     }
138 138
 
139
+    /**
140
+     * @param string|null $dependency
141
+     */
139 142
     private function pushToDependencies(array &$dependencies, $dependency)
140 143
     {
141 144
         $lowercase = strtolower($dependency);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
             // extends
63 63
             if (isset($node->extends)) {
64 64
                 if (is_array($node->extends)) {
65
-                    foreach ((array)$node->extends as $interface) {
66
-                        $this->pushToDependencies($dependencies, (string)$interface);
67
-                        array_push($parents, (string)$interface);
65
+                    foreach ((array) $node->extends as $interface) {
66
+                        $this->pushToDependencies($dependencies, (string) $interface);
67
+                        array_push($parents, (string) $interface);
68 68
                     }
69 69
                 } else {
70
-                    $this->pushToDependencies($dependencies, (string)$node->extends);
71
-                    array_push($parents, (string)$node->extends);
70
+                    $this->pushToDependencies($dependencies, (string) $node->extends);
71
+                    array_push($parents, (string) $node->extends);
72 72
                 }
73 73
             }
74 74
 
75 75
             // implements
76 76
             if (isset($node->implements)) {
77 77
                 foreach ($node->implements as $interface) {
78
-                    $this->pushToDependencies($dependencies, (string)$interface);
78
+                    $this->pushToDependencies($dependencies, (string) $interface);
79 79
                 }
80 80
             }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                     // return
85 85
                     if (isset($stmt->returnType)) {
86 86
                         if ($stmt->returnType instanceof Node\Name\FullyQualified) {
87
-                            $this->pushToDependencies($dependencies, (string)$stmt->returnType);
87
+                            $this->pushToDependencies($dependencies, (string) $stmt->returnType);
88 88
                         }
89 89
                     }
90 90
 
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
                     foreach ($stmt->params as $param) {
93 93
                         if ($param->type) {
94 94
                             if ($param->type instanceof Node\Name\FullyQualified) {
95
-                                $this->pushToDependencies($dependencies, (string)$param->type);
95
+                                $this->pushToDependencies($dependencies, (string) $param->type);
96 96
                             }
97 97
                         }
98 98
                     }
99 99
 
100 100
                     // instantiations, static calls
101
-                    \iterate_over_node($stmt, function ($node) use (&$dependencies) {
101
+                    \iterate_over_node($stmt, function($node) use (&$dependencies) {
102 102
                         switch (true) {
103 103
                             case $node instanceof Node\Expr\New_:
104 104
                                 // new MyClass
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
                             foreach ($this->uses as $use) {
119 119
                                 if (method_exists($use, 'getAlias')) {
120 120
                                     if (((string) $use->getAlias()) === $check) {
121
-                                        $this->pushToDependencies($dependencies, (string)($use->name));
121
+                                        $this->pushToDependencies($dependencies, (string) ($use->name));
122 122
                                     }
123 123
                                     continue;
124 124
                                 }
125 125
                                 if ($use->alias === $check) {
126
-                                    $this->pushToDependencies($dependencies, (string)($use->name));
126
+                                    $this->pushToDependencies($dependencies, (string) ($use->name));
127 127
                                 }
128 128
                             }
129 129
                         }
Please login to merge, or discard this patch.