Skip to content

Commit

Permalink
ECS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometee committed May 18, 2024
1 parent e79a18b commit 66e2cb6
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 59 deletions.
6 changes: 3 additions & 3 deletions src/Controller/CustomerCreationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class CustomerCreationAction

public function __construct(
RouterInterface $router,
CustomerProviderInterface $customerProvider
CustomerProviderInterface $customerProvider,
) {
$this->router = $router;
$this->customerProvider = $customerProvider;
Expand All @@ -38,8 +38,8 @@ public function __invoke(Request $request): Response
[
'customerId' => $customer->getId(),
'channelCode' => $request->attributes->get('channelCode'),
]
)
],
),
);
}
}
2 changes: 1 addition & 1 deletion src/Controller/OrderCreateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class OrderCreateAction
public function __construct(
OrderFactoryInterface $orderFactory,
FormFactoryInterface $formFactory,
Environment $twig
Environment $twig,
) {
$this->orderFactory = $orderFactory;
$this->formFactory = $formFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/OrderPreviewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
OrderFactoryInterface $orderFactory,
FormFactoryInterface $formFactory,
OrderProcessorInterface $orderProcessor,
Environment $twig
Environment $twig,
) {
$this->orderFactory = $orderFactory;
$this->formFactory = $formFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ProvideAvailableShippingMethodsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class ProvideAvailableShippingMethodsAction

public function __construct(
OrderPreparatorInterface $orderPreparator,
AvailableShippingMethodsListProvider $availableShippingMethodsListProvider
AvailableShippingMethodsListProvider $availableShippingMethodsListProvider,
) {
$this->orderPreparator = $orderPreparator;
$this->availableShippingMethodsListProvider = $availableShippingMethodsListProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct()
'Sylius\AdminOrderCreationPlugin\ReorderProcessing\CompositeReorderProcessor',
'Sylius\AdminOrderCreationPlugin\ReorderProcessing\CompositeReorderProcessor',
'sylius_admin_order_creation.reorder_processor',
'addProcessor'
'addProcessor',
);
}
}
2 changes: 1 addition & 1 deletion src/EventListener/PaymentLinkCreationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class PaymentLinkCreationListener
public function __construct(
PaymentTokenProviderInterface $paymentTokenProvider,
ObjectManager $orderManager,
OrderPaymentLinkSenderInterface $orderPaymentLinkSender
OrderPaymentLinkSenderInterface $orderPaymentLinkSender,
) {
$this->paymentTokenProvider = $paymentTokenProvider;
$this->orderManager = $orderManager;
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/OrderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(
FactoryInterface $baseOrderFactory,
CustomerRepositoryInterface $customerRepository,
ChannelRepositoryInterface $channelRepository,
ReorderProcessor $reorderProcessor
ReorderProcessor $reorderProcessor,
) {
$this->baseOrderFactory = $baseOrderFactory;
$this->customerRepository = $customerRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/CurrencyCodeChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(RepositoryInterface $currencyRepository)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addModelTransformer(
new ReversedTransformer(new ResourceToIdentifierTransformer($this->currencyRepository, 'code'))
new ReversedTransformer(new ResourceToIdentifierTransformer($this->currencyRepository, 'code')),
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Form/Type/CustomerAutocompleteChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function configureOptions(OptionsResolver $resolver): void
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function buildView(FormView $view, FormInterface $form, array $options): void
{
Expand All @@ -32,15 +32,15 @@ public function buildView(FormView $view, FormInterface $form, array $options):
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBlockPrefix(): string
{
return 'sylius_customer_autocomplete_choice';
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getParent(): string
{
Expand Down
6 changes: 3 additions & 3 deletions src/Form/Type/LocaleCodeChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public function __construct(RepositoryInterface $localeRepository)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addModelTransformer(new ReversedTransformer(new ResourceToIdentifierTransformer($this->localeRepository, 'code')));
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getParent(): string
{
return LocaleChoiceType::class;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBlockPrefix(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/OrderItemType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class OrderItemType extends AbstractResourceType
public function __construct(
string $dataClass,
DataMapperInterface $dataMapper,
array $validationGroups = []
array $validationGroups = [],
) {
parent::__construct($dataClass, $validationGroups);

Expand Down Expand Up @@ -82,7 +82,7 @@ public function configureOptions(OptionsResolver $resolver): void
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBlockPrefix(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/PaymentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBlockPrefix(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/ShipmentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBlockPrefix(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Preparator/NewOrderPreparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class NewOrderPreparator implements OrderPreparatorInterface
public function __construct(
OrderFactoryInterface $orderFactory,
FormFactoryInterface $formFactory,
OrderProcessorInterface $orderProcessor
OrderProcessorInterface $orderProcessor,
) {
$this->orderFactory = $orderFactory;
$this->formFactory = $formFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/CustomerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class CustomerProvider implements CustomerProviderInterface

public function __construct(
CustomerRepositoryInterface $customerRepository,
FactoryInterface $customerFactory
FactoryInterface $customerFactory,
) {
$this->customerRepository = $customerRepository;
$this->customerFactory = $customerFactory;
Expand Down
4 changes: 2 additions & 2 deletions src/Provider/PaymentTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public function getPaymentToken(PaymentInterface $payment): TokenInterface
return $tokenFactory->createAuthorizeToken(
$gatewayConfig->getGatewayName(),
$payment,
$this->afterPayRoute
$this->afterPayRoute,
);
}

return $tokenFactory->createCaptureToken(
$gatewayConfig->getGatewayName(),
$payment,
$this->afterPayRoute
$this->afterPayRoute,
);
}
}
2 changes: 1 addition & 1 deletion src/ReorderProcessing/CompositeReorderProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Sylius\AdminOrderCreationPlugin\ReorderProcessing;

use Sylius\Component\Core\Model\OrderInterface;
use Laminas\Stdlib\PriorityQueue;
use Sylius\Component\Core\Model\OrderInterface;

final class CompositeReorderProcessor implements ReorderProcessor
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReorderProcessing/ReorderItemsProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ReorderItemsProcessor implements ReorderProcessor
public function __construct(
FactoryInterface $orderItemFactory,
OrderItemQuantityModifierInterface $orderItemQuantityModifier,
OrderModifierInterface $orderModifier
OrderModifierInterface $orderModifier,
) {
$this->orderItemFactory = $orderItemFactory;
$this->orderItemQuantityModifier = $orderItemQuantityModifier;
Expand Down
2 changes: 1 addition & 1 deletion src/Sender/OrderPaymentLinkSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function sendPaymentLink(OrderInterface $order): void
[
'order' => $order,
'paymentLink' => $paymentDetails['payment-link'],
]
],
)
;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ private function registerBundlesFromFile(string $bundlesFile): iterable
if (SyliusCoreBundle::MINOR_VERSION > 10) {
$contents = array_merge(
['Sylius\Calendar\SyliusCalendarBundle' => ['all' => true]],
$contents
$contents,
);
}

if (SyliusCoreBundle::MINOR_VERSION > 12) {
$contents = array_merge(
['Sylius\Abstraction\StateMachine\SyliusStateMachineAbstractionBundle' => ['all' => true]],
$contents
$contents,
);
}

Expand All @@ -131,9 +131,9 @@ private function getBundleListFiles(): array
static function (string $directory): string {
return $directory . '/bundles.php';
},
$this->getConfigurationDirectories()
$this->getConfigurationDirectories(),
),
'file_exists'
'file_exists',
);
}

Expand Down
10 changes: 6 additions & 4 deletions tests/Application/config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<?php

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'../../../vendor/autoload.php';
require dirname(__DIR__) . '../../../vendor/autoload.php';

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) {
$_SERVER += $env;
$_ENV += $env;
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
2 changes: 2 additions & 0 deletions tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Sylius\Bundle\CoreBundle\Application\Kernel;

$bundles = [
Expand Down
20 changes: 11 additions & 9 deletions tests/Behat/Context/Admin/ManagingOrdersContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function removeProductFromThisOrder(ProductInterface $product): void
{
/** @var ProductVariantInterface $productVariant */
$productVariant = $product->getVariants()->first();

try {
$this->orderCreateFormElement->removeProduct($productVariant->getDescriptor());
} catch (\InvalidArgumentException $exception) {
Expand Down Expand Up @@ -210,7 +211,7 @@ public function lowerItemWithProductPriceBy(ProductInterface $product, string $d
$productCode = $product->getCode();
$this->orderPreviewPage->lowerItemWithProductPriceBy(
$productCode,
str_replace(['$', '', '£'], '', $discount)
str_replace(['$', '', '£'], '', $discount),
);
}

Expand All @@ -221,6 +222,7 @@ public function iChangeQuantityOfItemTo(ProductInterface $product, int $quantity
{
/** @var ProductVariantInterface $productVariant */
$productVariant = $product->getVariants()->first();

try {
$this->orderCreateFormElement->specifyQuantity($productVariant->getDescriptor(), $quantity);
} catch (\InvalidArgumentException $exception) {
Expand Down Expand Up @@ -297,7 +299,7 @@ public function shouldBeNotifiedAboutShippingMethodsSelectionRequirements(): voi
{
Assert::same(
$this->orderCreateFormElement->getShippingMethodsValidationMessage(),
'You need to add some items and shipping address to select from eligible shipping method'
'You need to add some items and shipping address to select from eligible shipping method',
);
}

Expand All @@ -308,7 +310,7 @@ public function shouldBeNotifiedThatOrderHasBeenSuccessfullyCreated(): void
{
$this->notificationChecker->checkNotification(
'Order has been successfully created',
NotificationType::success()
NotificationType::success(),
);
}

Expand All @@ -328,7 +330,7 @@ public function shouldBeNotifiedThatItemWithProductDiscountCannotBeBelow0(Produc
/** @var string $productCode */
$productCode = $product->getCode();
Assert::true(
$this->orderPreviewPage->hasItemDiscountValidationMessage($productCode, 'Discount cannot be below 0')
$this->orderPreviewPage->hasItemDiscountValidationMessage($productCode, 'Discount cannot be below 0'),
);
}

Expand Down Expand Up @@ -363,7 +365,7 @@ public function thereShouldBePaymentLinkSentTo(string $email): void
{
Assert::true($this->emailChecker->hasMessageTo(
'New order has been created for you in Admin panel. Check it out in your orders history. To pay for this order, click',
$email
$email,
));
}

Expand All @@ -387,7 +389,7 @@ public function thereShouldBeOneOrderForInTheRegistry(string $channelName, Custo
'state' => 'New',
'paymentState' => 'Awaiting payment',
'shippingState' => 'Ready',
'channel' => $channelName
'channel' => $channelName,
]));
}

Expand All @@ -405,7 +407,7 @@ public function thereShouldBeOneOrdersForInTheRegistry(int $amountOfOrders, Cust
'state' => 'New',
'paymentState' => 'Awaiting payment',
'shippingState' => 'Ready',
])
]),
);
}

Expand All @@ -417,7 +419,7 @@ public function thisOrderShippingAddressShouldBe(
string $street,
string $postcode,
string $city,
string $countryName
string $countryName,
): void {
Assert::true($this->orderShowPage->hasShippingAddress($customerName, $street, $postcode, $city, $countryName));
}
Expand All @@ -430,7 +432,7 @@ public function thisOrderBillingAddressShouldBe(
string $street,
string $postcode,
string $city,
string $countryName
string $countryName,
): void {
Assert::true($this->orderShowPage->hasBillingAddress($customerName, $street, $postcode, $city, $countryName));
}
Expand Down
Loading

0 comments on commit 66e2cb6

Please sign in to comment.