From c7049e887a6a2868190aea2f86177e895b5e8498 Mon Sep 17 00:00:00 2001 From: Liam Toohey Date: Mon, 22 Jun 2020 11:01:59 +0100 Subject: [PATCH] Fix phpstan --- src/Model/GetInventoryRequestFromOrder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/GetInventoryRequestFromOrder.php b/src/Model/GetInventoryRequestFromOrder.php index 19ea768..29ff5c3 100644 --- a/src/Model/GetInventoryRequestFromOrder.php +++ b/src/Model/GetInventoryRequestFromOrder.php @@ -113,11 +113,13 @@ private function getAddressFromOrder(OrderInterface $order): ?AddressInterface return null; } + $region = $shippingAddress->getRegion() === '' ? null : $shippingAddress->getRegion(); + return $this->addressInterfaceFactory->create([ 'country' => $shippingAddress->getCountryId(), 'postcode' => $shippingAddress->getPostcode(), 'street' => implode("\n", $shippingAddress->getStreet()), - 'region' => $shippingAddress->getRegion() ?? $shippingAddress->getRegionCode() ?? '', + 'region' => $region ?? $shippingAddress->getRegionCode() ?? '', 'city' => $shippingAddress->getCity() ]); }