Skip to content

Commit

Permalink
Updating cs to PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jun 19, 2024
1 parent 7db0b23 commit d8bafac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"analyse": "psalm",
"check-style": "ecs check",
"fix-style": "ecs check --fix",
"phpunit": "phpunit"
"phpunit": "phpunit",
"rector": "rector"
}
}
22 changes: 9 additions & 13 deletions src/WebhookHandler/OrderPackedWebhookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d8bafac

Please sign in to comment.