pipeline fixes for phpstan, cs-fixer, rector

This commit is contained in:
Julie Lenaerts 2024-04-16 20:16:45 +02:00
parent b9b342fe44
commit c9e13be736
3 changed files with 9 additions and 11 deletions

View File

@ -42,7 +42,7 @@ class UserRender implements ChillEntityRenderInterface
} }
/** /**
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: DateTimeImmutable|DateTime|null} $options * @param array $options
* *
* @throws LoaderError * @throws LoaderError
* @throws RuntimeError * @throws RuntimeError
@ -54,7 +54,7 @@ class UserRender implements ChillEntityRenderInterface
if (null === $opts['at_date']) { if (null === $opts['at_date']) {
$opts['at_date'] = $this->clock->now(); $opts['at_date'] = $this->clock->now();
} elseif ($opts['at_date'] instanceof DateTime) { } elseif ($opts['at_date'] instanceof \DateTime) {
$opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']); $opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']);
} }
@ -65,7 +65,7 @@ class UserRender implements ChillEntityRenderInterface
} }
/** /**
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: DateTimeImmutable|DateTime|null} $options * @param array $options
*/ */
public function renderString($entity, array $options): string public function renderString($entity, array $options): string
{ {
@ -75,7 +75,7 @@ class UserRender implements ChillEntityRenderInterface
if (null === $opts['at_date']) { if (null === $opts['at_date']) {
$opts['at_date'] = $this->clock->now(); $opts['at_date'] = $this->clock->now();
} elseif ($opts['at_date'] instanceof DateTime) { } elseif ($opts['at_date'] instanceof \DateTime) {
$opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']); $opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']);
} }

View File

@ -39,7 +39,8 @@ class UserRenderTest extends WebTestCase
self::bootKernel(); self::bootKernel();
} }
#[NoReturn] public function testRenderUserWithJobAndScopeAtCertainDate(): void #[NoReturn]
public function testRenderUserWithJobAndScopeAtCertainDate(): void
{ {
self::bootKernel(); self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class); $em = self::$container->get(EntityManagerInterface::class);
@ -54,8 +55,7 @@ class UserRenderTest extends WebTestCase
->setActive(true); ->setActive(true);
$scopeA->setName(['fr' => 'service A']); $scopeA->setName(['fr' => 'service A']);
$user->setLabel('BOB ISLA'); $user->setLabel('BOB ISLA');
// $user->setPhonenumber(PhoneNumberUtil::getInstance()->parse('+32475928635')); // $user->setPhonenumber(PhoneNumberUtil::getInstance()->parse('+32475928635'));
$userJobB = new UserJob(); $userJobB = new UserJob();
$scopeB = new Scope(); $scopeB = new Scope();
@ -101,8 +101,7 @@ class UserRenderTest extends WebTestCase
$em->flush(); $em->flush();
// Create renderer // Create renderer
$translatableStringHelperMock = $this->getMockBuilder(TranslatableStringHelperInterface::class) $translatableStringHelperMock = $this->createMock(TranslatableStringHelperInterface::class);
->getMock();
$engineMock = $this->createMock(Environment::class); $engineMock = $this->createMock(Environment::class);
$translatorMock = $this->createMock(TranslatorInterface::class); $translatorMock = $this->createMock(TranslatorInterface::class);
@ -114,7 +113,7 @@ class UserRenderTest extends WebTestCase
$options['at_date'] = new \DateTime('2023-11-25 12:00:00'); $options['at_date'] = new \DateTime('2023-11-25 12:00:00');
$optionsTwo['at_date'] = new \DateTime('2024-01-30 12:00:00'); $optionsTwo['at_date'] = new \DateTime('2024-01-30 12:00:00');
// dd($user); // dd($user);
// Check that the user render for the first activity corresponds with the first user job // Check that the user render for the first activity corresponds with the first user job
$expectedStringA = 'BOB ISLA (assistant social) (service A)'; $expectedStringA = 'BOB ISLA (assistant social) (service A)';

View File

@ -69,7 +69,6 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac
); );
} }
if ('json' === $format) { if ('json' === $format) {
// then, we add normalization for things which are not into the entity // then, we add normalization for things which are not into the entity
$initial['workflows_availables'] = $this->metadataExtractor->availableWorkflowFor( $initial['workflows_availables'] = $this->metadataExtractor->availableWorkflowFor(