From 27d2c2f5f58b951ae35727137a0b5292d5914d0a Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Mon, 23 Oct 2023 16:13:26 +0300 Subject: [PATCH] property promotion --- src/App/src/Controller/LanguageController.php | 17 ++----- src/App/src/Middleware/AuthMiddleware.php | 17 ++----- .../src/Middleware/RememberMeMiddleware.php | 17 ++----- .../src/Middleware/TranslatorMiddleware.php | 13 ++---- .../src/Resolver/EntityListenerResolver.php | 5 +- src/App/src/Service/TranslateService.php | 9 +--- .../src/Controller/ContactController.php | 39 ++++------------ src/Contact/src/Service/MessageService.php | 21 ++------- src/Page/src/Controller/PageController.php | 13 ++---- src/Plugin/src/FormsPlugin.php | 9 +--- src/Plugin/src/TemplatePlugin.php | 11 +---- .../src/Adapter/AuthenticationAdapter.php | 8 +--- src/User/src/Controller/AccountController.php | 30 +++--------- src/User/src/Controller/UserController.php | 46 ++++--------------- .../EventListener/UserAvatarEventListener.php | 6 +-- src/User/src/Fieldset/AvatarFieldset.php | 6 +-- src/User/src/Fieldset/UserDetailFieldset.php | 6 +-- src/User/src/Form/LoginForm.php | 6 +-- src/User/src/Form/ProfileDeleteForm.php | 6 +-- src/User/src/Form/ProfileDetailsForm.php | 6 +-- src/User/src/Form/ProfilePasswordForm.php | 6 +-- src/User/src/Form/RegisterForm.php | 6 +-- .../src/Form/RequestResetPasswordForm.php | 6 +-- src/User/src/Form/ResetPasswordForm.php | 6 +-- src/User/src/Form/UploadAvatarForm.php | 6 +-- src/User/src/Service/UserRoleService.php | 5 +- src/User/src/Service/UserService.php | 36 +++------------ 27 files changed, 72 insertions(+), 290 deletions(-) diff --git a/src/App/src/Controller/LanguageController.php b/src/App/src/Controller/LanguageController.php index 04c8cf7b..cbc05f23 100644 --- a/src/App/src/Controller/LanguageController.php +++ b/src/App/src/Controller/LanguageController.php @@ -18,11 +18,6 @@ class LanguageController extends AbstractActionController { - protected TranslateServiceInterface $translateService; - protected RouterInterface $router; - protected TemplateRendererInterface $template; - protected array $translatorConfig = []; - /** * @Inject({ * TranslateServiceInterface::class, @@ -32,15 +27,11 @@ class LanguageController extends AbstractActionController * }) */ public function __construct( - TranslateServiceInterface $translateService, - RouterInterface $router, - TemplateRendererInterface $template, - array $translatorConfig + protected TranslateServiceInterface $translateService, + protected RouterInterface $router, + protected TemplateRendererInterface $template, + protected array $translatorConfig ) { - $this->translateService = $translateService; - $this->router = $router; - $this->template = $template; - $this->translatorConfig = $translatorConfig; } public function changeAction(): ResponseInterface diff --git a/src/App/src/Middleware/AuthMiddleware.php b/src/App/src/Middleware/AuthMiddleware.php index 9bd323a8..a59f0b35 100644 --- a/src/App/src/Middleware/AuthMiddleware.php +++ b/src/App/src/Middleware/AuthMiddleware.php @@ -18,21 +18,12 @@ class AuthMiddleware implements MiddlewareInterface { - protected RouterInterface $router; - protected FlashMessengerInterface $messenger; - protected GuardsProviderInterface $guardProvider; - protected RbacGuardOptions $options; - public function __construct( - RouterInterface $router, - FlashMessengerInterface $messenger, - GuardsProviderInterface $guardProvider, - RbacGuardOptions $options + protected RouterInterface $router, + protected FlashMessengerInterface $messenger, + protected GuardsProviderInterface $guardProvider, + protected RbacGuardOptions $options ) { - $this->router = $router; - $this->messenger = $messenger; - $this->guardProvider = $guardProvider; - $this->options = $options; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface diff --git a/src/App/src/Middleware/RememberMeMiddleware.php b/src/App/src/Middleware/RememberMeMiddleware.php index 38bec0c4..4def7135 100644 --- a/src/App/src/Middleware/RememberMeMiddleware.php +++ b/src/App/src/Middleware/RememberMeMiddleware.php @@ -10,9 +10,7 @@ use Dot\AnnotatedServices\Annotation\Service; use Frontend\User\Entity\UserIdentity; use Frontend\User\Entity\UserRole; -use Frontend\User\Repository\UserRepository; use Frontend\User\Service\UserServiceInterface; -use Laminas\Authentication\AuthenticationService; use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\Authentication\Exception\ExceptionInterface; use Psr\Http\Message\ResponseInterface; @@ -25,12 +23,6 @@ */ class RememberMeMiddleware implements MiddlewareInterface { - protected UserServiceInterface $userService; - protected AuthenticationServiceInterface $authenticationService; - - protected UserRepository $repository; - protected array $rememberConfig = []; - /** * @Inject({ * UserServiceInterface::class, @@ -39,13 +31,10 @@ class RememberMeMiddleware implements MiddlewareInterface * }) */ public function __construct( - UserServiceInterface $userService, - AuthenticationServiceInterface $authenticationService, - array $rememberConfig + protected UserServiceInterface $userService, + protected AuthenticationServiceInterface $authenticationService, + protected array $rememberConfig ) { - $this->userService = $userService; - $this->authenticationService = $authenticationService; - $this->rememberConfig = $rememberConfig; } /** diff --git a/src/App/src/Middleware/TranslatorMiddleware.php b/src/App/src/Middleware/TranslatorMiddleware.php index 6ed14424..6adc9d41 100644 --- a/src/App/src/Middleware/TranslatorMiddleware.php +++ b/src/App/src/Middleware/TranslatorMiddleware.php @@ -28,10 +28,6 @@ */ class TranslatorMiddleware implements MiddlewareInterface { - protected TranslateServiceInterface $translateService; - protected TemplateRendererInterface $template; - protected array $translatorConfig = []; - /** * @Inject({ * TranslateServiceInterface::class, @@ -40,13 +36,10 @@ class TranslatorMiddleware implements MiddlewareInterface * }) */ public function __construct( - TranslateServiceInterface $translateService, - TemplateRendererInterface $template, - array $translatorConfig + protected TranslateServiceInterface $translateService, + protected TemplateRendererInterface $template, + protected array $translatorConfig ) { - $this->translateService = $translateService; - $this->template = $template; - $this->translatorConfig = $translatorConfig; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface diff --git a/src/App/src/Resolver/EntityListenerResolver.php b/src/App/src/Resolver/EntityListenerResolver.php index 40135aaf..91583823 100644 --- a/src/App/src/Resolver/EntityListenerResolver.php +++ b/src/App/src/Resolver/EntityListenerResolver.php @@ -11,11 +11,8 @@ class EntityListenerResolver extends DefaultEntityListenerResolver { - protected ContainerInterface $container; - - public function __construct(ContainerInterface $container) + public function __construct(protected ContainerInterface $container) { - $this->container = $container; } /** diff --git a/src/App/src/Service/TranslateService.php b/src/App/src/Service/TranslateService.php index 0d0ddf0d..81a19ef7 100644 --- a/src/App/src/Service/TranslateService.php +++ b/src/App/src/Service/TranslateService.php @@ -10,9 +10,6 @@ class TranslateService implements TranslateServiceInterface { - protected CookieServiceInterface $cookieService; - protected array $config = []; - /** * @Inject({ * CookieServiceInterface::class, @@ -20,11 +17,9 @@ class TranslateService implements TranslateServiceInterface * }) */ public function __construct( - CookieServiceInterface $cookieService, - array $config = [] + protected CookieServiceInterface $cookieService, + protected array $config = [] ) { - $this->cookieService = $cookieService; - $this->config = $config; } public function addTranslatorCookie(string $languageKey): void diff --git a/src/Contact/src/Controller/ContactController.php b/src/Contact/src/Controller/ContactController.php index d7a2d914..b85dcfa4 100644 --- a/src/Contact/src/Controller/ContactController.php +++ b/src/Contact/src/Controller/ContactController.php @@ -14,7 +14,6 @@ use Frontend\Contact\Service\MessageServiceInterface; use Frontend\Plugin\FormsPlugin; use Laminas\Authentication\AuthenticationService; -use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\Diactoros\Response\HtmlResponse; use Laminas\Diactoros\Response\RedirectResponse; use Mezzio\Router\RouterInterface; @@ -23,18 +22,7 @@ class ContactController extends AbstractActionController { - protected RouterInterface $router; - protected TemplateRendererInterface $template; - protected MessageServiceInterface $messageService; - protected RecaptchaService $recaptchaService; - protected AuthenticationServiceInterface $authenticationService; - protected FlashMessenger $messenger; - protected FormsPlugin $forms; - protected DebugBar $debugBar; - protected array $config; - /** - * @param array $config * @Inject({ * MessageServiceInterface::class, * RecaptchaService::class, @@ -48,25 +36,16 @@ class ContactController extends AbstractActionController * }) */ public function __construct( - MessageServiceInterface $messageService, - RecaptchaService $recaptchaService, - RouterInterface $router, - TemplateRendererInterface $template, - AuthenticationService $authenticationService, - FlashMessenger $messenger, - FormsPlugin $forms, - DebugBar $debugBar, - array $config = [] + protected MessageServiceInterface $messageService, + protected RecaptchaService $recaptchaService, + protected RouterInterface $router, + protected TemplateRendererInterface $template, + protected AuthenticationService $authenticationService, + protected FlashMessenger $messenger, + protected FormsPlugin $forms, + protected DebugBar $debugBar, + protected array $config = [] ) { - $this->messageService = $messageService; - $this->recaptchaService = $recaptchaService; - $this->router = $router; - $this->template = $template; - $this->authenticationService = $authenticationService; - $this->messenger = $messenger; - $this->forms = $forms; - $this->debugBar = $debugBar; - $this->config = $config; } public function formAction(): ResponseInterface diff --git a/src/Contact/src/Service/MessageService.php b/src/Contact/src/Service/MessageService.php index f55b5c78..f875e092 100644 --- a/src/Contact/src/Service/MessageService.php +++ b/src/Contact/src/Service/MessageService.php @@ -14,16 +14,7 @@ class MessageService implements MessageServiceInterface { - protected MessageRepository|EntityRepository $repository; - - protected MailServiceInterface $mailService; - - protected TemplateRendererInterface $templateRenderer; - - protected array $config = []; - /** - * @param array $config * @Inject({ * MessageRepository::class, * MailServiceInterface::class, @@ -32,15 +23,11 @@ class MessageService implements MessageServiceInterface * }) */ public function __construct( - MessageRepository $repository, - MailServiceInterface $mailService, - TemplateRendererInterface $templateRenderer, - array $config = [] + protected MessageRepository $repository, + protected MailServiceInterface $mailService, + protected TemplateRendererInterface $templateRenderer, + protected array $config = [] ) { - $this->repository = $repository; - $this->mailService = $mailService; - $this->templateRenderer = $templateRenderer; - $this->config = $config; } public function getRepository(): MessageRepository|EntityRepository diff --git a/src/Page/src/Controller/PageController.php b/src/Page/src/Controller/PageController.php index 60862631..f956fc6d 100644 --- a/src/Page/src/Controller/PageController.php +++ b/src/Page/src/Controller/PageController.php @@ -14,10 +14,6 @@ class PageController extends AbstractActionController { - protected RouterInterface $router; - protected PageServiceInterface $pageService; - protected TemplateRendererInterface $template; - /** * @Inject({ * PageServiceInterface::class, @@ -26,13 +22,10 @@ class PageController extends AbstractActionController * }) */ public function __construct( - PageServiceInterface $pageService, - RouterInterface $router, - TemplateRendererInterface $template + protected PageServiceInterface $pageService, + protected RouterInterface $router, + protected TemplateRendererInterface $template ) { - $this->pageService = $pageService; - $this->router = $router; - $this->template = $template; } public function indexAction(): ResponseInterface diff --git a/src/Plugin/src/FormsPlugin.php b/src/Plugin/src/FormsPlugin.php index 58a9962b..fb7bd810 100644 --- a/src/Plugin/src/FormsPlugin.php +++ b/src/Plugin/src/FormsPlugin.php @@ -15,15 +15,10 @@ class FormsPlugin implements PluginInterface { - protected FormElementManager $formElementManager; - protected ?FlashMessengerInterface $flashMessenger; - public function __construct( - FormElementManager $formManager, - ?FlashMessengerInterface $flashMessenger = null + protected FormElementManager $formManager, + protected ?FlashMessengerInterface $flashMessenger = null ) { - $this->formElementManager = $formManager; - $this->flashMessenger = $flashMessenger; } public function restoreState(Form $form): void diff --git a/src/Plugin/src/TemplatePlugin.php b/src/Plugin/src/TemplatePlugin.php index 0dcf8487..d0e4b60d 100644 --- a/src/Plugin/src/TemplatePlugin.php +++ b/src/Plugin/src/TemplatePlugin.php @@ -10,16 +10,10 @@ class TemplatePlugin implements PluginInterface { - protected TemplateRendererInterface $template; - - public function __construct(TemplateRendererInterface $template) + public function __construct(protected TemplateRendererInterface $template) { - $this->template = $template; } - /** - * @param array $params - */ public function __invoke(?string $templateName = null, array $params = []): TemplatePlugin|string { $args = func_get_args(); @@ -30,9 +24,6 @@ public function __invoke(?string $templateName = null, array $params = []): Temp return $this->render($templateName, $params); } - /** - * @param array $params - */ public function render(string $templateName, array $params = []): string { return $this->template->render($templateName, $params); diff --git a/src/User/src/Adapter/AuthenticationAdapter.php b/src/User/src/Adapter/AuthenticationAdapter.php index c4108353..5a2b78e5 100644 --- a/src/User/src/Adapter/AuthenticationAdapter.php +++ b/src/User/src/Adapter/AuthenticationAdapter.php @@ -19,14 +19,8 @@ class AuthenticationAdapter extends AbstractAdapter implements AdapterInterface { - private EntityRepository $entityRepository; - - private array $config; - - public function __construct(EntityRepository $entityRepository, array $config) + public function __construct(private EntityRepository $entityRepository, private array $config) { - $this->entityRepository = $entityRepository; - $this->config = $config; } public function authenticate(): Result diff --git a/src/User/src/Controller/AccountController.php b/src/User/src/Controller/AccountController.php index ac9109d2..48aacb1d 100644 --- a/src/User/src/Controller/AccountController.php +++ b/src/User/src/Controller/AccountController.php @@ -24,7 +24,6 @@ use Frontend\User\Form\UploadAvatarForm; use Frontend\User\Service\UserServiceInterface; use Laminas\Authentication\AuthenticationService; -use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\Diactoros\Response\HtmlResponse; use Laminas\Diactoros\Response\RedirectResponse; use Mezzio\Router\RouterInterface; @@ -35,14 +34,6 @@ class AccountController extends AbstractActionController { - protected RouterInterface $router; - protected TemplateRendererInterface $template; - protected UserServiceInterface $userService; - protected AuthenticationServiceInterface $authenticationService; - protected FlashMessengerInterface $messenger; - protected FormsPlugin $forms; - protected DebugBar $debugBar; - /** * @Inject({ * UserServiceInterface::class, @@ -55,21 +46,14 @@ class AccountController extends AbstractActionController * }) */ public function __construct( - UserServiceInterface $userService, - RouterInterface $router, - TemplateRendererInterface $template, - AuthenticationService $authenticationService, - FlashMessengerInterface $messenger, - FormsPlugin $forms, - DebugBar $debugBar + protected UserServiceInterface $userService, + protected RouterInterface $router, + protected TemplateRendererInterface $template, + protected AuthenticationService $authenticationService, + protected FlashMessengerInterface $messenger, + protected FormsPlugin $forms, + protected DebugBar $debugBar ) { - $this->userService = $userService; - $this->router = $router; - $this->template = $template; - $this->authenticationService = $authenticationService; - $this->messenger = $messenger; - $this->forms = $forms; - $this->debugBar = $debugBar; } public function activateAction(): ResponseInterface diff --git a/src/User/src/Controller/UserController.php b/src/User/src/Controller/UserController.php index de55e0c0..97644cdb 100644 --- a/src/User/src/Controller/UserController.php +++ b/src/User/src/Controller/UserController.php @@ -28,26 +28,7 @@ class UserController extends AbstractActionController { - protected CookieServiceInterface $cookieService; - - protected RouterInterface $router; - - protected TemplateRendererInterface $template; - - protected UserServiceInterface $userService; - - protected AuthenticationService $authenticationService; - - protected FlashMessengerInterface $messenger; - - protected FormsPlugin $forms; - - protected DebugBar $debugBar; - - protected array $config = []; - /** - * @param array $config * @Inject({ * CookieServiceInterface::class, * UserServiceInterface::class, @@ -61,25 +42,16 @@ class UserController extends AbstractActionController * }) */ public function __construct( - CookieServiceInterface $cookieService, - UserServiceInterface $userService, - RouterInterface $router, - TemplateRendererInterface $template, - AuthenticationService $authenticationService, - FlashMessengerInterface $messenger, - FormsPlugin $forms, - DebugBar $debugBar, - array $config = [] + protected CookieServiceInterface $cookieService, + protected UserServiceInterface $userService, + protected RouterInterface $router, + protected TemplateRendererInterface $template, + protected AuthenticationService $authenticationService, + protected FlashMessengerInterface $messenger, + protected FormsPlugin $forms, + protected DebugBar $debugBar, + protected array $config = [] ) { - $this->cookieService = $cookieService; - $this->userService = $userService; - $this->router = $router; - $this->template = $template; - $this->authenticationService = $authenticationService; - $this->messenger = $messenger; - $this->forms = $forms; - $this->debugBar = $debugBar; - $this->config = $config; } /** diff --git a/src/User/src/EventListener/UserAvatarEventListener.php b/src/User/src/EventListener/UserAvatarEventListener.php index 7e46ed45..ec1e1d33 100644 --- a/src/User/src/EventListener/UserAvatarEventListener.php +++ b/src/User/src/EventListener/UserAvatarEventListener.php @@ -15,17 +15,13 @@ */ class UserAvatarEventListener { - protected array $config; - /** - * @param array $config * @Inject({ * "config" * }) */ - public function __construct(array $config = []) + public function __construct(protected array $config = []) { - $this->config = $config; } public function postLoad(UserAvatar $avatar): void diff --git a/src/User/src/Fieldset/AvatarFieldset.php b/src/User/src/Fieldset/AvatarFieldset.php index 5add4d0a..8b8b810e 100644 --- a/src/User/src/Fieldset/AvatarFieldset.php +++ b/src/User/src/Fieldset/AvatarFieldset.php @@ -9,11 +9,7 @@ class AvatarFieldset extends Fieldset { - /** - * @param mixed $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); } diff --git a/src/User/src/Fieldset/UserDetailFieldset.php b/src/User/src/Fieldset/UserDetailFieldset.php index c9c07a33..26ce65ed 100644 --- a/src/User/src/Fieldset/UserDetailFieldset.php +++ b/src/User/src/Fieldset/UserDetailFieldset.php @@ -9,11 +9,7 @@ class UserDetailFieldset extends Fieldset { - /** - * @param mixed $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); } diff --git a/src/User/src/Form/LoginForm.php b/src/User/src/Form/LoginForm.php index cecdf426..174545be 100644 --- a/src/User/src/Form/LoginForm.php +++ b/src/User/src/Form/LoginForm.php @@ -15,11 +15,7 @@ class LoginForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/ProfileDeleteForm.php b/src/User/src/Form/ProfileDeleteForm.php index 3ebd8547..ac13d4f8 100644 --- a/src/User/src/Form/ProfileDeleteForm.php +++ b/src/User/src/Form/ProfileDeleteForm.php @@ -14,11 +14,7 @@ class ProfileDeleteForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/ProfileDetailsForm.php b/src/User/src/Form/ProfileDetailsForm.php index dea35564..c03037c4 100644 --- a/src/User/src/Form/ProfileDetailsForm.php +++ b/src/User/src/Form/ProfileDetailsForm.php @@ -15,11 +15,7 @@ class ProfileDetailsForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param mixed $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/ProfilePasswordForm.php b/src/User/src/Form/ProfilePasswordForm.php index 54f99c6c..755d1fca 100644 --- a/src/User/src/Form/ProfilePasswordForm.php +++ b/src/User/src/Form/ProfilePasswordForm.php @@ -14,11 +14,7 @@ class ProfilePasswordForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/RegisterForm.php b/src/User/src/Form/RegisterForm.php index b18ec02b..77368742 100644 --- a/src/User/src/Form/RegisterForm.php +++ b/src/User/src/Form/RegisterForm.php @@ -17,11 +17,7 @@ class RegisterForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/RequestResetPasswordForm.php b/src/User/src/Form/RequestResetPasswordForm.php index b29d8893..866aacce 100644 --- a/src/User/src/Form/RequestResetPasswordForm.php +++ b/src/User/src/Form/RequestResetPasswordForm.php @@ -14,11 +14,7 @@ class RequestResetPasswordForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/ResetPasswordForm.php b/src/User/src/Form/ResetPasswordForm.php index cf797e89..a5d3e35a 100644 --- a/src/User/src/Form/ResetPasswordForm.php +++ b/src/User/src/Form/ResetPasswordForm.php @@ -14,11 +14,7 @@ class ResetPasswordForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Form/UploadAvatarForm.php b/src/User/src/Form/UploadAvatarForm.php index 2373a6b4..2c3602fe 100644 --- a/src/User/src/Form/UploadAvatarForm.php +++ b/src/User/src/Form/UploadAvatarForm.php @@ -13,11 +13,7 @@ class UploadAvatarForm extends Form { protected InputFilterInterface $inputFilter; - /** - * @param null $name - * @param array $options - */ - public function __construct($name = null, array $options = []) + public function __construct(mixed $name = null, array $options = []) { parent::__construct($name, $options); diff --git a/src/User/src/Service/UserRoleService.php b/src/User/src/Service/UserRoleService.php index 95351f85..eeace619 100644 --- a/src/User/src/Service/UserRoleService.php +++ b/src/User/src/Service/UserRoleService.php @@ -14,16 +14,13 @@ */ class UserRoleService implements UserRoleServiceInterface { - protected UserRoleRepository $roleRepository; - /** * @Inject({ * UserRoleRepository::class, * }) */ - public function __construct(UserRoleRepository $roleRepository) + public function __construct(protected UserRoleRepository $roleRepository) { - $this->roleRepository = $roleRepository; } public function findOneBy(array $params = []): ?UserRole diff --git a/src/User/src/Service/UserService.php b/src/User/src/Service/UserService.php index 74c6a9c8..3e6f19a4 100644 --- a/src/User/src/Service/UserService.php +++ b/src/User/src/Service/UserService.php @@ -46,22 +46,7 @@ class UserService implements UserServiceInterface 'image/png' => 'png', ]; - protected CookieServiceInterface $cookieService; - - protected MailServiceInterface $mailService; - - protected TemplateRendererInterface $templateRenderer; - - protected UserRoleServiceInterface $userRoleService; - - protected UserRepository $userRepository; - - protected UserRoleRepository $userRoleRepository; - - protected array $config = []; - /** - * @param array $config * @Inject({ * CookieServiceInterface::class, * MailService::class, @@ -73,21 +58,14 @@ class UserService implements UserServiceInterface * }) */ public function __construct( - CookieServiceInterface $cookieService, - MailService $mailService, - UserRoleServiceInterface $userRoleService, - TemplateRendererInterface $templateRenderer, - UserRepository $userRepository, - UserRoleRepository $userRoleRepository, - array $config = [] + protected CookieServiceInterface $cookieService, + protected MailService $mailService, + protected UserRoleServiceInterface $userRoleService, + protected TemplateRendererInterface $templateRenderer, + protected UserRepository $userRepository, + protected UserRoleRepository $userRoleRepository, + protected array $config = [] ) { - $this->cookieService = $cookieService; - $this->mailService = $mailService; - $this->userRoleService = $userRoleService; - $this->templateRenderer = $templateRenderer; - $this->userRepository = $userRepository; - $this->userRoleRepository = $userRoleRepository; - $this->config = $config; } /**