@@ -64,7 +64,7 @@ |
||
64 | 64 | foreach ($node->stmts as $stmt) { |
65 | 65 | if ($stmt instanceof Stmt\ClassMethod) { |
66 | 66 | // iterate over children, recursively |
67 | - $cb = function ($node) use (&$cb) { |
|
67 | + $cb = function($node) use (&$cb) { |
|
68 | 68 | $ccn = 0; |
69 | 69 | |
70 | 70 | foreach (get_object_vars($node) as $name => $member) { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $output = new CliOutput(); |
23 | 23 | |
24 | 24 | // issues and debug |
25 | - $issuer = (new Issuer($output));//->enable(); |
|
25 | + $issuer = (new Issuer($output)); //->enable(); |
|
26 | 26 | |
27 | 27 | // config |
28 | 28 | $config = (new Parser())->parse($argv); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | return |
99 | 99 | 0 >= version_compare( |
100 | 100 | '10.0.10586', |
101 | - PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD |
|
101 | + PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD |
|
102 | 102 | ) |
103 | 103 | || false !== getenv('ANSICON') |
104 | 104 | || 'ON' === getenv('ConEmuANSI') |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __construct(Mother $traverser, $stopCondition = null) |
28 | 28 | { |
29 | 29 | if (null === $stopCondition) { |
30 | - $stopCondition = function ($node) { |
|
30 | + $stopCondition = function($node) { |
|
31 | 31 | if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) { |
32 | 32 | return false; |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $class->set('interface', true); |
38 | 38 | $class->set('abstract', true); |
39 | 39 | } else { |
40 | - $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node)); |
|
40 | + $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
|
41 | 41 | $class = new ClassMetric($name); |
42 | 42 | $class->set('interface', false); |
43 | 43 | $class->set('abstract', $node instanceof Stmt\Trait_ || $node->isAbstract()); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $roleDetector = new RoleOfMethodDetector(); |
51 | 51 | foreach ($node->stmts as $stmt) { |
52 | 52 | if ($stmt instanceof Stmt\ClassMethod) { |
53 | - $function = new FunctionMetric((string)$stmt->name); |
|
53 | + $function = new FunctionMetric((string) $stmt->name); |
|
54 | 54 | |
55 | 55 | $role = $roleDetector->detects($stmt); |
56 | 56 | $function->set('role', $role); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | public function leaveNode(Node $node) |
48 | 48 | { |
49 | 49 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
50 | - $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node)); |
|
50 | + $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
|
51 | 51 | $classOrFunction = $this->metrics->get($name); |
52 | 52 | |
53 | 53 | if (null === $lloc = $classOrFunction->get('lloc')) { |
@@ -58,20 +58,20 @@ discard block |
||
58 | 58 | // extends |
59 | 59 | if (isset($node->extends)) { |
60 | 60 | if (is_array($node->extends)) { |
61 | - foreach ((array)$node->extends as $interface) { |
|
62 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
63 | - array_push($parents, (string)$interface); |
|
61 | + foreach ((array) $node->extends as $interface) { |
|
62 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
63 | + array_push($parents, (string) $interface); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $this->pushToDependencies($dependencies, (string)$node->extends); |
|
67 | - array_push($parents, (string)$node->extends); |
|
66 | + $this->pushToDependencies($dependencies, (string) $node->extends); |
|
67 | + array_push($parents, (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 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
74 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // return |
81 | 81 | if (isset($stmt->returnType)) { |
82 | 82 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
83 | - $this->pushToDependencies($dependencies, (string)$stmt->returnType); |
|
83 | + $this->pushToDependencies($dependencies, (string) $stmt->returnType); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | foreach ($stmt->params as $param) { |
89 | 89 | if ($param->type) { |
90 | 90 | if ($param->type instanceof Node\Name\FullyQualified) { |
91 | - $this->pushToDependencies($dependencies, (string)$param->type); |
|
91 | + $this->pushToDependencies($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,13 +113,13 @@ discard block |
||
113 | 113 | foreach ($matches[1] as $check) { |
114 | 114 | foreach ($this->uses as $use) { |
115 | 115 | if (method_exists($use, 'getAlias')) { |
116 | - if (((string)$use->getAlias()) === $check) { |
|
117 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
116 | + if (((string) $use->getAlias()) === $check) { |
|
117 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
118 | 118 | } |
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | if ($use->alias === $check) { |
122 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
122 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -138,6 +138,6 @@ discard block |
||
138 | 138 | if ('self' === $lowercase || 'parent' === $lowercase) { |
139 | 139 | return; |
140 | 140 | } |
141 | - array_push($dependencies, (string)$dependency); |
|
141 | + array_push($dependencies, (string) $dependency); |
|
142 | 142 | } |
143 | 143 | } |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | { |
45 | 45 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) { |
46 | 46 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
47 | - $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node)); |
|
47 | + $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
|
48 | 48 | $classOrFunction = $this->metrics->get($name); |
49 | 49 | } else { |
50 | - $classOrFunction = new FunctionMetric((string)$node->name); |
|
50 | + $classOrFunction = new FunctionMetric((string) $node->name); |
|
51 | 51 | $this->metrics->attach($classOrFunction); |
52 | 52 | } |
53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $operands = []; |
56 | 56 | $operators = []; |
57 | 57 | |
58 | - iterate_over_node($node, function ($node) use (&$operators, &$operands) { |
|
58 | + iterate_over_node($node, function($node) use (&$operators, &$operands) { |
|
59 | 59 | if ($node instanceof Node\Expr\BinaryOp |
60 | 60 | || $node instanceof Node\Expr\AssignOp |
61 | 61 | || $node instanceof Stmt\If_ |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | { |
35 | 35 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) { |
36 | 36 | if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) { |
37 | - $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node)); |
|
37 | + $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node)); |
|
38 | 38 | $classOrFunction = $this->metrics->get($name); |
39 | 39 | } else { |
40 | - $classOrFunction = new FunctionMetric((string)$node->name); |
|
40 | + $classOrFunction = new FunctionMetric((string) $node->name); |
|
41 | 41 | $this->metrics->attach($classOrFunction); |
42 | 42 | } |
43 | 43 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $code = preg_replace('!/\*.*?\*/!s', '', $code); |
58 | 58 | |
59 | 59 | // count and remove single line comments |
60 | - $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) { |
|
60 | + $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) { |
|
61 | 61 | if (isset($matches[2])) { |
62 | 62 | $cloc += 1; |
63 | 63 | } |