Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
28 | 1 | public function evaluate($program, Env\EnvInterface $env, Evaluator $evaluate) |
|
29 | { |
||
30 | // bindings is an array of pairs: [[param, value], [param, value]] |
||
31 | 1 | list($_let, $bindings) = $program; |
|
|
|||
32 | 1 | $letBody = \array_slice($program, 2); |
|
33 | 1 | $lambdaExp = array_merge( |
|
34 | 1 | [$this->lambdaSymbol, array_column($bindings, 0)], |
|
35 | 1 | $letBody); // unpack the body of let into the lambda exp |
|
36 | 1 | return $evaluate(array_merge([$lambdaExp], array_column($bindings, 1)), $env); |
|
37 | } |
||
38 | } |
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
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.