Skip to content

Commit 0485134

Browse files
author
Julien
committed
Symfony 6 support & lock sylius min version to 1.14
1 parent a220434 commit 0485134

11 files changed

+44
-116
lines changed

composer.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
],
3030
"license": "MIT",
3131
"require": {
32-
"php": "^7.4 || ^8.0",
32+
"php": "^8.0",
3333
"ext-json": "*",
34-
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0 || ~1.11.0 || ~1.12.0 || ~1.13.0 || ~1.14.0"
34+
"sylius/sylius": "~1.14.0"
3535
},
3636
"require-dev": {
3737
"behat/behat": "^3.6.1",
@@ -45,7 +45,6 @@
4545
"friends-of-behat/suite-settings-extension": "^1.0",
4646
"friends-of-behat/symfony-extension": "^2.1",
4747
"friends-of-behat/variadic-extension": "^1.3",
48-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
4948
"lakion/mink-debug-extension": "^2.0.0",
5049
"phpspec/phpspec": "^7.0",
5150
"phpstan/extension-installer": "^1.0",
@@ -55,13 +54,12 @@
5554
"phpstan/phpstan-webmozart-assert": "0.12.12",
5655
"phpunit/phpunit": "^9.5",
5756
"sensiolabs/security-checker": "^6.0",
58-
"sylius-labs/coding-standard": "^3.1",
59-
"symfony/browser-kit": "^4.4 || ^5.2 || ^5.4 || ^6.0",
60-
"symfony/debug-bundle": "^4.4 || ^5.2 || ^5.4 || ^6.0",
61-
"symfony/dotenv": "^4.4 || ^5.2 || ^5.4 || ^6.0",
62-
"symfony/intl": "^4.4 || ^5.2 || ^5.4 || ^6.0",
63-
"symfony/web-profiler-bundle": "^4.4 || ^5.2 || ^5.4 || ^6.0",
64-
"vimeo/psalm": "4.4.1"
57+
"sylius-labs/coding-standard": "*",
58+
"symfony/browser-kit": "^6.0",
59+
"symfony/debug-bundle": "^6.0",
60+
"symfony/dotenv": "^6.0",
61+
"symfony/intl": "^6.0",
62+
"symfony/web-profiler-bundle": "^6.0"
6563
},
6664
"config": {
6765
"sort-packages": true,

src/Controller/Admin/UpdateColissimoParameterAction.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,23 @@
1010
use Doctrine\ORM\EntityManagerInterface;
1111
use Symfony\Component\Form\FormFactoryInterface;
1212
use Symfony\Component\HttpFoundation\Request;
13+
use Symfony\Component\HttpFoundation\RequestStack;
1314
use Symfony\Component\HttpFoundation\Response;
14-
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
1515
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1616
use Symfony\Contracts\Translation\TranslatorInterface;
1717
use Twig\Environment;
1818

1919
final class UpdateColissimoParameterAction implements ActionInterface
2020
{
21-
private EntityManagerInterface $manager;
22-
private Environment $templatingEngine;
23-
private ColissimoParameterRepositoryInterface $colissimoParameterRepository;
24-
private FormFactoryInterface $formFactory;
25-
private EventDispatcherInterface $dispatcher;
26-
private FlashBagInterface $flashBag;
27-
private TranslatorInterface $translator;
28-
2921
public function __construct(
30-
Environment $templatingEngine,
31-
EntityManagerInterface $manager,
32-
ColissimoParameterRepositoryInterface $colissimoParameterRepository,
33-
FormFactoryInterface $formFactory,
34-
EventDispatcherInterface $dispatcher,
35-
FlashBagInterface $flashBag,
36-
TranslatorInterface $translator
22+
private EntityManagerInterface $manager,
23+
private Environment $templatingEngine,
24+
private ColissimoParameterRepositoryInterface $colissimoParameterRepository,
25+
private FormFactoryInterface $formFactory,
26+
private EventDispatcherInterface $dispatcher,
27+
private RequestStack $requestStack,
28+
private TranslatorInterface $translator,
3729
) {
38-
$this->templatingEngine = $templatingEngine;
39-
$this->manager = $manager;
40-
$this->colissimoParameterRepository = $colissimoParameterRepository;
41-
$this->formFactory = $formFactory;
42-
$this->dispatcher = $dispatcher;
43-
$this->flashBag = $flashBag;
44-
$this->translator = $translator;
4530
}
4631

4732
public function __invoke(Request $request): Response
@@ -60,7 +45,7 @@ public function __invoke(Request $request): Response
6045
if ($form->isSubmitted() && $form->isValid()) {
6146
$this->dispatcher->dispatch(new ColissimoParameterCredentialsHasherEvent($colissimoParameter));
6247

63-
$this->flashBag->add(
48+
$this->requestStack->getMainRequest()->getSession()->getFlashBag()->add(
6449
'success',
6550
$this->translator->trans('clever_age.admin.ui.colissimo_parameter.success'),
6651
);

src/Controller/Shop/PickupPointSearchByIdAction.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@
1111

1212
final class PickupPointSearchByIdAction implements ActionInterface
1313
{
14-
private SearchPickupPointService $searchPickupPointService;
15-
1614
public function __construct(
17-
SearchPickupPointService $searchPickupPointService
15+
private SearchPickupPointService $searchPickupPointService
1816
) {
19-
$this->searchPickupPointService = $searchPickupPointService;
2017
}
2118

2219
public function __invoke(Request $request): Response

src/Controller/Shop/PickupPointsSearchByCartAddressAction.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313

1414
final class PickupPointsSearchByCartAddressAction implements ActionInterface
1515
{
16-
private CartContextInterface $cartContext;
17-
private SearchPickupPointService $searchPickupPointService;
18-
1916
public function __construct(
20-
CartContextInterface $cartContext,
21-
SearchPickupPointService $searchPickupPointService
17+
private CartContextInterface $cartContext,
18+
private SearchPickupPointService $searchPickupPointService,
2219
) {
23-
$this->cartContext = $cartContext;
24-
$this->searchPickupPointService = $searchPickupPointService;
2520
}
2621

2722
public function __invoke(Request $request): Response

src/Controller/Shop/RemovePickupPointIdToOrderAction.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313

1414
final class RemovePickupPointIdToOrderAction implements ActionInterface
1515
{
16-
private CartContextInterface $cartContext;
17-
private EntityManagerInterface $entityManager;
18-
1916
public function __construct(
20-
CartContextInterface $cartContext,
21-
EntityManagerInterface $entityManager
17+
private CartContextInterface $cartContext,
18+
private EntityManagerInterface $entityManager
2219
) {
23-
$this->cartContext = $cartContext;
24-
$this->entityManager = $entityManager;
2520
}
2621

2722
public function __invoke(Request $request): Response

src/Controller/Shop/SetPickupPointIdToOrderAction.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,12 @@
1616

1717
final class SetPickupPointIdToOrderAction implements ActionInterface
1818
{
19-
private CartContextInterface $cartContext;
20-
private EntityManagerInterface $entityManager;
21-
private PickupPointByIdService $pickupPointByIdService;
2219

2320
public function __construct(
24-
CartContextInterface $cartContext,
25-
EntityManagerInterface $entityManager,
26-
PickupPointByIdService $pickupPointByIdService
21+
private CartContextInterface $cartContext,
22+
private EntityManagerInterface $entityManager,
23+
private PickupPointByIdService $pickupPointByIdService
2724
) {
28-
$this->cartContext = $cartContext;
29-
$this->entityManager = $entityManager;
30-
$this->pickupPointByIdService = $pickupPointByIdService;
3125
}
3226

3327
public function __invoke(Request $request): Response

src/EventSubscriber/ColissimoParameterCredentialsHasherSubscriber.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@
1111

1212
final class ColissimoParameterCredentialsHasherSubscriber implements EventSubscriberInterface
1313
{
14-
private string $encryptionKey;
15-
private HasherInterface $hasher;
16-
private EntityManagerInterface $entityManager;
17-
1814
public function __construct(
19-
string $encryptionKey,
20-
HasherInterface $hasher,
21-
EntityManagerInterface $entityManager
15+
private string $encryptionKey,
16+
private HasherInterface $hasher,
17+
private EntityManagerInterface $entityManager
2218
) {
23-
$this->encryptionKey = $encryptionKey;
24-
$this->hasher = $hasher;
25-
$this->entityManager = $entityManager;
2619
}
2720

2821
public static function getSubscribedEvents(): array

src/Form/Type/ColissimoParameterType.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616
final class ColissimoParameterType extends AbstractType
1717
{
18-
private string $encryptionKey;
19-
private HasherInterface $hasher;
20-
21-
public function __construct(string $encryptionKey, HasherInterface $hasher)
18+
public function __construct(
19+
private string $encryptionKey,
20+
private HasherInterface $hasher
21+
)
2222
{
23-
$this->encryptionKey = $encryptionKey;
24-
$this->hasher = $hasher;
2523
}
2624

2725
public function buildForm(FormBuilderInterface $builder, array $options): void

src/Service/AbstractService.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,14 @@
1111

1212
abstract class AbstractService
1313
{
14-
protected ClientFactory $colissimoClient;
15-
protected ColissimoParamsValidator $validator;
16-
protected SlsResponseParser $slsResponseParser;
17-
protected ColissimoParameterRepositoryInterface $colissimoParameterRepository;
18-
protected HasherInterface $hasher;
19-
protected string $encryptionKey;
20-
2114
public function __construct(
22-
ClientFactory $colissimoClient,
23-
ColissimoParamsValidator $validator,
24-
SlsResponseParser $slsResponseParser,
25-
ColissimoParameterRepositoryInterface $colissimoParameterRepository,
26-
HasherInterface $hasher,
27-
string $encryptionKey
15+
protected ClientFactory $colissimoClient,
16+
protected ColissimoParamsValidator $validator,
17+
protected SlsResponseParser $slsResponseParser,
18+
protected ColissimoParameterRepositoryInterface $colissimoParameterRepository,
19+
protected HasherInterface $hasher,
20+
protected string $encryptionKey
2821
) {
29-
$this->colissimoClient = $colissimoClient;
30-
$this->validator = $validator;
31-
$this->slsResponseParser = $slsResponseParser;
32-
$this->colissimoParameterRepository = $colissimoParameterRepository;
33-
$this->hasher = $hasher;
34-
$this->encryptionKey = $encryptionKey;
3522
}
3623

3724
protected function doCall(

src/Service/SearchPickupPointService.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,11 @@
1212

1313
final class SearchPickupPointService
1414
{
15-
private PickupPointByIdService $pickupPointByIdService;
16-
private PickupPointsService $pickupPointsService;
17-
private CartContextInterface $cartContext;
18-
1915
public function __construct(
20-
PickupPointByIdService $pickupPointByIdService,
21-
PickupPointsService $pickupPointsService,
22-
CartContextInterface $cartContext
16+
protected PickupPointByIdService $pickupPointByIdService,
17+
protected PickupPointsService $pickupPointsService,
18+
protected CartContextInterface $cartContext
2319
) {
24-
$this->pickupPointByIdService = $pickupPointByIdService;
25-
$this->pickupPointsService = $pickupPointsService;
26-
$this->cartContext = $cartContext;
2720
}
2821

2922
public function byId(string $pickupPointId, ?OrderInterface $order = null): ?PickupPoint

src/Twig/PickupPointsExtension.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@
1313

1414
final class PickupPointsExtension extends AbstractExtension
1515
{
16-
private CartContextInterface $cartContext;
17-
private SearchPickupPointService $searchPickupPointService;
18-
private TranslatorInterface $translator;
19-
2016
public function __construct(
21-
CartContextInterface $cartContext,
22-
SearchPickupPointService $searchPickupPointService,
23-
TranslatorInterface $translator
17+
private CartContextInterface $cartContext,
18+
private SearchPickupPointService $searchPickupPointService,
19+
private TranslatorInterface $translator
2420
) {
25-
$this->cartContext = $cartContext;
26-
$this->searchPickupPointService = $searchPickupPointService;
27-
$this->translator = $translator;
2821
}
2922

3023
public function getFunctions(): array

0 commit comments

Comments
 (0)