From 55c11c7f04918021af491f183fa8f9c0cb9c36d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 22 Dec 2025 18:26:35 +0100 Subject: [PATCH] fix misc phpstan issues --- .../src/Entity/AsideActivity.php | 20 --------------- .../Entity/ChillEntityRenderInterface.php | 4 --- .../AccompanyingPeriodWork.php | 2 +- .../ResidentialAddressRepository.php | 2 +- .../Normalizer/PersonDocGenNormalizer.php | 9 +++---- .../Normalizer/PersonJsonNormalizer.php | 4 +-- .../AccompanyingPeriodContext.php | 18 +++++++------ ...ccompanyingPeriodWorkEvaluationContext.php | 25 ++++++++++++------- .../Controller/ReportController.php | 14 +++++++---- .../ChillReportBundle/Entity/Report.php | 2 +- .../Export/Export/ReportList.php | 8 +++--- .../ChillTaskBundle/Entity/AbstractTask.php | 2 +- .../ChillTaskBundle/Entity/RecurringTask.php | 6 ++--- .../Entity/ThirdParty.php | 4 +-- ...ImportTicketMotiveConfigurationCommand.php | 3 --- .../src/Controller/Admin/MotiveController.php | 2 -- .../ChillTicketBundle/src/Entity/Motive.php | 4 +-- .../src/Entity/PersonHistory.php | 4 ++- .../PostTicketUpdateMessageHandler.php | 3 +-- .../Normalizer/TicketNormalizer.php | 4 +-- 20 files changed, 62 insertions(+), 78 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index e3b5448eb..9727c1242 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -54,12 +54,6 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface #[ORM\JoinColumn(nullable: false)] private ?AsideActivityCategory $type = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] - private ?\DateTimeInterface $updatedAt = null; - - #[ORM\ManyToOne(targetEntity: User::class)] - private User $updatedBy; - #[Assert\GreaterThanOrEqual(0)] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)] private ?int $concernedPersonsCount = 0; @@ -141,20 +135,6 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setUpdatedAt(\DateTimeInterface $updatedAt): self - { - $this->updatedAt = $updatedAt; - - return $this; - } - - public function setUpdatedBy(?User $updatedBy): self - { - $this->updatedBy = $updatedBy; - - return $this; - } - public function getConcernedPersonsCount(): ?int { return $this->concernedPersonsCount; diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php index 9eeb70c96..ffb6e15eb 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php @@ -32,8 +32,6 @@ interface ChillEntityRenderInterface * ``` * * @param T|null $entity - * - * @phpstan-pure */ public function renderBox(mixed $entity, array $options): string; @@ -43,8 +41,6 @@ interface ChillEntityRenderInterface * Example: returning the name of a person. * * @param T|null $entity - * - * @phpstan-pure */ public function renderString(mixed $entity, array $options): string; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 1a03fabac..90dd5b205 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -329,7 +329,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues } /** - * @return Collection|ThirdParty[] + * @return Collection */ public function getThirdParties(): Collection { diff --git a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php index 68a5cc2f5..043fa399d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php @@ -66,7 +66,7 @@ class ResidentialAddressRepository extends ServiceEntityRepository } /** - * @return array|ResidentialAddress[]|null + * @return list */ public function findCurrentResidentialAddressByPerson(Person $person, ?\DateTimeImmutable $at = null): array { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index ab6b55ac8..934b81d86 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -44,6 +44,10 @@ class PersonDocGenNormalizer implements public function normalize($data, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null { + if (null !== $data && !$data instanceof Person) { + throw new UnexpectedValueException('Expected Person instance or null, got '.get_debug_type($data)); + } + try { $context = $this->addCircularToContext($data, $context); } catch (CircularReferenceException) { @@ -54,7 +58,6 @@ class PersonDocGenNormalizer implements ]; } - /** @var Person $data */ $dateContext = $context; $dateContext['docgen:expects'] = \DateTimeInterface::class; $addressContext = array_merge($context, ['docgen:expects' => Address::class]); @@ -73,10 +76,6 @@ class PersonDocGenNormalizer implements return $this->normalizeNullValue($format, $context); } - if (!$data instanceof Person) { - throw new UnexpectedValueException(); - } - $data = [ 'type' => 'person', 'id' => $data->getId(), diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index dcbd8e474..563553458 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -81,8 +81,8 @@ class PersonJsonNormalizer implements NormalizerAwareInterface, NormalizerInterf ...$normalizedData, 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($data), $format, $context), 'altNames' => $this->normalizeAltNames($data->getAltNames()), - 'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, - 'current_residential_addresses' => $currentResidentialAddresses ? $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : null, + 'current_household_id' => null !== $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, + 'current_residential_addresses' => $this->normalizer->normalize($currentResidentialAddresses, $format, $context), ]; } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index 96054b59f..cb17b7b30 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -180,14 +180,16 @@ class AccompanyingPeriodContext implements } } - $thirdParties = [...array_values(array_filter([$entity->getRequestorThirdParty()])), ...array_values(array_filter( - array_map( - fn (Resource $r): ?ThirdParty => $r->getThirdParty(), - $entity->getResources()->filter( - static fn (Resource $r): bool => null !== $r->getThirdParty() - )->toArray() - ) - ))]; + $thirdParties = [ + ...array_values(array_filter([$entity->getRequestorThirdParty()])), + ...array_values(array_filter( + array_map( + fn (Resource $r): ?ThirdParty => $r->getThirdParty(), + $entity->getResources()->filter( + static fn (Resource $r): bool => null !== $r->getThirdParty() + )->toArray() + ) + ))]; if ($options['thirdParty'] ?? false) { $builder->add('thirdParty', EntityType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index 4df14d4eb..74a2eaaa1 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -85,16 +85,23 @@ class AccompanyingPeriodWorkEvaluationContext implements { $this->accompanyingPeriodWorkContext->buildPublicForm($builder, $template, $entity->getAccompanyingPeriodWork()); - $thirdParties = [...array_values(array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray())), ...array_values(array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()])), ...array_values( - array_filter( - array_map( - fn (Resource $r): ?ThirdParty => $r->getThirdParty(), - $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( - static fn (Resource $r): bool => null !== $r->getThirdParty() - )->toArray() + $thirdParties = [ + ...array_values(array_filter( + $entity->getAccompanyingPeriodWork()->getThirdParties()->toArray(), + static fn ($val) => null !== $val, + mode: 0 + )), + ...array_values(array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()])), + ...array_values( + array_filter( + array_map( + fn (Resource $r): ?ThirdParty => $r->getThirdParty(), + $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( + static fn (Resource $r): bool => null !== $r->getThirdParty() + )->toArray() + ) ) - ) - )]; + )]; $options = $template->getOptions(); if ($options['thirdParty'] ?? false) { diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php index a5f245596..b061ec1c9 100644 --- a/src/Bundle/ChillReportBundle/Controller/ReportController.php +++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ReportBundle\Controller; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Entity\Person; @@ -113,10 +114,9 @@ class ReportController extends AbstractController { $em = $this->managerRegistry->getManager(); - /** @var Report $report */ $report = $em->getRepository(Report::class)->find($report_id); - if (null == $report) { + if (null === $report) { throw $this->createNotFoundException($this->translator->trans('Unable to find this report.')); } @@ -253,7 +253,11 @@ class ReportController extends AbstractController } $entity = new Report(); - $entity->setUser($this->tokenStorage->getToken()->getUser()); + $user = $this->tokenStorage->getToken()->getUser(); + if (!$user instanceof User) { + throw $this->createAccessDeniedException(); + } + $entity->setUser($user); $entity->setDate(new \DateTime('now')); $entity->setCFGroup($cFGroup); @@ -312,7 +316,7 @@ class ReportController extends AbstractController } $form = $this->formFactory - ->createNamedBuilder(null, FormType::class, null, [ + ->createNamedBuilder('', FormType::class, null, [ 'method' => 'GET', 'csrf_protection' => false, ]) @@ -359,7 +363,7 @@ class ReportController extends AbstractController } $form = $this->formFactory - ->createNamedBuilder(null, FormType::class, null, [ + ->createNamedBuilder('', FormType::class, null, [ 'method' => 'GET', 'csrf_protection' => false, ]) diff --git a/src/Bundle/ChillReportBundle/Entity/Report.php b/src/Bundle/ChillReportBundle/Entity/Report.php index 0b9017b78..f5a58b470 100644 --- a/src/Bundle/ChillReportBundle/Entity/Report.php +++ b/src/Bundle/ChillReportBundle/Entity/Report.php @@ -34,7 +34,7 @@ class Report implements HasCenterInterface, HasScopeInterface #[ORM\ManyToOne(targetEntity: CustomFieldsGroup::class)] private ?CustomFieldsGroup $cFGroup = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] private ?\DateTime $date = null; #[ORM\Id] diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index 4fdf93653..0ce074c1c 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -331,7 +331,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface switch ($f) { case 'person_countryOfBirth': case 'person_nationality': - $suffix = substr((string) $f, 7); + $suffix = substr($f, 7); $qb->addSelect(sprintf('IDENTITY(person.%s) as %s', $suffix, $f)); break; @@ -344,7 +344,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface case 'person_address_country_name': case 'person_address_country_code': // remove 'person_' - $suffix = substr((string) $f, 7); + $suffix = substr($f, 7); $qb->addSelect(sprintf( 'GET_PERSON_ADDRESS_%s(person.id, :address_date) AS %s', @@ -367,8 +367,8 @@ class ReportList implements ExportElementValidatedInterface, ListInterface break; default: - $prefix = substr((string) $f, 0, 7); - $suffix = substr((string) $f, 7); + $prefix = substr($f, 0, 7); + $suffix = substr($f, 7); match ($prefix) { 'person_' => $qb->addSelect(sprintf('person.%s as %s', $suffix, $f)), diff --git a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php index 7d5a47a1b..e9bb5353e 100644 --- a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php @@ -61,7 +61,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface private string $title = ''; #[Serializer\Groups(['read'])] - #[ORM\Column(name: 'type', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] + #[ORM\Column(name: 'type', type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $type = null; public function getAssignee(): ?User diff --git a/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php b/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php index 6050a9777..ae8de4cad 100644 --- a/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php @@ -22,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Table(name: 'chill_task.recurring_task')] class RecurringTask extends AbstractTask { - #[ORM\Column(name: 'first_occurence_end_date', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)] + #[ORM\Column(name: 'first_occurence_end_date', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)] private ?\DateTime $firstOccurenceEndDate = null; #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] @@ -30,10 +30,10 @@ class RecurringTask extends AbstractTask #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - #[ORM\Column(name: 'last_occurence_end_date', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)] + #[ORM\Column(name: 'last_occurence_end_date', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)] private ?\DateTime $lastOccurenceEndDate = null; - #[ORM\Column(name: 'occurence_frequency', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] + #[ORM\Column(name: 'occurence_frequency', type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $occurenceFrequency = null; #[ORM\Column(name: 'occurence_start_date', type: \Doctrine\DBAL\Types\Types::DATEINTERVAL)] diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 43e1c0ebb..c2cae44e4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -112,7 +112,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * This field is read-only, and is generated on database side. */ #[ORM\Column(name: 'canonicalized', type: Types::TEXT, nullable: false, options: ['default' => ''])] - private ?string $canonicalized = ''; + private string $canonicalized = ''; /** * @var Collection @@ -166,7 +166,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] #[ORM\Column(name: 'firstname', type: Types::TEXT, nullable: false, options: ['default' => ''])] - private ?string $firstname = ''; + private string $firstname = ''; #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] #[ORM\Column(name: 'id', type: Types::INTEGER)] diff --git a/src/Bundle/ChillTicketBundle/src/Command/ImportTicketMotiveConfigurationCommand.php b/src/Bundle/ChillTicketBundle/src/Command/ImportTicketMotiveConfigurationCommand.php index e315db8ff..3cfdb4e8d 100644 --- a/src/Bundle/ChillTicketBundle/src/Command/ImportTicketMotiveConfigurationCommand.php +++ b/src/Bundle/ChillTicketBundle/src/Command/ImportTicketMotiveConfigurationCommand.php @@ -28,9 +28,6 @@ final readonly class ImportTicketMotiveConfigurationCommand string $lang, OutputInterface $output, ): int { - $directory = (string) $directory; - $lang = (string) $lang; - $this->importMotivesFromDirectory->import($directory, $lang); $output->writeln('Ticket motives import completed successfully.'); diff --git a/src/Bundle/ChillTicketBundle/src/Controller/Admin/MotiveController.php b/src/Bundle/ChillTicketBundle/src/Controller/Admin/MotiveController.php index 891f82d07..47246f7ae 100644 --- a/src/Bundle/ChillTicketBundle/src/Controller/Admin/MotiveController.php +++ b/src/Bundle/ChillTicketBundle/src/Controller/Admin/MotiveController.php @@ -48,7 +48,5 @@ class MotiveController extends CRUDController $dto->applyToMotive($entity); } } - - parent::onFormValid($action, $entity, $form, $request); } } diff --git a/src/Bundle/ChillTicketBundle/src/Entity/Motive.php b/src/Bundle/ChillTicketBundle/src/Entity/Motive.php index a22898b14..b7bd61c5b 100644 --- a/src/Bundle/ChillTicketBundle/src/Entity/Motive.php +++ b/src/Bundle/ChillTicketBundle/src/Entity/Motive.php @@ -57,8 +57,8 @@ class Motive #[ORM\OneToMany(mappedBy: 'parent', targetEntity: Motive::class)] private Collection&Selectable $children; - #[ORM\Column(name: 'ordering', type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true, options: ['default' => '0.0'])] - private float $ordering = 0; + #[ORM\Column(name: 'ordering', type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: false, options: ['default' => '0.0'])] + private float $ordering = 0.0; public function __construct() { diff --git a/src/Bundle/ChillTicketBundle/src/Entity/PersonHistory.php b/src/Bundle/ChillTicketBundle/src/Entity/PersonHistory.php index 042b7395b..38df02f17 100644 --- a/src/Bundle/ChillTicketBundle/src/Entity/PersonHistory.php +++ b/src/Bundle/ChillTicketBundle/src/Entity/PersonHistory.php @@ -16,7 +16,8 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\Person; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Doctrine\ORM\Mapping\JoinColumn; +use Symfony\Component\Serializer\Attribute as Serializer; /** * Represents a history entity associated with a person and a ticket. @@ -46,6 +47,7 @@ class PersonHistory implements TrackCreationInterface public function __construct( #[ORM\ManyToOne(targetEntity: Person::class, fetch: 'EAGER')] + #[JoinColumn(nullable: false)] #[Serializer\Groups(['read'])] private Person $person, #[ORM\ManyToOne(targetEntity: Ticket::class)] diff --git a/src/Bundle/ChillTicketBundle/src/Messenger/Handler/PostTicketUpdateMessageHandler.php b/src/Bundle/ChillTicketBundle/src/Messenger/Handler/PostTicketUpdateMessageHandler.php index 88f082b58..23bfd6284 100644 --- a/src/Bundle/ChillTicketBundle/src/Messenger/Handler/PostTicketUpdateMessageHandler.php +++ b/src/Bundle/ChillTicketBundle/src/Messenger/Handler/PostTicketUpdateMessageHandler.php @@ -16,11 +16,10 @@ use Chill\TicketBundle\Messenger\PostTicketUpdateMessage; use Chill\TicketBundle\Repository\TicketRepositoryInterface; use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; -use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; #[AsMessageHandler] -final readonly class PostTicketUpdateMessageHandler implements MessageHandlerInterface +final readonly class PostTicketUpdateMessageHandler { public function __construct( private EventDispatcherInterface $eventDispatcher, diff --git a/src/Bundle/ChillTicketBundle/src/Serializer/Normalizer/TicketNormalizer.php b/src/Bundle/ChillTicketBundle/src/Serializer/Normalizer/TicketNormalizer.php index 8a45e09a4..740ec5095 100644 --- a/src/Bundle/ChillTicketBundle/src/Serializer/Normalizer/TicketNormalizer.php +++ b/src/Bundle/ChillTicketBundle/src/Serializer/Normalizer/TicketNormalizer.php @@ -52,8 +52,8 @@ final class TicketNormalizer implements NormalizerInterface, NormalizerAwareInte 'currentAddressees' => $this->normalizer->normalize($object->getCurrentAddressee(), $format, ['groups' => 'read']), 'currentInputs' => $this->normalizer->normalize($object->getCurrentInputs(), $format, ['groups' => 'read']), 'currentMotive' => $this->normalizer->normalize($object->getMotive(), $format, ['groups' => ['read', MotiveNormalizer::GROUP_CHILDREN_TO_PARENT]]), - 'currentState' => $object->getState()?->value ?? 'open', - 'emergency' => $object->getEmergencyStatus()?->value ?? 'no', + 'currentState' => $object->getState()->value ?? 'open', + 'emergency' => $object->getEmergencyStatus()->value ?? 'no', 'caller' => $this->normalizer->normalize($object->getCaller(), $format, ['groups' => 'read']), ];