@@ -25,7 +25,7 @@ |
||
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 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | $string = ''; |
46 | 46 | foreach ($this->data as $violation) { |
47 | - $string .= $violation->getName() . ','; |
|
47 | + $string .= $violation->getName().','; |
|
48 | 48 | } |
49 | 49 | return $string; |
50 | 50 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | public function apply(Metric $metric) |
24 | 24 | { |
25 | - if (! $metric instanceof PackageMetric) { |
|
25 | + if (!$metric instanceof PackageMetric) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | $instability = $metric->getInstability(); |
29 | 29 | $violatingInstabilities = array_filter( |
30 | 30 | $metric->getDependentInstabilities(), |
31 | - function ($otherInstability) use ($instability) { |
|
31 | + function($otherInstability) use ($instability) { |
|
32 | 32 | return $otherInstability >= $instability; |
33 | 33 | } |
34 | 34 | ); |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | |
58 | 58 | $count = count($this->violatingInstabilities); |
59 | 59 | $thisInstability = round($value, 3); |
60 | - $packages = implode("\n* ", array_map(function ($name, $instability) { |
|
61 | - $name = $name === '\\' ? 'global' : substr((string)$name, 0, -1); |
|
60 | + $packages = implode("\n* ", array_map(function($name, $instability) { |
|
61 | + $name = $name === '\\' ? 'global' : substr((string) $name, 0, -1); |
|
62 | 62 | $instability = round($instability, 3); |
63 | 63 | return "$name ($instability)"; |
64 | 64 | }, array_keys($this->violatingInstabilities), $this->violatingInstabilities)); |
@@ -19,14 +19,14 @@ |
||
19 | 19 | |
20 | 20 | public function apply(Metric $metric) |
21 | 21 | { |
22 | - if (! $metric instanceof PackageMetric) { |
|
22 | + if (!$metric instanceof PackageMetric) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | $distance = $metric->getDistance(); |
26 | 26 | if ($distance === null) { |
27 | 27 | throw new ShouldNotHappenException('Distance is null'); |
28 | 28 | } |
29 | - if (abs($distance) > sqrt(2)/4) { |
|
29 | + if (abs($distance) > sqrt(2) / 4) { |
|
30 | 30 | $this->metric = $metric; |
31 | 31 | $metric->get('violations')->add($this); |
32 | 32 | } |
@@ -17,7 +17,6 @@ |
||
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 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'PhpParser\\Node\\Param', |
79 | 79 | 'PhpParser\\Node\\Expr\\Variable', |
80 | 80 | 'PhpParser\\Node\\Name', |
81 | - ],[ |
|
81 | + ], [ |
|
82 | 82 | // function setOk(?bool $ok): self { $this->isOk = $ok; return $this; } |
83 | 83 | 'PhpParser\\Node\\Stmt\\ClassMethod', |
84 | 84 | 'PhpParser\\Node\\Stmt\\Expression', |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function detects($node) |
100 | 100 | { |
101 | - if (! $node instanceof ClassMethod) { |
|
101 | + if (!$node instanceof ClassMethod) { |
|
102 | 102 | return null; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // build a fingerprint of the given method |
106 | 106 | $fingerprintOfMethod = []; |
107 | - iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) { |
|
107 | + iterate_over_node($node, function($node) use (&$fingerprintOfMethod) { |
|
108 | 108 | // avoid identifier (php-parser:^4) |
109 | 109 | if ($node instanceof Identifier) { |
110 | 110 | return; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function addClass($name) |
19 | 19 | { |
20 | 20 | $elements = $this->get('classes'); |
21 | - $elements[] = (string)$name; |
|
21 | + $elements[] = (string) $name; |
|
22 | 22 | $this->set('classes', $elements); |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function setAbstraction($abstraction) |
27 | 27 | { |
28 | 28 | if ($abstraction !== null) { |
29 | - $abstraction = (float)$abstraction; |
|
29 | + $abstraction = (float) $abstraction; |
|
30 | 30 | } |
31 | 31 | $this->set('abstraction', $abstraction); |
32 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function setInstability($instability) |
42 | 42 | { |
43 | 43 | if ($instability !== null) { |
44 | - $instability = (float)$instability; |
|
44 | + $instability = (float) $instability; |
|
45 | 45 | } |
46 | 46 | $this->set('instability', $instability); |
47 | 47 | } |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | } |
64 | 64 | $classDependencies = $this->getOutgoingClassDependencies(); |
65 | 65 | $packageDependencies = $this->getOutgoingPackageDependencies(); |
66 | - if (! in_array($className, $classDependencies)) { |
|
66 | + if (!in_array($className, $classDependencies)) { |
|
67 | 67 | $classDependencies[] = $className; |
68 | 68 | $this->set('outgoing_class_dependencies', $classDependencies); |
69 | 69 | } |
70 | - if (! in_array($packageName, $packageDependencies)) { |
|
70 | + if (!in_array($packageName, $packageDependencies)) { |
|
71 | 71 | $packageDependencies[] = $packageName; |
72 | 72 | $this->set('outgoing_package_dependencies', $packageDependencies); |
73 | 73 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | $classDependencies = $this->getIncomingClassDependencies(); |
98 | 98 | $packageDependencies = $this->getIncomingPackageDependencies(); |
99 | - if (! in_array($className, $classDependencies)) { |
|
99 | + if (!in_array($className, $classDependencies)) { |
|
100 | 100 | $classDependencies[] = $className; |
101 | 101 | $this->set('incoming_class_dependencies', $classDependencies); |
102 | 102 | } |
103 | - if (! in_array($packageName, $packageDependencies)) { |
|
103 | + if (!in_array($packageName, $packageDependencies)) { |
|
104 | 104 | $packageDependencies[] = $packageName; |
105 | 105 | $this->set('incoming_package_dependencies', $packageDependencies); |
106 | 106 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $file = current($this->files); |
67 | 67 | $realpath = realpath(dirname($file)); |
68 | 68 | if ($realpath === false) { |
69 | - throw new ShouldNotHappenException('Cannot get realpath of ' . dirname($file)); |
|
69 | + throw new ShouldNotHappenException('Cannot get realpath of '.dirname($file)); |
|
70 | 70 | } |
71 | 71 | $command = sprintf( |
72 | 72 | "cd %s && %s log --format='* %%at\t%%cn' --numstat -n 500", |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | // get latest version |
36 | 36 | $latest = '0.0.0'; |
37 | - foreach ((array)$json->package->versions as $version => $datas) { |
|
37 | + foreach ((array) $json->package->versions as $version => $datas) { |
|
38 | 38 | if ($version[0] === 'v') { |
39 | 39 | $version = substr($version, 1); |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $latest = $version; |
46 | 46 | $response->name = $package; |
47 | 47 | $response->latest = $version; |
48 | - $response->license = (array)$datas->license; |
|
48 | + $response->license = (array) $datas->license; |
|
49 | 49 | $response->homepage = $datas->homepage; |
50 | 50 | $response->time = $datas->time; |
51 | 51 | $response->zip = $datas->dist->url; |