From e713e939aec0848af33e0caa1e2816386407dae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Tue, 23 May 2023 11:48:42 +0200 Subject: [PATCH] added coding standard that enforces the method signature to be split into more lines so each parameter is on its own line when the method signature is longer than 120 chars --- src/Brand/BrandView.php | 7 ++++-- src/Image/ImageView.php | 9 ++++++-- src/Image/ImageViewFacade.php | 6 +++-- src/Product/Action/ProductActionView.php | 8 +++++-- .../Action/ProductActionViewFacade.php | 7 ++++-- .../Listed/ListedProductViewElasticFacade.php | 18 +++++++++++---- .../Listed/ListedProductViewFacade.php | 18 +++++++++++---- .../ListedProductViewFacadeInterface.php | 23 ++++++++++++++++--- .../Listed/ListedProductViewFactory.php | 15 ++++++++---- .../Listed/ListedProductViewFactoryTest.php | 9 ++++++-- 10 files changed, 93 insertions(+), 27 deletions(-) diff --git a/src/Brand/BrandView.php b/src/Brand/BrandView.php index 3c05e2f23d..5114391eb3 100644 --- a/src/Brand/BrandView.php +++ b/src/Brand/BrandView.php @@ -11,8 +11,11 @@ class BrandView * @param string $name * @param string $mainUrl */ - public function __construct(protected readonly int $id, protected readonly string $name, protected readonly string $mainUrl) - { + public function __construct( + protected readonly int $id, + protected readonly string $name, + protected readonly string $mainUrl, + ) { } /** diff --git a/src/Image/ImageView.php b/src/Image/ImageView.php index 45d77e62ac..0a862cf6e6 100644 --- a/src/Image/ImageView.php +++ b/src/Image/ImageView.php @@ -13,8 +13,13 @@ class ImageView * @param string|null $type * @param string|null $name */ - public function __construct(protected readonly int $id, protected readonly string $extension, protected readonly string $entityName, protected readonly ?string $type = null, protected readonly ?string $name = null) - { + public function __construct( + protected readonly int $id, + protected readonly string $extension, + protected readonly string $entityName, + protected readonly ?string $type = null, + protected readonly ?string $name = null, + ) { } /** diff --git a/src/Image/ImageViewFacade.php b/src/Image/ImageViewFacade.php index 8392710db5..ccf0e084e7 100644 --- a/src/Image/ImageViewFacade.php +++ b/src/Image/ImageViewFacade.php @@ -13,8 +13,10 @@ class ImageViewFacade implements ImageViewFacadeInterface * @param \Shopsys\FrameworkBundle\Component\Image\ImageFacade $imageFacade * @param \Shopsys\ReadModelBundle\Image\ImageViewFactory $imageViewFactory */ - public function __construct(protected readonly ImageFacade $imageFacade, protected readonly ImageViewFactory $imageViewFactory) - { + public function __construct( + protected readonly ImageFacade $imageFacade, + protected readonly ImageViewFactory $imageViewFactory, + ) { } /** diff --git a/src/Product/Action/ProductActionView.php b/src/Product/Action/ProductActionView.php index 2ed4ee06cb..1846f3aaa8 100644 --- a/src/Product/Action/ProductActionView.php +++ b/src/Product/Action/ProductActionView.php @@ -12,8 +12,12 @@ class ProductActionView * @param bool $isMainVariant * @param string $detailUrl */ - public function __construct(protected readonly int $id, protected readonly bool $sellingDenied, protected readonly bool $isMainVariant, protected readonly string $detailUrl) - { + public function __construct( + protected readonly int $id, + protected readonly bool $sellingDenied, + protected readonly bool $isMainVariant, + protected readonly string $detailUrl, + ) { } /** diff --git a/src/Product/Action/ProductActionViewFacade.php b/src/Product/Action/ProductActionViewFacade.php index be3f0bd38e..d11b50a1e8 100644 --- a/src/Product/Action/ProductActionViewFacade.php +++ b/src/Product/Action/ProductActionViewFacade.php @@ -15,8 +15,11 @@ class ProductActionViewFacade implements ProductActionViewFacadeInterface * @param \Shopsys\FrameworkBundle\Component\Domain\Domain $domain * @param \Shopsys\ReadModelBundle\Product\Action\ProductActionViewFactory $productActionViewFactory */ - public function __construct(protected readonly ProductCollectionFacade $productCollectionFacade, protected readonly Domain $domain, protected readonly ProductActionViewFactory $productActionViewFactory) - { + public function __construct( + protected readonly ProductCollectionFacade $productCollectionFacade, + protected readonly Domain $domain, + protected readonly ProductActionViewFactory $productActionViewFactory, + ) { } /** diff --git a/src/Product/Listed/ListedProductViewElasticFacade.php b/src/Product/Listed/ListedProductViewElasticFacade.php index 3e6697dd8f..0d972f2dc7 100644 --- a/src/Product/Listed/ListedProductViewElasticFacade.php +++ b/src/Product/Listed/ListedProductViewElasticFacade.php @@ -118,8 +118,13 @@ public function getAllAccessories(int $productId): array * @param int $limit * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult - { + public function getFilteredPaginatedInCategory( + int $categoryId, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult { $paginationResult = $this->productOnCurrentDomainFacade->getPaginatedProductsInCategory( $filterData, $orderingModeId, @@ -139,8 +144,13 @@ public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterDat * @param int $limit * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedForSearch(string $searchText, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult - { + public function getFilteredPaginatedForSearch( + string $searchText, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult { $paginationResult = $this->productOnCurrentDomainFacade->getPaginatedProductsForSearch( $searchText, $filterData, diff --git a/src/Product/Listed/ListedProductViewFacade.php b/src/Product/Listed/ListedProductViewFacade.php index 0cfd0702d6..fca379d5f0 100644 --- a/src/Product/Listed/ListedProductViewFacade.php +++ b/src/Product/Listed/ListedProductViewFacade.php @@ -109,8 +109,13 @@ public function getAllAccessories(int $productId): array * @param int $limit * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult - { + public function getFilteredPaginatedInCategory( + int $categoryId, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult { $paginationResult = $this->productOnCurrentDomainFacade->getPaginatedProductsInCategory( $filterData, $orderingModeId, @@ -130,8 +135,13 @@ public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterDat * @param int $limit * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedForSearch(string $searchText, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult - { + public function getFilteredPaginatedForSearch( + string $searchText, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult { $paginationResult = $this->productOnCurrentDomainFacade->getPaginatedProductsForSearch( $searchText, $filterData, diff --git a/src/Product/Listed/ListedProductViewFacadeInterface.php b/src/Product/Listed/ListedProductViewFacadeInterface.php index aa02d033ac..398e5875ce 100644 --- a/src/Product/Listed/ListedProductViewFacadeInterface.php +++ b/src/Product/Listed/ListedProductViewFacadeInterface.php @@ -41,7 +41,13 @@ public function getAllAccessories(int $productId): array; * @param int $limit Number of products per page (must be greater than 0) * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult; + public function getFilteredPaginatedInCategory( + int $categoryId, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult; /** * @param string $searchText @@ -51,7 +57,13 @@ public function getFilteredPaginatedInCategory(int $categoryId, ProductFilterDat * @param int $limit Number of products per page (must be greater than 0) * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getFilteredPaginatedForSearch(string $searchText, ProductFilterData $filterData, string $orderingModeId, int $page, int $limit): PaginationResult; + public function getFilteredPaginatedForSearch( + string $searchText, + ProductFilterData $filterData, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult; /** * @param int $brandId @@ -60,5 +72,10 @@ public function getFilteredPaginatedForSearch(string $searchText, ProductFilterD * @param int $limit Number of products per page (must be greater than 0) * @return \Shopsys\FrameworkBundle\Component\Paginator\PaginationResult */ - public function getPaginatedForBrand(int $brandId, string $orderingModeId, int $page, int $limit): PaginationResult; + public function getPaginatedForBrand( + int $brandId, + string $orderingModeId, + int $page, + int $limit, + ): PaginationResult; } diff --git a/src/Product/Listed/ListedProductViewFactory.php b/src/Product/Listed/ListedProductViewFactory.php index 219c00053e..adefff2c8a 100644 --- a/src/Product/Listed/ListedProductViewFactory.php +++ b/src/Product/Listed/ListedProductViewFactory.php @@ -82,8 +82,11 @@ protected function create( * @param \Shopsys\ReadModelBundle\Product\Action\ProductActionView $productActionView * @return \Shopsys\ReadModelBundle\Product\Listed\ListedProductView */ - public function createFromProduct(Product $product, ?ImageView $imageView, ProductActionView $productActionView): ListedProductView - { + public function createFromProduct( + Product $product, + ?ImageView $imageView, + ProductActionView $productActionView, + ): ListedProductView { return $this->create( $product->getId(), $product->isVariant() && $product->getVariantAlias() ? $product->getVariantAlias() : $product->getName(), @@ -103,8 +106,12 @@ public function createFromProduct(Product $product, ?ImageView $imageView, Produ * @param \Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroup $pricingGroup * @return \Shopsys\ReadModelBundle\Product\Listed\ListedProductView */ - public function createFromArray(array $productArray, ?ImageView $imageView, ProductActionView $productActionView, PricingGroup $pricingGroup): ListedProductView - { + public function createFromArray( + array $productArray, + ?ImageView $imageView, + ProductActionView $productActionView, + PricingGroup $pricingGroup, + ): ListedProductView { $productPrice = $this->priceFactory->createProductPriceFromArrayByPricingGroup( $productArray['prices'], $pricingGroup, diff --git a/tests/Unit/Product/Listed/ListedProductViewFactoryTest.php b/tests/Unit/Product/Listed/ListedProductViewFactoryTest.php index d4e951d908..f5e0f0c9b8 100644 --- a/tests/Unit/Product/Listed/ListedProductViewFactoryTest.php +++ b/tests/Unit/Product/Listed/ListedProductViewFactoryTest.php @@ -97,8 +97,13 @@ public function testCreateFromProduct( * @param \Shopsys\FrameworkBundle\Model\Product\Flag\Flag[]|\Doctrine\Common\Collections\Collection $flags * @return \PHPUnit\Framework\MockObject\MockObject|\Shopsys\FrameworkBundle\Model\Product\Product */ - private function createProductMock(int $id, string $name, string $shortDescription, string $availabilityName, $flags) - { + private function createProductMock( + int $id, + string $name, + string $shortDescription, + string $availabilityName, + $flags, + ) { $productMock = $this->createMock(Product::class); $productMock->method('getId')->willReturn($id);