From 20f2c94fa710bdbce6f74838f205386445b3565d Mon Sep 17 00:00:00 2001 From: david Date: Fri, 11 Aug 2023 21:17:59 +0300 Subject: [PATCH] minor fixes for combatibility with php7.4 --- Model/CartDonationManagement.php | 8 ++++---- Model/DonationManagement.php | 4 ++-- Model/Resolver/RemoveDonationFromCart.php | 2 +- Model/Total/Donation.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Model/CartDonationManagement.php b/Model/CartDonationManagement.php index b83de2d..8ac154b 100644 --- a/Model/CartDonationManagement.php +++ b/Model/CartDonationManagement.php @@ -11,14 +11,14 @@ class CartDonationManagement implements CartDonationManagementInterface { public function __construct( CartRepositoryInterface $cartRepository, - SerializerInterface $serializer, + SerializerInterface $serializer ) { $this->cartRepository = $cartRepository; $this->serializer = $serializer; } /** - @inheritdoc + @inheritdoc */ public function addDonationToCart(int $cartId, float $donationAmount): string { @@ -33,7 +33,7 @@ public function addDonationToCart(int $cartId, float $donationAmount): string } else { return $this->serializer->serialize(['message' => 'Invalid donation']); } - } catch (NoSuchEntityException) { + } catch (NoSuchEntityException $e) { throw new NoSuchEntityException(__('The quote could not be loaded')); } catch (\Exception $e) { throw new \Exception('Some error has occurred'); @@ -52,7 +52,7 @@ public function removeDonationFromCart(int $cartId): string $this->cartRepository->save($quote); return $this->serializer->serialize(['message' => 'Success']); - } catch (NoSuchEntityException) { + } catch (NoSuchEntityException $e) { throw new NoSuchEntityException(__('The quote could not be loaded')); } catch (\Exception $e) { throw new \Exception('Some error has occurred'); diff --git a/Model/DonationManagement.php b/Model/DonationManagement.php index cf29234..05910ae 100644 --- a/Model/DonationManagement.php +++ b/Model/DonationManagement.php @@ -112,7 +112,7 @@ public function addDonationToCart(string $cartId, float $donationAmount): string } else { return $this->serializer->serialize(['message' => 'Invalid donation']); } - } catch (NoSuchEntityException) { + } catch (NoSuchEntityException $e) { return $this->serializer->serialize(["message" => "The quote could not be loaded"]); } catch (\Exception $e) { return $this->serializer->serialize(["message" => "An error has occurred: " . $e->getMessage()]); @@ -135,7 +135,7 @@ public function removeDonationFromCart(string $cartId): string $this->cartRepository->save($quote); return $this->serializer->serialize(['message' => 'Success']); - } catch (NoSuchEntityException) { + } catch (NoSuchEntityException $e) { return $this->serializer->serialize(["message" => "The quote could not be loaded"]); } catch (\Exception $e) { return $this->serializer->serialize(["message" => "An error has occurred: " . $e->getMessage()]); diff --git a/Model/Resolver/RemoveDonationFromCart.php b/Model/Resolver/RemoveDonationFromCart.php index 10489ee..635876c 100644 --- a/Model/Resolver/RemoveDonationFromCart.php +++ b/Model/Resolver/RemoveDonationFromCart.php @@ -19,7 +19,7 @@ class RemoveDonationFromCart implements ResolverInterface public function __construct( Logger $logger, CartRepositoryInterface $cartRepository, - GetCartForUser $getCartForUser, + GetCartForUser $getCartForUser ) { $this->logger = $logger; $this->cartRepository = $cartRepository; diff --git a/Model/Total/Donation.php b/Model/Total/Donation.php index 0859edc..1c55c16 100644 --- a/Model/Total/Donation.php +++ b/Model/Total/Donation.php @@ -29,7 +29,7 @@ public function collect( Quote $quote, ShippingAssignmentInterface $shippingAssignment, Total $total - ): static { + ) { parent::collect($quote, $shippingAssignment, $total); if (!count($shippingAssignment->getItems())) { return $this;