Completed
Pull Request — master (#314)
by
unknown
01:54
created
src/Hal/Metric/Class_/Text/LengthVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
38 38
             if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
39
-                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'. \spl_object_hash($node));
39
+                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.\spl_object_hash($node));
40 40
                 $classOrFunction = $this->metrics->get($name);
41 41
             } else {
42 42
                 $classOrFunction = new FunctionMetric($node->name);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $code = \preg_replace('!/\*.*?\*/!s', '', $code);
61 61
 
62 62
             // count and remove single line comments
63
-            $code = \preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) {
63
+            $code = \preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) {
64 64
                 if (isset($matches[2])) {
65 65
                     ++$cloc;
66 66
                 }
Please login to merge, or discard this patch.
src/Hal/Metric/Class_/Complexity/KanDefectVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
             $select = $while = $if = 0;
45 45
 
46
-            \iterate_over_node($node, function ($node) use (&$while, &$select, &$if) {
46
+            \iterate_over_node($node, function($node) use (&$while, &$select, &$if) {
47 47
                 switch (true) {
48 48
                     case $node instanceof Stmt\Do_:
49 49
                     case $node instanceof Stmt\Foreach_:
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 }
60 60
             });
61 61
 
62
-            $defect = 0.15 + 0.23 *  $while + 0.22 *  $select + 0.07 * $if;
62
+            $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if;
63 63
             $class->set('kanDefect', \round($defect, 2));
64 64
         }
65 65
     }
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
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * GitChanges constructor.
35 35
      *
36 36
      * @param Config $config
37
-     * @param array $files
37
+     * @param string[] $files
38 38
      */
39 39
     public function __construct(Config $config, array $files)
40 40
     {
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
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      * GitChanges constructor.
23 23
      *
24 24
      * @param Config $config
25
-     * @param array $files
25
+     * @param string[] $files
26 26
      */
27 27
     public function __construct(Config $config, array $files)
28 28
     {
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.
src/Hal/Report/Json/Reporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             return;
51 51
         }
52 52
         if (!\file_exists(\dirname($logFile)) || !\is_writable(\dirname($logFile))) {
53
-            throw new \RuntimeException('You don\'t have permissions to write JSON report in ' . $logFile);
53
+            throw new \RuntimeException('You don\'t have permissions to write JSON report in '.$logFile);
54 54
         }
55 55
 
56 56
         \file_put_contents($logFile, \json_encode($metrics, \JSON_PRETTY_PRINT));
Please login to merge, or discard this patch.
src/Hal/Report/Html/template/relations.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1
-<?php require __DIR__ . '/_header.php'; ?>
1
+<?php require __DIR__.'/_header.php'; ?>
2 2
 
3 3
 <?php
4 4
 $relations = [];
5 5
 $classesCp = [];
6 6
 foreach ($classes as $class) {
7
-    $class['name'] = '\\' . $class['name'];
7
+    $class['name'] = '\\'.$class['name'];
8 8
     $classesCp[$class['name']] = $class;
9 9
     $classesCp[$class['name']]['externals'] = [];
10 10
 
11 11
 
12 12
     foreach ($class['externals'] as &$ext) {
13
-        $ext = '\\' . $ext;
13
+        $ext = '\\'.$ext;
14 14
         if (!isset($classes[$ext])) {
15 15
             $classesCp[$ext] = [
16 16
                 'name' => $ext,
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     } unset($ext);
22 22
 }
23 23
 foreach ($classesCp as $class) {
24
-    $relations[] = (object)[
24
+    $relations[] = (object) [
25 25
         'name' => $class['name'],
26 26
         'size' => 3000,
27 27
         'relations' => array_values(array_unique($class['externals'])),
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     </div>
40 40
 </div>
41 41
 
42
-<?php require __DIR__ . '/_footer.php'; ?>
42
+<?php require __DIR__.'/_footer.php'; ?>
43 43
 
44 44
 
45 45
 <script type="text/javascript">
Please login to merge, or discard this patch.