Skip to content

Commit 6732c8b

Browse files
committed
Add constructor property promotion and change service definitions to xml for behat services
1 parent 14a5d5a commit 6732c8b

64 files changed

Lines changed: 473 additions & 943 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Controller/Action/Admin/ImportDataAction.php

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,14 @@
2626

2727
final class ImportDataAction
2828
{
29-
/** @var ImportProcessorInterface */
30-
private $importProcessor;
31-
32-
/** @var FormFactoryInterface */
33-
private $formFactory;
34-
35-
/** @var RequestStack */
36-
private $requestStack;
37-
38-
/** @var FormErrorsFlashHelperInterface */
39-
private $formErrorsFlashHelper;
40-
41-
/** @var TranslatorInterface */
42-
private $translator;
43-
44-
/** @var Environment */
45-
private $twig;
46-
4729
public function __construct(
48-
ImportProcessorInterface $importProcessor,
49-
FormFactoryInterface $formFactory,
50-
RequestStack $requestStack,
51-
FormErrorsFlashHelperInterface $formErrorsFlashHelper,
52-
TranslatorInterface $translator,
53-
Environment $twig,
30+
private ImportProcessorInterface $importProcessor,
31+
private FormFactoryInterface $formFactory,
32+
private RequestStack $requestStack,
33+
private FormErrorsFlashHelperInterface $formErrorsFlashHelper,
34+
private TranslatorInterface $translator,
35+
private Environment $twig,
5436
) {
55-
$this->importProcessor = $importProcessor;
56-
$this->formFactory = $formFactory;
57-
$this->requestStack = $requestStack;
58-
$this->formErrorsFlashHelper = $formErrorsFlashHelper;
59-
$this->translator = $translator;
60-
$this->twig = $twig;
6137
}
6238

6339
public function __invoke(Request $request): Response

src/Controller/Action/Admin/ProductSearchAction.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,11 @@
1919

2020
final class ProductSearchAction
2121
{
22-
/** @var ProductRepositoryInterface */
23-
private $productRepository;
24-
25-
/** @var LocaleContextInterface */
26-
private $localeContext;
27-
28-
/** @var ViewHandler */
29-
private $viewHandler;
30-
3122
public function __construct(
32-
ProductRepositoryInterface $productRepository,
33-
LocaleContextInterface $localeContext,
34-
ViewHandler $viewHandler,
23+
private ProductRepositoryInterface $productRepository,
24+
private LocaleContextInterface $localeContext,
25+
private ViewHandler $viewHandler,
3526
) {
36-
$this->productRepository = $productRepository;
37-
$this->localeContext = $localeContext;
38-
$this->viewHandler = $viewHandler;
3927
}
4028

4129
public function __invoke(Request $request): Response

src/Controller/Action/Admin/TaxonSearchAction.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,11 @@
1919

2020
final class TaxonSearchAction
2121
{
22-
/** @var TaxonRepositoryInterface */
23-
private $taxonRepository;
24-
25-
/** @var LocaleContextInterface */
26-
private $localeContext;
27-
28-
/** @var ViewHandler */
29-
private $viewHandler;
30-
3122
public function __construct(
32-
TaxonRepositoryInterface $taxonRepository,
33-
LocaleContextInterface $localeContext,
34-
ViewHandler $viewHandler,
23+
private TaxonRepositoryInterface $taxonRepository,
24+
private LocaleContextInterface $localeContext,
25+
private ViewHandler $viewHandler,
3526
) {
36-
$this->taxonRepository = $taxonRepository;
37-
$this->localeContext = $localeContext;
38-
$this->viewHandler = $viewHandler;
3927
}
4028

4129
public function __invoke(Request $request): Response

src/Controller/Action/Admin/UploadEditorImageAction.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,11 @@
2323

2424
final class UploadEditorImageAction
2525
{
26-
/** @var MediaProviderResolverInterface */
27-
private $mediaProviderResolver;
28-
29-
/** @var MediaRepositoryInterface */
30-
private $mediaRepository;
31-
32-
/** @var FactoryInterface */
33-
private $mediaFactory;
34-
3526
public function __construct(
36-
MediaProviderResolverInterface $mediaProviderResolver,
37-
MediaRepositoryInterface $mediaRepository,
38-
FactoryInterface $mediaFactory,
27+
private MediaProviderResolverInterface $mediaProviderResolver,
28+
private MediaRepositoryInterface $mediaRepository,
29+
private FactoryInterface $mediaFactory,
3930
) {
40-
$this->mediaProviderResolver = $mediaProviderResolver;
41-
$this->mediaRepository = $mediaRepository;
42-
$this->mediaFactory = $mediaFactory;
4331
}
4432

4533
public function __invoke(Request $request): Response

src/Controller/Helper/FormErrorsFlashHelper.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,10 @@
1717

1818
final class FormErrorsFlashHelper implements FormErrorsFlashHelperInterface
1919
{
20-
/** @var RequestStack */
21-
private $requestStack;
22-
23-
/** @var TranslatorInterface */
24-
private $translator;
25-
26-
public function __construct(RequestStack $requestStack, TranslatorInterface $translator)
27-
{
28-
$this->requestStack = $requestStack;
29-
$this->translator = $translator;
20+
public function __construct(
21+
private RequestStack $requestStack,
22+
private TranslatorInterface $translator
23+
) {
3024
}
3125

3226
public function addFlashErrors(FormInterface $form): void

src/Controller/PageSlugController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@
1717

1818
final class PageSlugController
1919
{
20-
/** @var SlugGeneratorInterface */
21-
private $slugGenerator;
22-
23-
public function __construct(SlugGeneratorInterface $slugGenerator)
20+
public function __construct(private SlugGeneratorInterface $slugGenerator)
2421
{
25-
$this->slugGenerator = $slugGenerator;
2622
}
2723

2824
public function generateAction(Request $request): JsonResponse

src/EventListener/ResourceDeleteSubscriber.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
final class ResourceDeleteSubscriber implements EventSubscriberInterface
2525
{
26-
public function __construct(private UrlGeneratorInterface $router, private RequestStack $requestStack)
27-
{
26+
public function __construct(
27+
private UrlGeneratorInterface $router,
28+
private RequestStack $requestStack
29+
) {
2830
}
2931

3032
public static function getSubscribedEvents(): array

src/Form/Type/WysiwygType.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@
1717

1818
final class WysiwygType extends AbstractType
1919
{
20-
/** @var UrlGeneratorInterface */
21-
private $urlGenerator;
22-
23-
public function __construct(UrlGeneratorInterface $urlGenerator)
20+
public function __construct(private UrlGeneratorInterface $urlGenerator)
2421
{
25-
$this->urlGenerator = $urlGenerator;
2622
}
2723

2824
public function configureOptions(OptionsResolver $resolver): void

tests/Behat/Context/Api/BlockContext.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,10 @@
1818

1919
final class BlockContext implements Context
2020
{
21-
private ApiClientInterface $apiClient;
22-
23-
private ResponseCheckerInterface $responseChecker;
24-
2521
public function __construct(
26-
ApiClientInterface $apiClient,
27-
ResponseCheckerInterface $responseChecker,
22+
private ApiClientInterface $apiClient,
23+
private ResponseCheckerInterface $responseChecker
2824
) {
29-
$this->apiClient = $apiClient;
30-
$this->responseChecker = $responseChecker;
3125
}
3226

3327
/**

tests/Behat/Context/Api/FrequentlyAskedQuestionContext.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@
1919

2020
final class FrequentlyAskedQuestionContext implements Context
2121
{
22-
private ApiClientInterface $apiClient;
23-
24-
private ResponseCheckerInterface $responseChecker;
25-
2622
public function __construct(
27-
ApiClientInterface $apiClient,
28-
ResponseCheckerInterface $responseChecker,
23+
private ApiClientInterface $apiClient,
24+
private ResponseCheckerInterface $responseChecker,
2925
) {
30-
$this->apiClient = $apiClient;
31-
$this->responseChecker = $responseChecker;
3226
}
3327

3428
/**

0 commit comments

Comments
 (0)