Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Jan 3, 2024
1 parent ce532fc commit 3bcbc0a
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 54 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'dependabot/**'
pull_request: ~
release:
types: [created]
types: [ created ]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
Expand All @@ -21,11 +21,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.2", "8.3"]
symfony: ["^6.4", "^7.0"]
sylius: ["^1.12"]
node: ["16.x"]
mysql: ["5.7", "8.0"]
php: [ "8.2", "8.3" ]
symfony: [ "^6.4", "^7.0" ]
sylius: [ "^1.12" ]
node: [ "16.x" ]
mysql: [ "5.7", "8.0" ]

env:
APP_ENV: test
Expand Down Expand Up @@ -160,6 +160,10 @@ jobs:
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)

-
name: Check Coding Standard
run: vendor/bin/ecs

-
name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon -l max src/
Expand Down
1 change: 0 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};

4 changes: 2 additions & 2 deletions src/CommandHandler/Wishlist/AddProductToWishlistHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class AddProductToWishlistHandler implements MessageHandlerInterface
public function __construct(
WishlistProductFactoryInterface $wishlistProductFactory,
ProductRepositoryInterface $productRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->wishlistProductFactory = $wishlistProductFactory;
$this->productRepository = $productRepository;
Expand All @@ -45,7 +45,7 @@ public function __invoke(AddProductToWishlist $addProductToWishlist): WishlistIn

if (null === $product) {
throw new ProductNotFoundException(
sprintf('The Product %s does not exist', $productId)
sprintf('The Product %s does not exist', $productId),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class AddProductVariantToWishlistHandler implements MessageHandlerInterfac
public function __construct(
WishlistProductFactoryInterface $wishlistProductFactory,
ProductVariantRepositoryInterface $productVariantRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->wishlistProductFactory = $wishlistProductFactory;
$this->productVariantRepository = $productVariantRepository;
Expand All @@ -45,7 +45,7 @@ public function __invoke(AddProductVariantToWishlist $addProductVariantToWishlis

if (null === $variant) {
throw new ProductVariantNotFoundException(
sprintf('The ProductVariant %s does not exist', $variantId)
sprintf('The ProductVariant %s does not exist', $variantId),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/CommandHandler/Wishlist/CreateWishlistHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(
TokenStorageInterface $tokenStorage,
WishlistFactoryInterface $wishlistFactory,
ShopUserWishlistResolverInterface $shopUserWishlistResolver,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->tokenStorage = $tokenStorage;
$this->wishlistFactory = $wishlistFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
ProductRepositoryInterface $productRepository,
WishlistRepositoryInterface $wishlistRepository,
RepositoryInterface $wishlistProductRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->productRepository = $productRepository;
$this->wishlistRepository = $wishlistRepository;
Expand All @@ -54,13 +54,13 @@ public function __invoke(RemoveProductFromWishlist $removeProductFromWishlist):

if (null === $product || null === $wishlistProduct) {
throw new ProductNotFoundException(
sprintf('The Product %s does not exist', $productId)
sprintf('The Product %s does not exist', $productId),
);
}

if (null === $wishlist) {
throw new WishlistNotFoundException(
sprintf('The Wishlist %s does not exist', $token)
sprintf('The Wishlist %s does not exist', $token),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
WishlistRepositoryInterface $wishlistRepository,
ProductVariantRepositoryInterface $productVariantRepository,
RepositoryInterface $wishlistProductRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->wishlistRepository = $wishlistRepository;
$this->productVariantRepository = $productVariantRepository;
Expand All @@ -54,13 +54,13 @@ public function __invoke(RemoveProductVariantFromWishlist $removeProductVariantF

if (null === $variant || null === $wishlistProduct) {
throw new ProductVariantNotFoundException(
sprintf('The Product %s does not exist', $variantId)
sprintf('The Product %s does not exist', $variantId),
);
}

if (null === $wishlist) {
throw new WishlistNotFoundException(
sprintf('The Wishlist %s does not exist', $token)
sprintf('The Wishlist %s does not exist', $token),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/CommandHandler/Wishlist/RemoveWishlistHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class RemoveWishlistHandler implements MessageHandlerInterface

public function __construct(
WishlistRepositoryInterface $wishlistRepository,
ObjectManager $wishlistManager
ObjectManager $wishlistManager,
) {
$this->wishlistRepository = $wishlistRepository;
$this->wishlistManager = $wishlistManager;
Expand All @@ -37,7 +37,7 @@ public function __invoke(RemoveWishlist $removeWishlist): void

if (null === $wishlist) {
throw new WishlistNotFoundException(
sprintf('The Wishlist %s does not exist', $token)
sprintf('The Wishlist %s does not exist', $token),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Context/WishlistContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
TokenStorageInterface $tokenStorage,
WishlistRepositoryInterface $wishlistRepository,
WishlistFactoryInterface $wishlistFactory,
string $wishlistCookieToken
string $wishlistCookieToken,
) {
$this->tokenStorage = $tokenStorage;
$this->wishlistRepository = $wishlistRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Action/AddProductToWishlistAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(
RequestStack $requestStack,
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator,
string $wishlistCookieToken
string $wishlistCookieToken,
) {
$this->tokenStorage = $tokenStorage;
$this->productRepository = $productRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(
RequestStack $requestStack,
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator,
string $wishlistCookieToken
string $wishlistCookieToken,
) {
$this->tokenStorage = $tokenStorage;
$this->productVariantRepository = $productVariantRepository;
Expand Down
7 changes: 3 additions & 4 deletions src/Controller/Action/ListWishlistProductsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
EntityManagerInterface $cartManager,
RequestStack $requestStack,
TranslatorInterface $translator,
Environment $twigEnvironment
Environment $twigEnvironment,
) {
$this->wishlistContext = $wishlistContext;
$this->cartContext = $cartContext;
Expand All @@ -80,7 +80,6 @@ public function __invoke(Request $request): Response
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {

if ($this->handleCartItems($form)) {
$this->flashBag->add('success', $this->translator->trans('bitbag_sylius_wishlist_plugin.ui.added_to_cart'));
} else {
Expand All @@ -91,7 +90,7 @@ public function __invoke(Request $request): Response
$this->twigEnvironment->render('@BitBagSyliusWishlistPlugin/WishlistDetails/index.html.twig', [
'wishlist' => $wishlist,
'form' => $form->createView(),
])
]),
);
}

Expand All @@ -103,7 +102,7 @@ public function __invoke(Request $request): Response
$this->twigEnvironment->render('@BitBagSyliusWishlistPlugin/WishlistDetails/index.html.twig', [
'wishlist' => $wishlist,
'form' => $form->createView(),
])
]),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Action/RemoveProductFromWishlistAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
EntityManagerInterface $wishlistProductManager,
RequestStack $requestStack,
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator
UrlGeneratorInterface $urlGenerator,
) {
$this->wishlistContext = $wishlistContext;
$this->productRepository = $productRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
EntityManagerInterface $wishlistProductManager,
RequestStack $requestStack,
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator
UrlGeneratorInterface $urlGenerator,
) {
$this->wishlistContext = $wishlistContext;
$this->productVariantRepository = $productVariantRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Action/RenderHeaderTemplateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __invoke(Request $request): Response
return new Response(
$this->twigEnvironment->render('@BitBagSyliusWishlistPlugin/Common/widget.html.twig', [
'wishlist' => $wishlist,
])
]),
);
}
}
2 changes: 1 addition & 1 deletion src/Controller/OrderItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function addAction(Request $request): Response
$form = $this->getFormFactory()->create(
$configuration->getFormType(),
$this->createAddToCartCommand($cart, $orderItem),
$configuration->getFormOptions()
$configuration->getFormOptions(),
);

$form->handleRequest($request);
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/MergeUserWishlistItemsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
WishlistRepositoryInterface $wishlistRepository,
WishlistFactoryInterface $wishlistFactory,
ObjectManager $wishlistManager,
string $wishlistCookieToken
string $wishlistCookieToken,
) {
$this->wishlistRepository = $wishlistRepository;
$this->wishlistFactory = $wishlistFactory;
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/AddProductsToCartType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
AddToCartCommandFactoryInterface $addToCartCommandFactory,
CartItemFactoryInterface $cartItemFactory,
OrderItemQuantityModifierInterface $orderItemQuantityModifier,
array $validationGroups
array $validationGroups,
) {
$this->addToCartCommandFactory = $addToCartCommandFactory;
$this->cartItemFactory = $cartItemFactory;
Expand All @@ -58,7 +58,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'product' => $wishlistProduct->getProduct(),
'data' => $this->addToCartCommandFactory->createWithCartAndCartItem(
$options['cart'],
$this->createCartItem($wishlistProduct)
$this->createCartItem($wishlistProduct),
),
'is_wishlist' => true,
])
Expand Down
2 changes: 1 addition & 1 deletion src/Resolver/ShopUserWishlistResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class ShopUserWishlistResolver implements ShopUserWishlistResolverInterfac

public function __construct(
WishlistRepositoryInterface $wishlistRepository,
WishlistFactoryInterface $wishlistFactory
WishlistFactoryInterface $wishlistFactory,
) {
$this->wishlistRepository = $wishlistRepository;
$this->wishlistFactory = $wishlistFactory;
Expand Down
30 changes: 16 additions & 14 deletions tests/Behat/Context/Api/WishlistContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
WishlistRepositoryInterface $wishlistRepository,
UserRepositoryInterface $userRepository,
ClientInterface $client,
RouterInterface $router
RouterInterface $router,
) {
$this->client = $client;
$this->wishlistRepository = $wishlistRepository;
Expand Down Expand Up @@ -86,7 +86,7 @@ public function userIsAuthenticated(string $email, string $password): void
[
'headers' => $headers,
'body' => json_encode($body),
]
],
);
Assert::eq($response->getStatusCode(), 200);

Expand Down Expand Up @@ -116,7 +116,7 @@ public function userHasAWishlist(): void
$response = $this->client->request(
self::POST,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::POST, [])
$this->getOptions(self::POST, []),
);

$jsonBody = json_decode((string) $response->getBody());
Expand Down Expand Up @@ -157,9 +157,10 @@ public function userShouldHaveProductInTheWishlist(ProductInterface $product): b
}

throw new \Exception(
sprintf('Product %s was not found in the wishlist',
$product->getName()
)
sprintf(
'Product %s was not found in the wishlist',
$product->getName(),
),
);
}

Expand Down Expand Up @@ -190,9 +191,10 @@ public function userShouldHaveProductVariantInTheWishlist(ProductVariantInterfac
}

throw new \Exception(
sprintf('Product variant %s was not found in the wishlist',
$variant->getName()
)
sprintf(
'Product variant %s was not found in the wishlist',
$variant->getName(),
),
);
}

Expand All @@ -209,7 +211,7 @@ public function userRemovesProductFromTheWishlist(ProductInterface $product): vo
$response = $this->client->request(
self::DELETE,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::DELETE, [])
$this->getOptions(self::DELETE, []),
);

Assert::eq($response->getStatusCode(), 204);
Expand Down Expand Up @@ -250,7 +252,7 @@ public function userRemovesProductVariantFromTheWishlist(ProductVariantInterface
$response = $this->client->request(
self::DELETE,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::DELETE)
$this->getOptions(self::DELETE),
);

Assert::eq($response->getStatusCode(), 204);
Expand Down Expand Up @@ -340,7 +342,7 @@ private function addProductToTheWishlist(WishlistInterface $wishlist, ProductInt
return $this->client->request(
self::PATCH,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::PATCH, $body)
$this->getOptions(self::PATCH, $body),
);
}

Expand All @@ -357,7 +359,7 @@ private function addProductVariantToTheWishlist(WishlistInterface $wishlist, Pro
return $this->client->request(
self::PATCH,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::PATCH, $body)
$this->getOptions(self::PATCH, $body),
);
}

Expand All @@ -374,7 +376,7 @@ private function removeProductFromTheWishlist(WishlistInterface $wishlist, Produ
return $this->client->request(
self::DELETE,
sprintf('%s%s', self::$domain, $uri),
$this->getOptions(self::DELETE)
$this->getOptions(self::DELETE),
);
}
}
2 changes: 1 addition & 1 deletion tests/Behat/Context/Setup/WishlistContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
FactoryInterface $productTaxonFactory,
EntityManagerInterface $productTaxonManager,
CookieSetterInterface $cookieSetter,
string $wishlistCookieToken
string $wishlistCookieToken,
) {
$this->productRepository = $productRepository;
$this->wishlistContext = $wishlistContext;
Expand Down
Loading

0 comments on commit 3bcbc0a

Please sign in to comment.