Run symfonysetlist symfony_62

This commit is contained in:
Julie Lenaerts 2025-05-28 15:16:09 +02:00
parent 3fdf494f1c
commit 220110a403
14 changed files with 61 additions and 80 deletions

View File

@ -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'),
]);
};

View File

@ -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(

View File

@ -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());

View File

@ -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()) {

View File

@ -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());

View File

@ -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())) {

View File

@ -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());

View File

@ -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);

View File

@ -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]);

View File

@ -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
*/

View File

@ -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');

View File

@ -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);

View File

@ -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();

View File

@ -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);