| Conditions | 3 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 2 | public function evaluate($exp, Env\EnvInterface $env, Evaluator $evaluate) |
|
| 27 | { |
||
| 28 | 2 | list($lambda, $params) = $exp; |
|
|
|
|||
| 29 | 2 | $body = \array_slice($exp, 2); |
|
| 30 | 2 | return function (...$args) use ($env, $body, $params, $evaluate) { |
|
| 31 | 2 | if (\count($params)) { |
|
| 32 | 1 | $env = ($this->envExtender)($env, new Env\SimpleEnv(array_combine($params, $args))); |
|
| 33 | } |
||
| 34 | |||
| 35 | 2 | while (\count($body) > 1) { |
|
| 36 | 2 | $evaluate(array_shift($body), $env); |
|
| 37 | } |
||
| 38 | |||
| 39 | 2 | return $evaluate(array_shift($body), $env); |
|
| 40 | 2 | }; |
|
| 41 | } |
||
| 42 | |||
| 47 | } |
This checks looks for assignemnts to variables using the
list(...)function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$aand$care used. There was no need to assign$b.Instead, the list call could have been.