| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function calculateCharges(OrderInterface $order) |
||
| 28 | { |
||
| 29 | $plans = $this->repository->findByOrder($order); |
||
|
|
|||
| 30 | $charges = []; |
||
| 31 | foreach ($order->getActions() as $actionKey => $action) { |
||
| 32 | if (empty($plans[$actionKey])) { |
||
| 33 | throw new FailedFindPlan(); |
||
| 34 | } |
||
| 35 | $charges[$actionKey] = $plans[$actionKey]->calculateCharges($action); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $charges; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
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: