| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function remove(OrderInterface $order, PartialShipItems $shipItems): OrderInterface |
||
| 22 | { |
||
| 23 | /** @var ShipmentInterface $shipment */ |
||
| 24 | $shipment = $order->getShipments()->first(); |
||
| 25 | |||
| 26 | /** @var OrderItemUnitInterface $unit */ |
||
| 27 | foreach ($shipment->getUnits() as $unit) { |
||
| 28 | $item = $shipItems->findById($unit->getOrderItem()->getId()); |
||
|
|
|||
| 29 | if (null !== $item && $item->getQuantity() > 0) { |
||
| 30 | /** @var ShipmentInterface $oldShipment */ |
||
| 31 | $oldShipment = $unit->getShipment(); |
||
| 32 | |||
| 33 | $oldShipment->removeUnit($unit); |
||
| 34 | $item->setQuantity($item->getQuantity() - 1); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | return $order; |
||
| 39 | } |
||
| 41 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.