@@ 139-153 (lines=15) @@ | ||
136 | */ |
|
137 | private function handleCallableType(Node $node) |
|
138 | { |
|
139 | if (($node instanceof Node\Stmt\Function_ |
|
140 | || $node instanceof Node\Stmt\ClassMethod |
|
141 | || $node instanceof Node\Expr\Closure) |
|
142 | && !empty($node->params) |
|
143 | ) { |
|
144 | foreach ($node->params as $param) { |
|
145 | if ((string)$param->type === 'callable') { |
|
146 | $this->getResult()->addRequirement( |
|
147 | Reason::TYPEHINT_CALLABLE, |
|
148 | $param->getLine() |
|
149 | ); |
|
150 | } |
|
151 | } |
|
152 | ||
153 | } |
|
154 | } |
|
155 | ||
156 | /** |
@@ 58-73 (lines=16) @@ | ||
55 | } |
|
56 | } |
|
57 | } |
|
58 | } elseif ($node instanceof Node\Expr\FuncCall |
|
59 | || $node instanceof Node\Expr\MethodCall |
|
60 | || $node instanceof Node\Expr\StaticCall |
|
61 | ) { |
|
62 | if (!empty($node->args)) { |
|
63 | foreach ($node->args as $arg) { |
|
64 | if ($arg->unpack === true) { |
|
65 | $this->getResult()->addRequirement( |
|
66 | Reason::ARGUMENT_UNPACKING, |
|
67 | $arg->getLine() |
|
68 | ); |
|
69 | } |
|
70 | } |
|
71 | } |
|
72 | ||
73 | } elseif ($node instanceof Node\Stmt\Const_ || $node instanceof Node\Stmt\ClassConst) { |
|
74 | foreach ($node->consts as $const) { |
|
75 | if (!($const->value instanceof Node\Scalar) |
|
76 | && !($const->value instanceof Node\Expr\ClassConstFetch || $const->value instanceof Node\Expr\ConstFetch) |