Conditions | 5 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
18 | 4 | public function __invoke(Load $a_load, Destination $a_destination, array $some_price_rules): float |
|
19 | { |
||
20 | 4 | $load_lines = $a_load->lines(); |
|
21 | 4 | $benefits = 0; |
|
22 | |||
23 | 4 | foreach ($load_lines as $load_line) |
|
24 | { |
||
25 | 4 | foreach ($some_price_rules as $price_rule) |
|
26 | { |
||
27 | 4 | if ($load_line->product()->equals($price_rule->product()) && $a_destination->city() === $price_rule->city()) |
|
|
|||
28 | { |
||
29 | 4 | $benefits += $price_rule->price() * $load_line->kilograms(); |
|
30 | } |
||
31 | } |
||
32 | } |
||
33 | |||
34 | 4 | return $benefits; |
|
35 | } |
||
36 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: