From cbf730fbcbc7397ad52983f390fe6ac2f149762e Mon Sep 17 00:00:00 2001 From: janpalen Date: Fri, 3 Jan 2025 15:03:23 +0100 Subject: [PATCH] OP-550 - Fix code standards --- src/Component/Product/AddToCartFormComponent.php | 4 ++-- src/EventListener/CartItemAddListener.php | 2 +- src/Form/Type/ProductBundleItemType.php | 1 - src/Handler/Api/AddProductBundleToCartHandler.php | 6 +++--- src/Twig/Extension/ProductBundleOrderItemExtension.php | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Component/Product/AddToCartFormComponent.php b/src/Component/Product/AddToCartFormComponent.php index 7c7b8111..18358c8f 100644 --- a/src/Component/Product/AddToCartFormComponent.php +++ b/src/Component/Product/AddToCartFormComponent.php @@ -73,12 +73,12 @@ public function __construct( ProductRepositoryInterface $productRepository, ProductVariantRepositoryInterface $productVariantRepository, private readonly AddProductBundleToCartDtoFactory $addProductBundleToCartDtoFactory, - ) { $this->initializeProduct($productRepository); $this->initializeProductVariant($productVariantRepository); - parent::__construct($this->formFactory, + parent::__construct( + $this->formFactory, $this->manager, $this->router, $this->requestStack, diff --git a/src/EventListener/CartItemAddListener.php b/src/EventListener/CartItemAddListener.php index f7c0e426..4346d69c 100644 --- a/src/EventListener/CartItemAddListener.php +++ b/src/EventListener/CartItemAddListener.php @@ -19,7 +19,7 @@ final class CartItemAddListener { public function __construct( - private readonly OrderModifierInterface $orderModifier + private readonly OrderModifierInterface $orderModifier, ) { } diff --git a/src/Form/Type/ProductBundleItemType.php b/src/Form/Type/ProductBundleItemType.php index 9931130b..2e3c344d 100644 --- a/src/Form/Type/ProductBundleItemType.php +++ b/src/Form/Type/ProductBundleItemType.php @@ -20,7 +20,6 @@ final class ProductBundleItemType extends AbstractResourceType { public function buildForm(FormBuilderInterface $builder, array $options = []): void { - $builder ->add('quantity', IntegerType::class, [ 'label' => false, diff --git a/src/Handler/Api/AddProductBundleToCartHandler.php b/src/Handler/Api/AddProductBundleToCartHandler.php index f5afd24c..37955cc0 100644 --- a/src/Handler/Api/AddProductBundleToCartHandler.php +++ b/src/Handler/Api/AddProductBundleToCartHandler.php @@ -27,7 +27,7 @@ final class AddProductBundleToCartHandler public function __construct( private OrderRepositoryInterface $orderRepository, private ProductRepositoryInterface $productRepository, - private CartProcessorInterface $cartProcessor + private CartProcessorInterface $cartProcessor, ) { } @@ -36,11 +36,11 @@ public function __invoke(AddProductBundleToCartDto $addProductBundleToCartComman /** @var OrderInterface|null $cart */ $cart = $this->orderRepository->findCartByTokenValue($addProductBundleToCartCommand->getOrderTokenValue()); - if ($cart === null) { + if (null === $cart) { throw new \InvalidArgumentException('Cart with given token has not been found.'); } - /** @var null|ProductInterface $product */ + /** @var ProductInterface|null $product */ $product = $this->productRepository->findOneByCode($addProductBundleToCartCommand->getProductCode()); Assert::notNull($product); Assert::true($product->isBundle()); diff --git a/src/Twig/Extension/ProductBundleOrderItemExtension.php b/src/Twig/Extension/ProductBundleOrderItemExtension.php index 8a2142ab..6e789a99 100644 --- a/src/Twig/Extension/ProductBundleOrderItemExtension.php +++ b/src/Twig/Extension/ProductBundleOrderItemExtension.php @@ -12,7 +12,6 @@ namespace BitBag\SyliusProductBundlePlugin\Twig\Extension; use BitBag\SyliusProductBundlePlugin\Entity\ProductInterface; -use http\Exception\RuntimeException; use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -30,7 +29,7 @@ public function getFunctions(): array new TwigFunction( 'bitbag_render_product_bundle_order_items', [$this, 'renderProductBundleOrderItems'], - ['is_safe' => ['html']] + ['is_safe' => ['html']], ), ]; }