Skip to content

Commit

Permalink
added coding standard that enforces the method signature to be split …
Browse files Browse the repository at this point in the history
…into more lines so each parameter is on its own line when the method signature is longer than 120 chars
  • Loading branch information
TomasLudvik committed Jun 15, 2023
1 parent 3f52e0d commit e713e93
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 27 deletions.
7 changes: 5 additions & 2 deletions src/Brand/BrandView.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand Down
9 changes: 7 additions & 2 deletions src/Image/ImageView.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Image/ImageViewFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/Product/Action/ProductActionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand Down
7 changes: 5 additions & 2 deletions src/Product/Action/ProductActionViewFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

/**
Expand Down
18 changes: 14 additions & 4 deletions src/Product/Listed/ListedProductViewElasticFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
18 changes: 14 additions & 4 deletions src/Product/Listed/ListedProductViewFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
23 changes: 20 additions & 3 deletions src/Product/Listed/ListedProductViewFacadeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
}
15 changes: 11 additions & 4 deletions src/Product/Listed/ListedProductViewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions tests/Unit/Product/Listed/ListedProductViewFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e713e93

Please sign in to comment.