Skip to content

Commit

Permalink
Merge pull request #20 from donmo-roundup/fix/php7.4-compatibility
Browse files Browse the repository at this point in the history
minor fixes for combatibility with php7.4
  • Loading branch information
DavidVin357 authored Aug 11, 2023
2 parents b7e9487 + 20f2c94 commit 0fd568a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Model/CartDonationManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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');
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions Model/DonationManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
Expand All @@ -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()]);
Expand Down
2 changes: 1 addition & 1 deletion Model/Resolver/RemoveDonationFromCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Model/Total/Donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0fd568a

Please sign in to comment.