@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | // extends |
| 64 | 64 | if (isset($node->extends)) { |
| 65 | 65 | if (is_array($node->extends)) { |
| 66 | - foreach ((array)$node->extends as $interface) { |
|
| 67 | - array_push($dependencies, (string)$interface); |
|
| 68 | - array_push($parents, (string)$interface); |
|
| 66 | + foreach ((array) $node->extends as $interface) { |
|
| 67 | + array_push($dependencies, (string) $interface); |
|
| 68 | + array_push($parents, (string) $interface); |
|
| 69 | 69 | } |
| 70 | 70 | } else { |
| 71 | - array_push($dependencies, (string)$node->extends); |
|
| 72 | - array_push($parents, (string)$node->extends); |
|
| 71 | + array_push($dependencies, (string) $node->extends); |
|
| 72 | + array_push($parents, (string) $node->extends); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // implements |
| 77 | 77 | if (isset($node->implements)) { |
| 78 | 78 | foreach ($node->implements as $interface) { |
| 79 | - array_push($dependencies, (string)$interface); |
|
| 79 | + array_push($dependencies, (string) $interface); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // return |
| 86 | 86 | if (isset($stmt->returnType)) { |
| 87 | 87 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
| 88 | - array_push($dependencies, (string)$stmt->returnType); |
|
| 88 | + array_push($dependencies, (string) $stmt->returnType); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | foreach ($stmt->params as $param) { |
| 94 | 94 | if ($param->type) { |
| 95 | 95 | if ($param->type instanceof Node\Name\FullyQualified) { |
| 96 | - array_push($dependencies, (string)$param->type); |
|
| 96 | + array_push($dependencies, (string) $param->type); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // instantiations, static calls |
| 102 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
| 102 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
| 103 | 103 | switch (true) { |
| 104 | 104 | case $node instanceof Node\Expr\New_: |
| 105 | 105 | // new MyClass |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | foreach ($this->uses as $use) { |
| 120 | 120 | if (method_exists($use, 'getAlias')) { |
| 121 | 121 | if (((string) $use->getAlias()) === $check) { |
| 122 | - array_push($dependencies, (string)($use->name)); |
|
| 122 | + array_push($dependencies, (string) ($use->name)); |
|
| 123 | 123 | } |
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | if ($use->alias === $check) { |
| 127 | - array_push($dependencies, (string)($use->name)); |
|
| 127 | + array_push($dependencies, (string) ($use->name)); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 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) { |
@@ -101,6 +101,9 @@ discard block |
||
| 101 | 101 | /** @var Traverser */ |
| 102 | 102 | private $traverser; |
| 103 | 103 | |
| 104 | + /** |
|
| 105 | + * @param \Closure $stopCondition |
|
| 106 | + */ |
|
| 104 | 107 | public function __construct($cloneNodes = false, $stopCondition = null) |
| 105 | 108 | { |
| 106 | 109 | parent::__construct(); |
@@ -123,6 +126,9 @@ discard block |
||
| 123 | 126 | /** @var Traverser */ |
| 124 | 127 | private $traverser; |
| 125 | 128 | |
| 129 | + /** |
|
| 130 | + * @param \Closure $stopCondition |
|
| 131 | + */ |
|
| 126 | 132 | public function __construct($cloneNodes = false, $stopCondition = null) |
| 127 | 133 | { |
| 128 | 134 | parent::__construct(); |
@@ -28,9 +28,9 @@ |
||
| 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 | - if($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) { |
|
| 33 | + if ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Interface_) { |
|
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -81,13 +81,13 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | public function detects($node) |
| 83 | 83 | { |
| 84 | - if (! $node instanceof ClassMethod) { |
|
| 84 | + if (!$node instanceof ClassMethod) { |
|
| 85 | 85 | return null; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // build a fingerprint of the given method |
| 89 | 89 | $fingerprintOfMethod = []; |
| 90 | - iterate_over_node($node, function ($node) use (&$fingerprintOfMethod) { |
|
| 90 | + iterate_over_node($node, function($node) use (&$fingerprintOfMethod) { |
|
| 91 | 91 | |
| 92 | 92 | // avoid identifier (php-parser:^4) |
| 93 | 93 | if ($node instanceof Identifier) { |