From 4e155ba129a4f4a55e7ae8b2d135ee905560dd81 Mon Sep 17 00:00:00 2001 From: Artem Henvald Date: Fri, 12 Apr 2024 10:25:18 +0300 Subject: [PATCH] Refactoring --- Asset/DatetimeVersionStrategy.php | 5 +++-- Event/User/AbstractUserEvent.php | 5 +++-- EventListener/JWT/JwtSubscriber.php | 5 +++-- EventListener/JWT/TokenBlackListSubscriber.php | 5 +++-- EventListener/Kernel/ApiExceptionFormatterListener.php | 8 ++++++-- EventListener/ODM/Aggregate/AggregatePartListener.php | 5 +++-- EventListener/ORM/Aggregate/AggregatePartListener.php | 5 +++-- EventListener/Security/CheckVerifiedUserSubscriber.php | 5 +++-- Request/DtoExtractor.php | 6 ++++-- Security/JwtBlackListService.php | 8 ++++++-- Security/JwtTokenHelper.php | 5 +++-- .../Normalizer/ConstraintViolationListNormalizer.php | 5 +++-- Serializer/Serializer.php | 2 +- .../AttributeProcessor/JsonSchemaAttributeProcessor.php | 7 +++++-- Service/DependentEntity/DependentEntityService.php | 5 +++-- .../ResponseProcessor/ExceptionResponseProcessor.php | 5 +++-- Validator/Constraints/Entity/EntityExistsValidator.php | 5 +++-- .../Password/PasswordMeetSpecialRequirementsValidator.php | 5 +++-- Validator/JsonSchemaValidator.php | 6 ++++-- 19 files changed, 65 insertions(+), 37 deletions(-) diff --git a/Asset/DatetimeVersionStrategy.php b/Asset/DatetimeVersionStrategy.php index c986e39..2cec8e1 100644 --- a/Asset/DatetimeVersionStrategy.php +++ b/Asset/DatetimeVersionStrategy.php @@ -27,8 +27,9 @@ class DatetimeVersionStrategy implements VersionStrategyInterface /** * @param DateTimeHelper $dateTimeHelper */ - public function __construct(DateTimeHelper $dateTimeHelper) - { + public function __construct( + private readonly DateTimeHelper $dateTimeHelper, + ) { $this->version = $dateTimeHelper->getCurrentDatetimeImmutable()->format('YmdHis'); } diff --git a/Event/User/AbstractUserEvent.php b/Event/User/AbstractUserEvent.php index c782738..d447eff 100644 --- a/Event/User/AbstractUserEvent.php +++ b/Event/User/AbstractUserEvent.php @@ -23,8 +23,9 @@ abstract class AbstractUserEvent extends Event /** * @param UserInterface $user */ - public function __construct(private readonly UserInterface $user) - { + public function __construct( + private readonly UserInterface $user, + ) { } /** diff --git a/EventListener/JWT/JwtSubscriber.php b/EventListener/JWT/JwtSubscriber.php index dd78719..a98c352 100644 --- a/EventListener/JWT/JwtSubscriber.php +++ b/EventListener/JWT/JwtSubscriber.php @@ -32,8 +32,9 @@ final class JwtSubscriber implements EventSubscriberInterface /** * @param TranslatorInterface $translator */ - public function __construct(private readonly TranslatorInterface $translator) - { + public function __construct( + private readonly TranslatorInterface $translator, + ) { } /** diff --git a/EventListener/JWT/TokenBlackListSubscriber.php b/EventListener/JWT/TokenBlackListSubscriber.php index e9ed6e8..1f3b252 100644 --- a/EventListener/JWT/TokenBlackListSubscriber.php +++ b/EventListener/JWT/TokenBlackListSubscriber.php @@ -25,8 +25,9 @@ final class TokenBlackListSubscriber implements EventSubscriberInterface /** * @param JwtBlackListService $tokenBlackListService */ - public function __construct(private readonly JwtBlackListService $tokenBlackListService) - { + public function __construct( + private readonly JwtBlackListService $tokenBlackListService, + ) { } /** diff --git a/EventListener/Kernel/ApiExceptionFormatterListener.php b/EventListener/Kernel/ApiExceptionFormatterListener.php index 04d02e1..6a13d02 100644 --- a/EventListener/Kernel/ApiExceptionFormatterListener.php +++ b/EventListener/Kernel/ApiExceptionFormatterListener.php @@ -47,8 +47,12 @@ final class ApiExceptionFormatterListener implements EventSubscriberInterface * @param ExceptionResponseProcessorInterface $exceptionResponseProcessor * @param ExceptionResponseFactory $exceptionResponseFactory */ - public function __construct(private readonly string $apiHost, private readonly string $environment, private readonly ExceptionResponseProcessorInterface $exceptionResponseProcessor, private readonly ExceptionResponseFactory $exceptionResponseFactory) - { + public function __construct( + private readonly string $apiHost, + private readonly string $environment, + private readonly ExceptionResponseProcessorInterface $exceptionResponseProcessor, + private readonly ExceptionResponseFactory $exceptionResponseFactory, + ) { } /** diff --git a/EventListener/ODM/Aggregate/AggregatePartListener.php b/EventListener/ODM/Aggregate/AggregatePartListener.php index 4fa04ce..2ef413e 100644 --- a/EventListener/ODM/Aggregate/AggregatePartListener.php +++ b/EventListener/ODM/Aggregate/AggregatePartListener.php @@ -28,8 +28,9 @@ final class AggregatePartListener /** * @param DateTimeHelper $dateTimeHelper */ - public function __construct(private readonly DateTimeHelper $dateTimeHelper) - { + public function __construct( + private readonly DateTimeHelper $dateTimeHelper, + ) { } /** diff --git a/EventListener/ORM/Aggregate/AggregatePartListener.php b/EventListener/ORM/Aggregate/AggregatePartListener.php index df58e1a..f29ce2c 100644 --- a/EventListener/ORM/Aggregate/AggregatePartListener.php +++ b/EventListener/ORM/Aggregate/AggregatePartListener.php @@ -28,8 +28,9 @@ final class AggregatePartListener /** * @param DateTimeHelper $dateTimeHelper */ - public function __construct(private readonly DateTimeHelper $dateTimeHelper) - { + public function __construct( + private readonly DateTimeHelper $dateTimeHelper, + ) { } /** diff --git a/EventListener/Security/CheckVerifiedUserSubscriber.php b/EventListener/Security/CheckVerifiedUserSubscriber.php index f6f2bd3..134def9 100644 --- a/EventListener/Security/CheckVerifiedUserSubscriber.php +++ b/EventListener/Security/CheckVerifiedUserSubscriber.php @@ -26,8 +26,9 @@ final class CheckVerifiedUserSubscriber implements EventSubscriberInterface /** * @param JwtBlackListService $tokenBlackListService */ - public function __construct(private readonly JwtBlackListService $tokenBlackListService) - { + public function __construct( + private readonly JwtBlackListService $tokenBlackListService, + ) { } /** diff --git a/Request/DtoExtractor.php b/Request/DtoExtractor.php index 0e8a1fd..adb7052 100644 --- a/Request/DtoExtractor.php +++ b/Request/DtoExtractor.php @@ -29,8 +29,10 @@ class DtoExtractor * @param DtoAttributeProcessor $dtoAttributeProcessor * @param SerializerInterface $serializer */ - public function __construct(private readonly DtoAttributeProcessor $dtoAttributeProcessor, private readonly SerializerInterface $serializer) - { + public function __construct( + private readonly DtoAttributeProcessor $dtoAttributeProcessor, + private readonly SerializerInterface $serializer, + ) { } /** diff --git a/Security/JwtBlackListService.php b/Security/JwtBlackListService.php index f477b67..41f58ef 100644 --- a/Security/JwtBlackListService.php +++ b/Security/JwtBlackListService.php @@ -33,8 +33,12 @@ class JwtBlackListService * @param JwtCacheHelper $jwtCacheHelper * @param DateTimeHelper $dateTimeHelper */ - public function __construct(private readonly JWSProviderInterface $jwsProvider, private readonly JwtTokenHelper $jwtTokenHelper, private readonly JwtCacheHelper $jwtCacheHelper, private readonly DateTimeHelper $dateTimeHelper) - { + public function __construct( + private readonly JWSProviderInterface $jwsProvider, + private readonly JwtTokenHelper $jwtTokenHelper, + private readonly JwtCacheHelper $jwtCacheHelper, + private readonly DateTimeHelper $dateTimeHelper, + ) { } /** diff --git a/Security/JwtTokenHelper.php b/Security/JwtTokenHelper.php index a07e942..b3d0e6d 100644 --- a/Security/JwtTokenHelper.php +++ b/Security/JwtTokenHelper.php @@ -25,8 +25,9 @@ class JwtTokenHelper /** * @param TokenStorageInterface $tokenStorage */ - public function __construct(private readonly TokenStorageInterface $tokenStorage) - { + public function __construct( + private readonly TokenStorageInterface $tokenStorage, + ) { } /** diff --git a/Serializer/Normalizer/ConstraintViolationListNormalizer.php b/Serializer/Normalizer/ConstraintViolationListNormalizer.php index f67583a..e38c33c 100644 --- a/Serializer/Normalizer/ConstraintViolationListNormalizer.php +++ b/Serializer/Normalizer/ConstraintViolationListNormalizer.php @@ -23,8 +23,9 @@ class ConstraintViolationListNormalizer implements NormalizerInterface /** * @param NormalizerInterface $symfonyConstraintViolationListNormalizer */ - public function __construct(private readonly NormalizerInterface $symfonyConstraintViolationListNormalizer) - { + public function __construct( + private readonly NormalizerInterface $symfonyConstraintViolationListNormalizer, + ) { } /** diff --git a/Serializer/Serializer.php b/Serializer/Serializer.php index b149d08..22754f2 100644 --- a/Serializer/Serializer.php +++ b/Serializer/Serializer.php @@ -42,7 +42,7 @@ public function serialize(object|array $object, string $serializationGroup, arra $context, [ 'group' => $serializationGroup, - 'json_encode_options' => \JSON_UNESCAPED_SLASHES | \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_UNICODE, + 'json_encode_options' => \JSON_UNESCAPED_SLASHES | \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES, ] ); diff --git a/Service/AttributeProcessor/JsonSchemaAttributeProcessor.php b/Service/AttributeProcessor/JsonSchemaAttributeProcessor.php index 212e8d1..cf28658 100644 --- a/Service/AttributeProcessor/JsonSchemaAttributeProcessor.php +++ b/Service/AttributeProcessor/JsonSchemaAttributeProcessor.php @@ -32,8 +32,11 @@ class JsonSchemaAttributeProcessor * @param FileReader $fileReader * @param string $jsonSchemaDir */ - public function __construct(private readonly DtoAttributeProcessor $dtoAttributeProcessor, private readonly FileReader $fileReader, private readonly string $jsonSchemaDir) - { + public function __construct( + private readonly DtoAttributeProcessor $dtoAttributeProcessor, + private readonly FileReader $fileReader, + private readonly string $jsonSchemaDir, + ) { } /** diff --git a/Service/DependentEntity/DependentEntityService.php b/Service/DependentEntity/DependentEntityService.php index ec9a402..e819a6c 100644 --- a/Service/DependentEntity/DependentEntityService.php +++ b/Service/DependentEntity/DependentEntityService.php @@ -28,8 +28,9 @@ class DependentEntityService /** * @param RepositoryService $repositoryService */ - public function __construct(private readonly RepositoryService $repositoryService) - { + public function __construct( + private readonly RepositoryService $repositoryService, + ) { } /** diff --git a/Service/Exception/ResponseProcessor/ExceptionResponseProcessor.php b/Service/Exception/ResponseProcessor/ExceptionResponseProcessor.php index fed453a..fa8d97a 100644 --- a/Service/Exception/ResponseProcessor/ExceptionResponseProcessor.php +++ b/Service/Exception/ResponseProcessor/ExceptionResponseProcessor.php @@ -22,8 +22,9 @@ class ExceptionResponseProcessor implements ExceptionResponseProcessorInterface /** * @param iterable|CustomAppExceptionResponseProcessorInterface[] $errorResponseProcessors */ - public function __construct(private readonly iterable $errorResponseProcessors) - { + public function __construct( + private readonly iterable $errorResponseProcessors, + ) { } /** diff --git a/Validator/Constraints/Entity/EntityExistsValidator.php b/Validator/Constraints/Entity/EntityExistsValidator.php index 698d109..11b883b 100644 --- a/Validator/Constraints/Entity/EntityExistsValidator.php +++ b/Validator/Constraints/Entity/EntityExistsValidator.php @@ -25,8 +25,9 @@ class EntityExistsValidator extends ConstraintValidator /** * @param RepositoryService $repositoryService */ - public function __construct(private readonly RepositoryService $repositoryService) - { + public function __construct( + private readonly RepositoryService $repositoryService, + ) { } /** diff --git a/Validator/Constraints/Password/PasswordMeetSpecialRequirementsValidator.php b/Validator/Constraints/Password/PasswordMeetSpecialRequirementsValidator.php index b26d2cd..48f127d 100644 --- a/Validator/Constraints/Password/PasswordMeetSpecialRequirementsValidator.php +++ b/Validator/Constraints/Password/PasswordMeetSpecialRequirementsValidator.php @@ -25,8 +25,9 @@ class PasswordMeetSpecialRequirementsValidator extends ConstraintValidator /** * @param PasswordRequirementsValidator $passwordRequirementsValidator */ - public function __construct(private readonly PasswordRequirementsValidator $passwordRequirementsValidator) - { + public function __construct( + private readonly PasswordRequirementsValidator $passwordRequirementsValidator, + ) { } /** diff --git a/Validator/JsonSchemaValidator.php b/Validator/JsonSchemaValidator.php index 7c1766a..4f23aa3 100644 --- a/Validator/JsonSchemaValidator.php +++ b/Validator/JsonSchemaValidator.php @@ -34,8 +34,10 @@ class JsonSchemaValidator * @param Validator $validator * @param JsonSchemaAttributeProcessor $jsonSchemaAttributeProcessor */ - public function __construct(private readonly Validator $validator, private readonly JsonSchemaAttributeProcessor $jsonSchemaAttributeProcessor) - { + public function __construct( + private readonly Validator $validator, + private readonly JsonSchemaAttributeProcessor $jsonSchemaAttributeProcessor, + ) { } /**