diff --git a/composer.json b/composer.json index 4a996e5..bfa7169 100644 --- a/composer.json +++ b/composer.json @@ -105,6 +105,7 @@ "analyse": "psalm", "check-style": "ecs check", "fix-style": "ecs check --fix", - "phpunit": "phpunit" + "phpunit": "phpunit", + "rector": "rector" } } diff --git a/src/WebhookHandler/OrderPackedWebhookHandler.php b/src/WebhookHandler/OrderPackedWebhookHandler.php index 35b44ae..ffd3d9f 100644 --- a/src/WebhookHandler/OrderPackedWebhookHandler.php +++ b/src/WebhookHandler/OrderPackedWebhookHandler.php @@ -38,19 +38,15 @@ public function handle(object $data): void throw new \InvalidArgumentException(sprintf('Order with id "%s" not found', $data->orderId)); } - $syliusOrderLines = array_values(array_map(static function (OrderItemInterface $orderItem): array { - return [ - 'id' => (string) $orderItem->getId(), - 'quantity' => $orderItem->getQuantity(), - ]; - }, $order->getItems()->toArray())); - - $peakOrderLines = array_map(static function (WebhookDataPickOrderLine $orderLine): array { - return [ - 'id' => $orderLine->orderLineId, - 'quantity' => $orderLine->quantity, - ]; - }, $data->orderLines); + $syliusOrderLines = array_values(array_map(static fn (OrderItemInterface $orderItem): array => [ + 'id' => (string) $orderItem->getId(), + 'quantity' => $orderItem->getQuantity(), + ], $order->getItems()->toArray())); + + $peakOrderLines = array_map(static fn (WebhookDataPickOrderLine $orderLine): array => [ + 'id' => $orderLine->orderLineId, + 'quantity' => $orderLine->quantity, + ], $data->orderLines); try { self::assertSame($syliusOrderLines, $peakOrderLines);