Skip to content

Commit

Permalink
PHPStan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Feb 13, 2024
1 parent 06e19c1 commit 49087a9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
6 changes: 1 addition & 5 deletions src/Handler/CreatePaypalOrderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
use PrestaShop\Module\PrestashopCheckout\Api\Payment\Order;
use PrestaShop\Module\PrestashopCheckout\Builder\Payload\OrderPayloadBuilder;
use PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext;
use PrestaShop\Module\PrestashopCheckout\DTO\Orders\CreatePayPalOrderRequest;
use PrestaShop\Module\PrestashopCheckout\DTO\Orders\CreatePayPalOrderResponse;
use PrestaShop\Module\PrestashopCheckout\Exception\PsCheckoutException;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Exception\PayPalOrderException;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\PayPalOrderHttpClientInterface;
use PrestaShop\Module\PrestashopCheckout\Presenter\Cart\CartPresenter;
use PrestaShop\Module\PrestashopCheckout\ShopContext;
use Ps_checkout;
Expand All @@ -44,7 +40,7 @@ class CreatePaypalOrderHandler
*/
private $context;

public function __construct(\Context $context)
public function __construct(Context $context)
{
$this->context = $context;

Check failure on line 45 in src/Handler/CreatePaypalOrderHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0.0)

Property PrestaShop\Module\PrestashopCheckout\Handler\CreatePaypalOrderHandler::$context (PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext) does not accept Context.

Check failure on line 45 in src/Handler/CreatePaypalOrderHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan (latest)

Property PrestaShop\Module\PrestashopCheckout\Handler\CreatePaypalOrderHandler::$context (PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext) does not accept Context.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@

use PrestaShop\Module\PrestashopCheckout\Cart\CartRepositoryInterface;
use PrestaShop\Module\PrestashopCheckout\Cart\Exception\CartNotFoundException;
use PrestaShop\Module\PrestashopCheckout\Context\PrestaShopContext;
use PrestaShop\Module\PrestashopCheckout\Event\EventDispatcherInterface;
use PrestaShop\Module\PrestashopCheckout\Handler\CreatePaypalOrderHandler;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Command\CreatePayPalOrderCommand;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\CreatePayPalOrderPayloadBuilderInterface;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Event\PayPalOrderCreatedEvent;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Exception\PayPalOrderException;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\PayPalOrderHttpClientInterface;

class CreatePayPalOrderCommandHandler
{
Expand Down
15 changes: 2 additions & 13 deletions src/PayPal/Order/PayPalOrderHttpClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@

namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order;

use PrestaShop\Module\PrestashopCheckout\DTO\Orders\CreatePayPalOrderRequest;
use PrestaShop\Module\PrestashopCheckout\DTO\Orders\CreatePayPalOrderResponse;
use PrestaShop\Module\PrestashopCheckout\DTO\Orders\PatchPayPalOrderRequest;
use PrestaShop\Module\PrestashopCheckout\DTO\Orders\PatchPayPalOrderResponse;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\DTO\CreatePayPalOrderRequest;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\DTO\CreatePayPalOrderResponse;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Exception\PayPalOrderException;

interface PayPalOrderHttpClientInterface
Expand All @@ -36,13 +34,4 @@ interface PayPalOrderHttpClientInterface
* @throws PayPalOrderException
*/
public function createOrder(CreatePayPalOrderRequest $payload);

/**
* @param PatchPayPalOrderRequest $payload
*
* @return PatchPayPalOrderResponse
*
* @throws PayPalOrderException
*/
public function patchOrder(PatchPayPalOrderRequest $payload);
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(CacheInterface $orderCache, PsCheckoutCartRepository
*/
public function handle(GetPayPalOrderQuery $query)
{
$orderId = $query->getOrderId() ? $query->getOrderId()->getValue() : null;
$orderId = !$query->getOrderId()->getValue() ? null : $query->getOrderId()->getValue();

if (!$orderId) {
$psCheckoutCart = $this->checkoutCartRepository->findOneByCartId($query->getCartId()->getValue());
Expand Down

0 comments on commit 49087a9

Please sign in to comment.