From 220110a403aa99f14f0f07d0f9dbee3e7a7d9b4c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 28 May 2025 15:16:09 +0200 Subject: [PATCH] Run symfonysetlist symfony_62 --- rector.php | 80 ++++++++----------- .../CalendarRangeRemoveToRemoteHandler.php | 4 +- .../Handler/CalendarRangeToRemoteHandler.php | 4 +- .../Handler/CalendarRemoveHandler.php | 4 +- .../Handler/CalendarToRemoteHandler.php | 4 +- .../Messenger/Handler/InviteUpdateHandler.php | 4 +- .../MSGraphChangeNotificationHandler.php | 4 +- .../Messenger/RequestGenerationHandler.php | 7 +- .../BaseSigner/PdfSignedMessageHandler.php | 5 +- .../RemoveOldVersionMessageHandler.php | 5 +- .../ShortMessage/ShortMessageHandler.php | 5 +- .../PostPublicViewMessageHandler.php | 6 +- .../PostSendExternalMessageHandler.php | 5 +- .../PostSignatureStateChangeHandler.php | 4 +- 14 files changed, 61 insertions(+), 80 deletions(-) diff --git a/rector.php b/rector.php index ec4725aaf..8c614d14e 100644 --- a/rector.php +++ b/rector.php @@ -16,19 +16,19 @@ use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ - __DIR__ . '/docs', - __DIR__ . '/src', + __DIR__.'/docs', + __DIR__.'/src', ]); $rectorConfig->skip([ - \Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => __DIR__ . 'src/Bundle/ChillMainBundle/Service/Notifier/LegacyOvhCloudFactory.php' + Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => __DIR__.'src/Bundle/ChillMainBundle/Service/Notifier/LegacyOvhCloudFactory.php', ]); - $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/test/App_KernelTestDebugContainer.xml '); - $rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php'); + $rectorConfig->symfonyContainerXml(__DIR__.'/var/cache/dev/test/App_KernelTestDebugContainer.xml '); + $rectorConfig->symfonyContainerPhp(__DIR__.'/tests/symfony-container.php'); - //$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class); - //$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector'); + // $rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class); + // $rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector'); // register a single rule $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); @@ -43,37 +43,27 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->rule(Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector::class); // part of the symfony 54 rules - $rectorConfig->rule(\Rector\Symfony\Symfony53\Rector\StaticPropertyFetch\KernelTestCaseContainerPropertyDeprecationRector::class); - $rectorConfig->rule(\Rector\Symfony\Symfony60\Rector\MethodCall\GetHelperControllerToServiceRector::class); + $rectorConfig->rule(Rector\Symfony\Symfony53\Rector\StaticPropertyFetch\KernelTestCaseContainerPropertyDeprecationRector::class); + $rectorConfig->rule(Rector\Symfony\Symfony60\Rector\MethodCall\GetHelperControllerToServiceRector::class); $rectorConfig->disableParallel(); - //define sets of rules + // define sets of rules $rectorConfig->sets([ LevelSetList::UP_TO_PHP_82, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_40, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_41, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_42, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_43, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_44, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_50, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_51, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_52, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_53, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_54, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_60, - \Rector\Symfony\Set\SymfonySetList::SYMFONY_61, - \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, - \Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90, + Rector\Symfony\Set\SymfonySetList::SYMFONY_60, + Rector\Symfony\Set\SymfonySetList::SYMFONY_61, + Rector\Symfony\Set\SymfonySetList::SYMFONY_62, + Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, ]); - $rectorConfig->ruleWithConfiguration(\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, [ - new \Rector\Php80\ValueObject\AnnotationToAttribute('Symfony\Component\Serializer\Annotation\Context'), + $rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [ + new Rector\Php80\ValueObject\AnnotationToAttribute('Symfony\Component\Serializer\Annotation\Context'), ]); // migrate for phpunit $rectorConfig->rules([ - \Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector::class, - \Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector::class + Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector::class, + Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector::class, ]); // some routes are added twice if it remains activated @@ -81,30 +71,30 @@ return static function (RectorConfig $rectorConfig): void { // chill rules $rectorConfig->rules([ - \Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractExportTestRector::class, + Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractExportTestRector::class, ]); // skip some path... $rectorConfig->skip([ // waiting for fixing this bug: https://github.com/rectorphp/rector-doctrine/issues/342 - \Rector\Doctrine\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector::class, + Rector\Doctrine\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector::class, ]); $rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [ - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\MaxHolder'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ConfidentialCourseMustHaveReferrer'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\Birthdate'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\ActivityBundle\Validator\Constraints\ActivityValidity'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validation\Constraint\PhonenumberConstraint'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency'), - new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\MaxHolder'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ConfidentialCourseMustHaveReferrer'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\Birthdate'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\ActivityBundle\Validator\Constraints\ActivityValidity'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validation\Constraint\PhonenumberConstraint'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency'), + new Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation'), ]); }; diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php index 95cbdc41c..0aa392fbc 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php @@ -29,10 +29,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class CalendarRangeRemoveToRemoteHandler { public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) {} - public function __invoke(CalendarRangeRemovedMessage $calendarRangeRemovedMessage): void { $this->remoteCalendarConnector->removeCalendarRange( diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php index c9fd1b939..7410e70a2 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php @@ -30,10 +30,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class CalendarRangeToRemoteHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class CalendarRangeToRemoteHandler { public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) {} - public function __invoke(CalendarRangeMessage $calendarRangeMessage): void { $range = $this->calendarRangeRepository->find($calendarRangeMessage->getCalendarRangeId()); diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php index 0cd7d6809..8667aaa05 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php @@ -29,10 +29,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class CalendarRemoveHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class CalendarRemoveHandler { public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) {} - public function __invoke(CalendarRemovedMessage $message): void { if (null !== $message->getAssociatedCalendarRangeId()) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php index df85f9150..a9e12d246 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php @@ -35,10 +35,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class CalendarToRemoteHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class CalendarToRemoteHandler { public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) {} - public function __invoke(CalendarMessage $calendarMessage): void { $calendar = $this->calendarRepository->find($calendarMessage->getCalendarId()); diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php index 7ca5f2c12..b1483b087 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php @@ -29,10 +29,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class InviteUpdateHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class InviteUpdateHandler { public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) {} - public function __invoke(InviteUpdateMessage $inviteUpdateMessage): void { if (null === $invite = $this->inviteRepository->find($inviteUpdateMessage->getInviteId())) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php index 7a67bee61..4aefc5323 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php @@ -34,10 +34,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * * @AsMessageHandler */ -class MSGraphChangeNotificationHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class MSGraphChangeNotificationHandler { public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) {} - public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void { $user = $this->userRepository->find($changeNotificationMessage->getUserId()); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index 9921fcc12..eb79889a5 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -30,12 +30,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Handle the request of document generation. */ -class RequestGenerationHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class RequestGenerationHandler { final public const AUTHORIZED_TRIALS = 5; - private const LOG_PREFIX = '[docgen message handler] '; - public function __construct( private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, @@ -47,7 +46,6 @@ class RequestGenerationHandler implements MessageHandlerInterface private readonly TempUrlGeneratorInterface $tempUrlGenerator, private readonly TranslatorInterface $translator, ) {} - public function __invoke(RequestGenerationMessage $message): void { if (null === $template = $this->docGeneratorTemplateRepository->find($message->getTemplateId())) { @@ -119,7 +117,6 @@ class RequestGenerationHandler implements MessageHandlerInterface 'duration_int' => (new \DateTimeImmutable('now'))->getTimestamp() - $message->getCreatedAt()->getTimestamp(), ]); } - private function sendDataDump(StoredObject $destinationStoredObject, RequestGenerationMessage $message): void { $url = $this->tempUrlGenerator->generate('GET', $destinationStoredObject->getFilename(), 3600); diff --git a/src/Bundle/ChillDocStoreBundle/Service/Signature/Driver/BaseSigner/PdfSignedMessageHandler.php b/src/Bundle/ChillDocStoreBundle/Service/Signature/Driver/BaseSigner/PdfSignedMessageHandler.php index a8205c506..8e7c20c0e 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/Signature/Driver/BaseSigner/PdfSignedMessageHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Service/Signature/Driver/BaseSigner/PdfSignedMessageHandler.php @@ -19,13 +19,13 @@ use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; -final readonly class PdfSignedMessageHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +final readonly class PdfSignedMessageHandler { /** * log prefix. */ private const P = '[pdf signed message] '; - public function __construct( private LoggerInterface $logger, private EntityWorkflowManager $entityWorkflowManager, @@ -34,7 +34,6 @@ final readonly class PdfSignedMessageHandler implements MessageHandlerInterface private EntityManagerInterface $entityManager, private SignatureStepStateChanger $signatureStepStateChanger, ) {} - public function __invoke(PdfSignedMessage $message): void { $this->logger->info(self::P.'a message is received', ['signaturedId' => $message->signatureId]); diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectCleaner/RemoveOldVersionMessageHandler.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectCleaner/RemoveOldVersionMessageHandler.php index f0542bb88..36b6ff0d3 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectCleaner/RemoveOldVersionMessageHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectCleaner/RemoveOldVersionMessageHandler.php @@ -30,10 +30,10 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; * If a StoredObject is a candidate for deletion (is expired and no more version stored), it is also removed from the * database. */ -final readonly class RemoveOldVersionMessageHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +final readonly class RemoveOldVersionMessageHandler { private const LOG_PREFIX = '[RemoveOldVersionMessageHandler] '; - public function __construct( private StoredObjectVersionRepository $storedObjectVersionRepository, private LoggerInterface $logger, @@ -41,7 +41,6 @@ final readonly class RemoveOldVersionMessageHandler implements MessageHandlerInt private StoredObjectManagerInterface $storedObjectManager, private ClockInterface $clock, ) {} - /** * @throws StoredObjectManagerException */ diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php index 7d9b9e845..07fe983ee 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php @@ -27,15 +27,14 @@ use Symfony\Component\Notifier\TexterInterface; /** * @AsMessageHandler */ -class ShortMessageHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +class ShortMessageHandler { private readonly PhoneNumberUtil $phoneNumberUtil; - public function __construct(private readonly TexterInterface $texter) { $this->phoneNumberUtil = PhoneNumberUtil::getInstance(); } - public function __invoke(ShortMessage $message): void { trigger_deprecation('Chill-project/chill-bundles', '3.7.0', 'Send message using Notifier component'); diff --git a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostPublicViewMessageHandler.php b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostPublicViewMessageHandler.php index b963b2910..f58003837 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostPublicViewMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostPublicViewMessageHandler.php @@ -23,19 +23,17 @@ use Symfony\Component\Workflow\Registry; * * This handler apply a transition if the workflow's configuration defines one. */ -final readonly class PostPublicViewMessageHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +final readonly class PostPublicViewMessageHandler { private const LOG_PREFIX = '[PostPublicViewMessageHandler] '; - private const TRANSITION_ON_VIEW = 'onExternalView'; - public function __construct( private EntityWorkflowSendViewRepository $sendViewRepository, private Registry $registry, private LoggerInterface $logger, private EntityManagerInterface $entityManager, ) {} - public function __invoke(PostPublicViewMessage $message): void { $view = $this->sendViewRepository->find($message->entityWorkflowSendViewId); diff --git a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSendExternalMessageHandler.php b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSendExternalMessageHandler.php index 04576015b..209bef3d0 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSendExternalMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSendExternalMessageHandler.php @@ -19,14 +19,14 @@ use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; -final readonly class PostSendExternalMessageHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +final readonly class PostSendExternalMessageHandler { public function __construct( private EntityWorkflowRepository $entityWorkflowRepository, private MailerInterface $mailer, private EntityWorkflowManager $workflowManager, ) {} - public function __invoke(PostSendExternalMessage $message): void { $entityWorkflow = $this->entityWorkflowRepository->find($message->entityWorkflowId); @@ -39,7 +39,6 @@ final readonly class PostSendExternalMessageHandler implements MessageHandlerInt $this->sendEmailToDestinee($send, $message); } } - private function sendEmailToDestinee(EntityWorkflowSend $send, PostSendExternalMessage $message): void { $entityWorkflow = $send->getEntityWorkflowStep()->getEntityWorkflow(); diff --git a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSignatureStateChangeHandler.php b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSignatureStateChangeHandler.php index 820b9698a..7dc98c47b 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSignatureStateChangeHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Messenger/PostSignatureStateChangeHandler.php @@ -17,14 +17,14 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; -final readonly class PostSignatureStateChangeHandler implements MessageHandlerInterface +#[\Symfony\Component\Messenger\Attribute\AsMessageHandler] +final readonly class PostSignatureStateChangeHandler { public function __construct( private EntityWorkflowStepSignatureRepository $entityWorkflowStepSignatureRepository, private SignatureStepStateChanger $signatureStepStateChanger, private EntityManagerInterface $entityManager, ) {} - public function __invoke(PostSignatureStateChangeMessage $message): void { $signature = $this->entityWorkflowStepSignatureRepository->find($message->signatureId);