From 5b2a2a1bc5699f04530eb843918c56331c004e73 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 13 Dec 2023 17:45:08 +0100 Subject: [PATCH 01/42] Add WithParticipationBetweenDatesFilter to ChillPersonBundle This update adds a new filter, WithParticipationBetweenDatesFilter, to the ChillPersonBundle. This filter helps to find persons who participated in any parcours between specified date ranges. Additionally, relevant French translations have been updated and the filter has been registered in the services configuration file. --- .../WithParticipationBetweenDatesFilter.php | 96 +++++++++++++++++++ .../config/services/exports_person.yaml | 4 + .../translations/messages.fr.yml | 4 + 3 files changed, 104 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php new file mode 100644 index 000000000..52d788894 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -0,0 +1,96 @@ +andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". + "WHERE {$p}_acpp.person = person ". + "AND OVERLAPSI (acpp.startDate, acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = 'TRUE' ") + ) + ->setParameter("{$p}_date_after", $this->rollingDateConverter->convert($data['date_after']), Types::DATE_IMMUTABLE) + ->setParameter("{$p}_date_before", $this->rollingDateConverter->convert($data['date_before']), Types::DATE_IMMUTABLE); + + } + + public function applyOn(): string + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('date_after', PickRollingDateType::class, [ + 'label' => 'export.filter.person.with_participation_between_dates.date_after', + ]); + + $builder->add('date_before', PickRollingDateType::class, [ + 'label' => 'export.filter.person.with_participation_between_dates.date_before', + ]); + } + + public function getFormDefaultData(): array + { + return [ + 'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_before' => new RollingDate(RollingDate::T_TODAY), + ]; + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by participations during period: between %dateafter% and %datebefore%', [ + '%dateafter%' => $this->rollingDateConverter->convert($data['date_after'])->format('d-m-Y'), + '%datebefore%' => $this->rollingDateConverter->convert($data['date_before'])->format('d-m-Y'), + ]]; + } + + public function getTitle() + { + return 'export.filter.person.with_participation_between_dates.title'; + } + +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index d25a3b9e6..c0ed03115 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -116,6 +116,10 @@ services: tags: - { name: chill.export_filter, alias: person_without_household_composition_filter } + Chill\PersonBundle\Export\Filter\PersonFilters\WithParticipationBetweenDatesFilter: + tags: + - { name: chill.export_filter, alias: person_with_participation_between_dates_filter } + ## Aggregators chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 82c538c69..578bdb8d0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1142,6 +1142,10 @@ export: Filtered by person\'s address status computed at %datecalc%, only %statuses%: Filtré par comparaison à l'adresse de référence, calculé à %datecalc%, seulement %statuses% Status: Statut Address at date: Adresse à la date + with_participation_between_dates: + date_after: Concerné par un parcours après le + date_before: Concerné par un parcours avant le + title: Filtrer les usagers ayant été associés à un parcours ouverts un jour dans la période de temps indiquée course: having_info_within_interval: From b9890d13026b0fc3a99455630d31303e5e32858c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 10:33:30 +0100 Subject: [PATCH 02/42] Minor fixes --- .../WithParticipationBetweenDatesFilter.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 52d788894..121abb8d0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -46,14 +46,19 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf $qb ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". - "WHERE {$p}_acpp.person = person ". - "AND OVERLAPSI (acpp.startDate, acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = 'TRUE' ") + $qb->expr()->andX( + $qb->expr()->exists( + "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp ". + "WHERE {$p}_acp.person = person ". + "AND OVERLAPSI ({$p}_acp.openingDate, {$p}_acp.closingDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE"), + $qb->expr()->exists( + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". + "WHERE {$p}_acpp.person = person ". + "AND OVERLAPSI ({$p}_acpp.startDate, {$p}_acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE") + ) ) ->setParameter("{$p}_date_after", $this->rollingDateConverter->convert($data['date_after']), Types::DATE_IMMUTABLE) ->setParameter("{$p}_date_before", $this->rollingDateConverter->convert($data['date_before']), Types::DATE_IMMUTABLE); - } public function applyOn(): string @@ -75,7 +80,7 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf public function getFormDefaultData(): array { return [ - 'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_after' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), 'date_before' => new RollingDate(RollingDate::T_TODAY), ]; } From 044bab45ad3f8443679fc4ff29a61dccfb177f80 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 15:29:59 +0100 Subject: [PATCH 03/42] Fix query : was missing parenthesis. --- .../WithParticipationBetweenDatesFilter.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 121abb8d0..ab921c895 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; @@ -46,16 +47,14 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf $qb ->andWhere( - $qb->expr()->andX( + $qb->expr()->exists( - "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp ". + "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp JOIN {$p}_acp.accompanyingPeriod {$p}_acpp ". "WHERE {$p}_acp.person = person ". - "AND OVERLAPSI ({$p}_acp.openingDate, {$p}_acp.closingDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE"), - $qb->expr()->exists( - 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". - "WHERE {$p}_acpp.person = person ". - "AND OVERLAPSI ({$p}_acpp.startDate, {$p}_acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE") - ) + "AND OVERLAPSI({$p}_acp.startDate, {$p}_acp.endDate), (:{$p}_date_after, :{$p}_date_before) = TRUE ". + "AND OVERLAPSI({$p}_acpp.openingDate, {$p}_acpp.closingDate), (:{$p}_date_after, :{$p}_date_before) = TRUE") + + ) ->setParameter("{$p}_date_after", $this->rollingDateConverter->convert($data['date_after']), Types::DATE_IMMUTABLE) ->setParameter("{$p}_date_before", $this->rollingDateConverter->convert($data['date_before']), Types::DATE_IMMUTABLE); From 34cbd2605c0e8da0ab8bc887b0bc4d772c21f8c2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 15:32:04 +0100 Subject: [PATCH 04/42] Add a changie --- .changes/unreleased/Feature-20231218-153151.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Feature-20231218-153151.yaml diff --git a/.changes/unreleased/Feature-20231218-153151.yaml b/.changes/unreleased/Feature-20231218-153151.yaml new file mode 100644 index 000000000..8a842bfa2 --- /dev/null +++ b/.changes/unreleased/Feature-20231218-153151.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Create new filter for persons having a participation in an accompanying period + during a certain time span +time: 2023-12-18T15:31:51.489901829+01:00 +custom: + Issue: "231" From c06c861e175819c0ad294f97ffb117856e888462 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 15:38:20 +0100 Subject: [PATCH 05/42] Php cs fixes --- .../WithParticipationBetweenDatesFilter.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 121abb8d0..48c44463a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -11,27 +11,19 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\PersonFilters; -use Chill\ActivityBundle\Entity\Activity; -use Chill\ActivityBundle\Entity\ActivityReason; -use Chill\ActivityBundle\Repository\ActivityReasonRepository; -use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; -use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Validator\Context\ExecutionContextInterface; final readonly class WithParticipationBetweenDatesFilter implements FilterInterface { public function __construct( - private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, ) {} @@ -48,13 +40,15 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf ->andWhere( $qb->expr()->andX( $qb->expr()->exists( - "SELECT 1 FROM ".AccompanyingPeriodParticipation::class." {$p}_acp ". + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acp ". "WHERE {$p}_acp.person = person ". - "AND OVERLAPSI ({$p}_acp.openingDate, {$p}_acp.closingDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE"), + "AND OVERLAPSI ({$p}_acp.openingDate, {$p}_acp.closingDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE" + ), $qb->expr()->exists( 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." {$p}_acpp ". "WHERE {$p}_acpp.person = person ". - "AND OVERLAPSI ({$p}_acpp.startDate, {$p}_acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE") + "AND OVERLAPSI ({$p}_acpp.startDate, {$p}_acpp.endDate), (:{$p}_date_after), :{$p}_date_before)) = TRUE" + ) ) ) ->setParameter("{$p}_date_after", $this->rollingDateConverter->convert($data['date_after']), Types::DATE_IMMUTABLE) @@ -97,5 +91,4 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf { return 'export.filter.person.with_participation_between_dates.title'; } - } From d2a31de1be42d1385b338c5b4ddf37699d404ccf Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 17:04:16 +0100 Subject: [PATCH 06/42] Add a missing translation for the filter description --- .../PersonFilters/WithParticipationBetweenDatesFilter.php | 2 +- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 71b79ba54..289af5f07 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -75,7 +75,7 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf public function describeAction($data, $format = 'string') { - return ['Filtered by participations during period: between %dateafter% and %datebefore%', [ + return ['export.filter.person.with_participation_between_dates.Filtered by participations during period: between %dateafter% and %datebefore%', [ '%dateafter%' => $this->rollingDateConverter->convert($data['date_after'])->format('d-m-Y'), '%datebefore%' => $this->rollingDateConverter->convert($data['date_before'])->format('d-m-Y'), ]]; diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 578bdb8d0..783bc6be0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1146,6 +1146,7 @@ export: date_after: Concerné par un parcours après le date_before: Concerné par un parcours avant le title: Filtrer les usagers ayant été associés à un parcours ouverts un jour dans la période de temps indiquée + 'Filtered by participations during period: between %dateafter% and %datebefore%': 'Filtré par personne concerné par un parcours dans la periode entre: %dateafter% et %datebefore%' course: having_info_within_interval: From f103b228e42889c1dcda0c406287c65d16f4bac3 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 17:04:42 +0100 Subject: [PATCH 07/42] Create test for the participationBetweenDatesFilter --- ...ithParticipationBetweenDatesFilterTest.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php new file mode 100644 index 000000000..bbca0e8bb --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php @@ -0,0 +1,58 @@ +filter = self::$container->get(WithParticipationBetweenDatesFilter::class); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData() + { + return [ + [ + 'date_after' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), + 'date_before' => new RollingDate(RollingDate::T_TODAY), + ], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('person.id') + ->from(Person::class, 'person'), + ]; + } +} From 469e379166f587be917dcb66bb95c9e2e2f832b7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Dec 2023 17:05:18 +0100 Subject: [PATCH 08/42] php cs fixes --- ...ithParticipationBetweenDatesFilterTest.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php index bbca0e8bb..d9c58e743 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get(WithParticipationBetweenDatesFilter::class); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData() { return [ @@ -40,9 +48,6 @@ final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest ]; } - /** - * @inheritDoc - */ public function getQueryBuilders() { self::bootKernel(); From 27ce322690e45ccf7f6ea9705d5b1f21b3f84c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 22 Jan 2024 12:14:39 +0100 Subject: [PATCH 09/42] upgrade php-cs-fixer to 3.47.0 --- .../src/Entity/AsideActivity.php | 8 ++++---- .../ChillCustomFieldsBundle/Entity/CustomField.php | 2 +- .../Entity/CustomFieldLongChoice/Option.php | 2 +- .../Entity/CustomFieldsDefaultGroup.php | 2 +- .../Tests/Service/CustomFieldsHelperTest.php | 2 +- src/Bundle/ChillDocStoreBundle/Entity/Document.php | 6 +++--- .../ChillDocStoreBundle/Entity/PersonDocument.php | 2 +- .../Controller/ParticipationController.php | 2 +- src/Bundle/ChillEventBundle/Entity/Event.php | 8 ++++---- .../ChillEventBundle/Entity/Participation.php | 8 ++++---- src/Bundle/ChillEventBundle/Entity/Role.php | 2 +- src/Bundle/ChillEventBundle/Entity/Status.php | 2 +- .../CRUD/Controller/ApiController.php | 2 +- .../ChillUserSendRenewPasswordCodeCommand.php | 4 ++-- .../DataFixtures/ORM/LoadAddressReferences.php | 2 +- .../DataFixtures/ORM/LoadCountries.php | 2 +- .../DataFixtures/ORM/LoadLanguages.php | 2 +- .../DataFixtures/ORM/LoadLocationType.php | 2 +- .../ChillMainBundle/DataFixtures/ORM/LoadUsers.php | 2 +- .../DependencyInjection/ChillMainExtension.php | 2 +- src/Bundle/ChillMainBundle/Entity/PostalCode.php | 4 ++-- .../ChillMainBundle/Entity/User/UserJobHistory.php | 4 ++-- .../Entity/User/UserScopeHistory.php | 4 ++-- .../Form/Type/ComposedRoleScopeType.php | 2 +- .../Phonenumber/PhonenumberHelper.php | 2 +- src/Bundle/ChillMainBundle/Routing/MenuTwig.php | 2 +- .../Security/Authorization/AuthorizationHelper.php | 6 +++--- .../Security/Resolver/ScopeResolverDispatcher.php | 2 +- .../Tests/Search/SearchProviderTest.php | 2 +- .../Normalizer/PhonenumberNormalizerTest.php | 2 +- .../DataFixtures/ORM/LoadCustomFields.php | 4 ++-- .../DependencyInjection/ChillPersonExtension.php | 12 ++++++------ .../AccompanyingPeriodLocationHistory.php | 10 +++++----- .../AccompanyingPeriodStepHistory.php | 2 +- .../AccompanyingPeriod/AccompanyingPeriodWork.php | 14 +++++++------- .../AccompanyingPeriodWorkGoal.php | 2 +- .../Entity/AccompanyingPeriod/Resource.php | 2 +- .../Entity/AccompanyingPeriod/UserHistory.php | 2 +- .../Entity/Household/PersonHouseholdAddress.php | 6 +++--- src/Bundle/ChillPersonBundle/Entity/Person.php | 14 +++++++------- .../Entity/Person/PersonCenterCurrent.php | 2 +- .../Entity/Person/PersonResource.php | 6 +++--- .../ChillPersonBundle/Entity/PersonAltName.php | 2 +- .../Entity/PersonNotDuplicate.php | 6 +++--- .../Entity/SocialWork/SocialAction.php | 8 ++++---- .../Entity/SocialWork/SocialIssue.php | 4 ++-- .../CreatorJobAggregator.php | 3 +-- .../Export/Helper/ListAccompanyingPeriodHelper.php | 2 ++ .../PersonControllerUpdateWithHiddenFieldsTest.php | 2 +- .../PersonControllerViewWithHiddenFieldsTest.php | 2 +- ...mpanyingPeriodWorkAssociatePersonOnWorkTest.php | 2 +- src/Bundle/ChillReportBundle/Entity/Report.php | 8 ++++---- .../Tests/Timeline/TimelineProviderTest.php | 2 +- .../migrations/Version20150622233319.php | 2 +- src/Bundle/ChillTaskBundle/Entity/AbstractTask.php | 8 ++++---- src/Bundle/ChillTaskBundle/Entity/SingleTask.php | 2 +- .../Entity/Task/AbstractTaskPlaceEvent.php | 2 +- .../Entity/Task/SingleTaskPlaceEvent.php | 2 +- 58 files changed, 114 insertions(+), 113 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index 2bb8a985d..f43a0fdfb 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -32,7 +32,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface * * @Assert\NotBlank */ - private \Chill\MainBundle\Entity\User $agent; + private User $agent; /** * @ORM\Column(type="datetime") @@ -44,7 +44,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface * * @ORM\JoinColumn(nullable=false) */ - private \Chill\MainBundle\Entity\User $createdBy; + private User $createdBy; /** * @ORM\Column(type="datetime") @@ -82,7 +82,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface * * @ORM\JoinColumn(nullable=false) */ - private ?\Chill\AsideActivityBundle\Entity\AsideActivityCategory $type = null; + private ?AsideActivityCategory $type = null; /** * @ORM\Column(type="datetime", nullable=true) @@ -92,7 +92,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\ManyToOne(targetEntity=User::class) */ - private \Chill\MainBundle\Entity\User $updatedBy; + private User $updatedBy; public function getAgent(): ?User { diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index b75d23e5e..93eeafdea 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -38,7 +38,7 @@ class CustomField * targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup", * inversedBy="customFields") */ - private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null; + private ?CustomFieldsGroup $customFieldGroup = null; /** * @ORM\Id diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index b6f371c8e..a17bb5aaf 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -63,7 +63,7 @@ class Option * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option $parent = null; + private ?Option $parent = null; /** * A json representation of text (multilingual). diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php index fbf100a95..cb5f8da7a 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php @@ -33,7 +33,7 @@ class CustomFieldsDefaultGroup * * sf4 check: option inversedBy="customFields" return inconsistent error mapping !! */ - private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldsGroup = null; + private ?CustomFieldsGroup $customFieldsGroup = null; /** * @ORM\Column(type="string", length=255) diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php index 310e64b62..6d3abbc66 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php @@ -25,7 +25,7 @@ final class CustomFieldsHelperTest extends KernelTestCase { private ?object $cfHelper = null; - private \Chill\CustomFieldsBundle\Entity\CustomField $randomCFText; + private CustomField $randomCFText; protected function setUp(): void { diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php index e4990b1b8..d4d6dc945 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php @@ -37,7 +37,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface * @ORM\JoinColumn(name="category_id_inside_bundle", referencedColumnName="id_inside_bundle") * }) */ - private ?\Chill\DocStoreBundle\Entity\DocumentCategory $category = null; + private ?DocumentCategory $category = null; /** * @ORM\Column(type="datetime") @@ -61,12 +61,12 @@ class Document implements TrackCreationInterface, TrackUpdateInterface * message="Upload a document" * ) */ - private ?\Chill\DocStoreBundle\Entity\StoredObject $object = null; + private ?StoredObject $object = null; /** * @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate") */ - private ?\Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate $template = null; + private ?DocGeneratorTemplate $template = null; /** * @ORM\Column(type="text") diff --git a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php index 40b1a73b8..84056a3b9 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php @@ -43,7 +43,7 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt * * @var Scope The document's center */ - private ?\Chill\MainBundle\Entity\Scope $scope = null; + private ?Scope $scope = null; public function getCenter() { diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index b0ce372ff..9785c20b0 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -548,7 +548,7 @@ class ParticipationController extends AbstractController Request $request, Participation $participation, bool $multiple = false - ): array|\Chill\EventBundle\Entity\Participation { + ): array|Participation { $em = $this->getDoctrine()->getManager(); if ($em->contains($participation)) { diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 5ecc97afd..9d7b4d935 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -35,12 +35,12 @@ class Event implements HasCenterInterface, HasScopeInterface /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center") */ - private ?\Chill\MainBundle\Entity\Center $center = null; + private ?Center $center = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") */ - private ?\Chill\MainBundle\Entity\Scope $circle = null; + private ?Scope $circle = null; /** * @ORM\Column(type="datetime") @@ -59,7 +59,7 @@ class Event implements HasCenterInterface, HasScopeInterface /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") */ - private ?\Chill\MainBundle\Entity\User $moderator = null; + private ?User $moderator = null; /** * @ORM\Column(type="string", length=150) @@ -78,7 +78,7 @@ class Event implements HasCenterInterface, HasScopeInterface /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType") */ - private ?\Chill\EventBundle\Entity\EventType $type = null; + private ?EventType $type = null; /** * Event constructor. diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 8dda85c99..37899262f 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -37,7 +37,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa * targetEntity="Chill\EventBundle\Entity\Event", * inversedBy="participations") */ - private ?\Chill\EventBundle\Entity\Event $event = null; + private ?Event $event = null; /** * @ORM\Id @@ -56,17 +56,17 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") */ - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Role") */ - private ?\Chill\EventBundle\Entity\Role $role = null; + private ?Role $role = null; /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status") */ - private ?\Chill\EventBundle\Entity\Status $status = null; + private ?Status $status = null; /** * @return Center diff --git a/src/Bundle/ChillEventBundle/Entity/Role.php b/src/Bundle/ChillEventBundle/Entity/Role.php index 3d2264d2f..d0e07021e 100644 --- a/src/Bundle/ChillEventBundle/Entity/Role.php +++ b/src/Bundle/ChillEventBundle/Entity/Role.php @@ -50,7 +50,7 @@ class Role * targetEntity="Chill\EventBundle\Entity\EventType", * inversedBy="roles") */ - private ?\Chill\EventBundle\Entity\EventType $type = null; + private ?EventType $type = null; /** * Get active. diff --git a/src/Bundle/ChillEventBundle/Entity/Status.php b/src/Bundle/ChillEventBundle/Entity/Status.php index 22fe8e3ed..3c4237eb5 100644 --- a/src/Bundle/ChillEventBundle/Entity/Status.php +++ b/src/Bundle/ChillEventBundle/Entity/Status.php @@ -50,7 +50,7 @@ class Status * targetEntity="Chill\EventBundle\Entity\EventType", * inversedBy="statuses") */ - private ?\Chill\EventBundle\Entity\EventType $type = null; + private ?EventType $type = null; /** * Get active. diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index 345da5bc5..78bdc96d5 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -175,7 +175,7 @@ class ApiController extends AbstractCRUDController public function indexApi(Request $request, string $_format) { return match ($request->getMethod()) { - Request::METHOD_GET, REQUEST::METHOD_HEAD => $this->indexApiAction('_index', $request, $_format), + Request::METHOD_GET, Request::METHOD_HEAD => $this->indexApiAction('_index', $request, $_format), default => throw $this->createNotFoundException('This method is not supported'), }; } diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index 0c68798f9..da14d85ff 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -57,12 +57,12 @@ class ChillUserSendRenewPasswordCodeCommand extends Command /** * The current input interface. */ - private ?\Symfony\Component\Console\Input\InputInterface $input = null; + private ?InputInterface $input = null; /** * The current output interface. */ - private ?\Symfony\Component\Console\Output\OutputInterface $output = null; + private ?OutputInterface $output = null; public function __construct( LoggerInterface $logger, diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php index f95a3cf66..68f16cd01 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php @@ -26,7 +26,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt { protected $faker; - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; public function __construct() { diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php index 4f0d24501..9f36a315e 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php @@ -23,7 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class LoadCountries extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface { - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; public function getOrder() { diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php index 54025cc2f..70c7e90a9 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php @@ -27,7 +27,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface, private array $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga', 'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ]; - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; // The regional version of language are language with _ in the code // This array contains regional code to not exclude diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php index 946632513..3058ed635 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php @@ -23,7 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class LoadLocationType extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface { - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; public function getOrder() { diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index d22da6b78..766d2246b 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -53,7 +53,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde ], ]; - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; public function getOrder() { diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 5c33ef1b3..b62f1f2d7 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -261,7 +261,7 @@ class ChillMainExtension extends Extension implements 'ST_X' => STX::class, 'ST_Y' => STY::class, 'GREATEST' => Greatest::class, - 'LEAST' => LEAST::class, + 'LEAST' => Least::class, ], 'datetime_functions' => [ 'EXTRACT' => Extract::class, diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 5aba8030c..b4c246bd5 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -59,7 +59,7 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * * @groups({"read"}) */ - private ?\Chill\MainBundle\Doctrine\Model\Point $center = null; + private ?Point $center = null; /** * @ORM\Column(type="string", length=100) @@ -73,7 +73,7 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * * @groups({"write", "read"}) */ - private ?\Chill\MainBundle\Entity\Country $country = null; + private ?Country $country = null; /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php index 7916d9891..6bda2afec 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php @@ -84,7 +84,7 @@ class UserJobHistory return $this; } - public function setJob(?UserJob $job): UserJobHistory + public function setJob(?UserJob $job): User\UserJobHistory { $this->job = $job; @@ -98,7 +98,7 @@ class UserJobHistory return $this; } - public function setUser(User $user): UserJobHistory + public function setUser(User $user): User\UserJobHistory { $this->user = $user; diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php index 6ac768de2..a82599ed6 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php @@ -84,7 +84,7 @@ class UserScopeHistory return $this; } - public function setScope(?Scope $scope): UserScopeHistory + public function setScope(?Scope $scope): User\UserScopeHistory { $this->scope = $scope; @@ -98,7 +98,7 @@ class UserScopeHistory return $this; } - public function setUser(User $user): UserScopeHistory + public function setUser(User $user): User\UserScopeHistory { $this->user = $user; diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php index 6b87ed6ef..f4b4da609 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php @@ -26,7 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class ComposedRoleScopeType extends AbstractType { - private readonly \Chill\MainBundle\Security\RoleProvider $roleProvider; + private readonly RoleProvider $roleProvider; /** * @var string[] diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index 462f379cf..9006268bd 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -33,7 +33,7 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface private bool $isConfigured = false; - private readonly PhonenumberUtil $phoneNumberUtil; + private readonly PhoneNumberUtil $phoneNumberUtil; private Client $twilioClient; diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index 39e35c040..2989187a8 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -22,7 +22,7 @@ use Twig\TwigFunction; */ class MenuTwig extends AbstractExtension implements ContainerAwareInterface { - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; /** * the default parameters for chillMenu. diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index 6d9454fe0..7e5d8a325 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -61,7 +61,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @return User[] */ - public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, array|\Chill\MainBundle\Entity\Scope $scope = null, bool $onlyEnabled = true): array + public function findUsersReaching(string $role, array|Center $center, array|Scope $scope = null, bool $onlyEnabled = true): array { return $this->userACLAwareRepository ->findUsersByReachedACL($role, $center, $scope, $onlyEnabled); @@ -126,7 +126,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @return Scope[] */ - public function getReachableCircles(UserInterface $user, string $role, array|\Chill\MainBundle\Entity\Center $center) + public function getReachableCircles(UserInterface $user, string $role, array|Center $center) { $scopes = []; @@ -168,7 +168,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @param Center|Center[] $center May be an array of center */ - public function userCanReachCenter(User $user, array|\Chill\MainBundle\Entity\Center $center): bool + public function userCanReachCenter(User $user, array|Center $center): bool { if ($center instanceof \Traversable) { foreach ($center as $c) { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index a3298eab5..ce1e16862 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -37,7 +37,7 @@ final readonly class ScopeResolverDispatcher /** * @return Scope|iterable|Scope|null */ - public function resolveScope(mixed $entity, ?array $options = []): null|\Chill\MainBundle\Entity\Scope|iterable + public function resolveScope(mixed $entity, ?array $options = []): null|iterable|Scope { foreach ($this->resolvers as $resolver) { if ($resolver->supports($entity, $options)) { diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php index b8ce37fff..d1602f7e2 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php @@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase; */ final class SearchProviderTest extends TestCase { - private \Chill\MainBundle\Search\SearchProvider $search; + private SearchProvider $search; protected function setUp(): void { diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php index eda761dc1..583dfc4cc 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php @@ -40,7 +40,7 @@ final class PhonenumberNormalizerTest extends TestCase /** * @dataProvider dataProviderNormalizePhonenumber */ - public function testNormalize(?Phonenumber $phonenumber, mixed $format, mixed $context, mixed $expected) + public function testNormalize(?PhoneNumber $phonenumber, mixed $format, mixed $context, mixed $expected) { $parameterBag = $this->prophesize(ParameterBagInterface::class); $parameterBag->get(Argument::exact('chill_main'))->willReturn(['phone_helper' => ['default_carrier_code' => 'BE']]); diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php index 47548ff2c..baf18cebc 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php @@ -25,9 +25,9 @@ use Doctrine\Persistence\ObjectManager; class LoadCustomFields extends AbstractFixture implements OrderedFixtureInterface { - private ?\Chill\CustomFieldsBundle\Entity\CustomField $cfText = null; + private ?CustomField $cfText = null; - private ?\Chill\CustomFieldsBundle\Entity\CustomField $cfChoice = null; + private ?CustomField $cfChoice = null; /** * /** diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 18861e01f..3d5c0bc64 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -147,7 +147,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $container->prependExtensionConfig('chill_main', [ 'cruds' => [ [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, + 'class' => AccompanyingPeriod\ClosingMotive::class, 'name' => 'closing_motive', 'base_path' => '/admin/person/closing-motive', 'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class, @@ -168,7 +168,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class, + 'class' => AccompanyingPeriod\Origin::class, 'name' => 'origin', 'base_path' => '/admin/person/origin', 'form_class' => \Chill\PersonBundle\Form\OriginType::class, @@ -535,7 +535,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment::class, + 'class' => AccompanyingPeriod\Comment::class, 'name' => 'accompanying_period_comment', 'base_path' => '/api/1.0/person/accompanying-period/comment', 'base_role' => 'ROLE_USER', @@ -554,7 +554,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource::class, + 'class' => AccompanyingPeriod\Resource::class, 'name' => 'accompanying_period_resource', 'base_path' => '/api/1.0/person/accompanying-period/resource', 'base_role' => 'ROLE_USER', @@ -573,7 +573,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class, + 'class' => AccompanyingPeriod\Origin::class, 'name' => 'accompanying_period_origin', 'base_path' => '/api/1.0/person/accompanying-period/origin', 'controller' => \Chill\PersonBundle\Controller\OpeningApiController::class, @@ -718,7 +718,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork::class, + 'class' => AccompanyingPeriod\AccompanyingPeriodWork::class, 'name' => 'accompanying_period_work', 'base_path' => '/api/1.0/person/accompanying-course/work', 'controller' => \Chill\PersonBundle\Controller\AccompanyingCourseWorkApiController::class, diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php index 700076506..ab6e66f1c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php @@ -91,14 +91,14 @@ class AccompanyingPeriodLocationHistory implements TrackCreationInterface return $this->startDate; } - public function setAddressLocation(?Address $addressLocation): AccompanyingPeriodLocationHistory + public function setAddressLocation(?Address $addressLocation): AccompanyingPeriod\AccompanyingPeriodLocationHistory { $this->addressLocation = $addressLocation; return $this; } - public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriodLocationHistory + public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriod\AccompanyingPeriodLocationHistory { $this->endDate = $endDate; @@ -108,21 +108,21 @@ class AccompanyingPeriodLocationHistory implements TrackCreationInterface /** * @internal use AccompanyingPeriod::addLocationHistory */ - public function setPeriod(AccompanyingPeriod $period): AccompanyingPeriodLocationHistory + public function setPeriod(AccompanyingPeriod $period): AccompanyingPeriod\AccompanyingPeriodLocationHistory { $this->period = $period; return $this; } - public function setPersonLocation(?Person $personLocation): AccompanyingPeriodLocationHistory + public function setPersonLocation(?Person $personLocation): AccompanyingPeriod\AccompanyingPeriodLocationHistory { $this->personLocation = $personLocation; return $this; } - public function setStartDate(?\DateTimeImmutable $startDate): AccompanyingPeriodLocationHistory + public function setStartDate(?\DateTimeImmutable $startDate): AccompanyingPeriod\AccompanyingPeriodLocationHistory { $this->startDate = $startDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php index 15b2f0d2e..5a3ed774c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php @@ -108,7 +108,7 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda return $this; } - public function setStep(string $step): AccompanyingPeriodStepHistory + public function setStep(string $step): AccompanyingPeriod\AccompanyingPeriodStepHistory { $this->step = $step; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index a35dc3abf..afb4b1c82 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -255,7 +255,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues $this->referrersHistory = new ArrayCollection(); } - public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self + public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriod\AccompanyingPeriodWorkEvaluation $evaluation): self { if (!$this->accompanyingPeriodWorkEvaluations->contains($evaluation)) { $this->accompanyingPeriodWorkEvaluations[] = $evaluation; @@ -265,7 +265,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function addGoal(AccompanyingPeriodWorkGoal $goal): self + public function addGoal(AccompanyingPeriod\AccompanyingPeriodWorkGoal $goal): self { if (!$this->goals->contains($goal)) { $this->goals[] = $goal; @@ -288,7 +288,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues { if (!$this->getReferrers()->contains($referrer)) { $this->referrersHistory[] = - new AccompanyingPeriodWorkReferrerHistory($this, $referrer, new \DateTimeImmutable('today')); + new AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory($this, $referrer, new \DateTimeImmutable('today')); } return $this; @@ -393,8 +393,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function getReferrers(): ReadableCollection { $users = $this->referrersHistory - ->filter(fn (AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate()) - ->map(fn (AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()) + ->filter(fn (AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate()) + ->map(fn (AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()) ->getValues() ; @@ -452,7 +452,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this->updatedBy; } - public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self + public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriod\AccompanyingPeriodWorkEvaluation $evaluation): self { $this->accompanyingPeriodWorkEvaluations ->removeElement($evaluation); @@ -461,7 +461,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function removeGoal(AccompanyingPeriodWorkGoal $goal): self + public function removeGoal(AccompanyingPeriod\AccompanyingPeriodWorkGoal $goal): self { if ($this->goals->removeElement($goal)) { // set the owning side to null (unless already changed) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php index a569f3a9d..c0a1528ad 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php @@ -35,7 +35,7 @@ class AccompanyingPeriodWorkGoal /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="goals") */ - private ?\Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork $accompanyingPeriodWork = null; + private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; /** * @ORM\ManyToOne(targetEntity=Goal::class) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index 515816637..99ef4f7da 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -107,7 +107,7 @@ class Resource /** * @Groups({"read"}) */ - public function getResource(): null|\Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty + public function getResource(): null|Person|ThirdParty { return $this->person ?? $this->thirdParty; } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php index 41b798a3f..29696cfe1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -86,7 +86,7 @@ class UserHistory implements TrackCreationInterface return $this->user; } - public function setEndDate(?\DateTimeImmutable $endDate): UserHistory + public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriod\UserHistory { $this->endDate = $endDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php b/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php index 453176334..529f3e0a6 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php @@ -52,7 +52,7 @@ class PersonHouseholdAddress * * @ORM\JoinColumn(nullable=false) */ - private ?\Chill\MainBundle\Entity\Address $address = null; + private ?Address $address = null; /** * @ORM\Id @@ -61,7 +61,7 @@ class PersonHouseholdAddress * * @ORM\JoinColumn(nullable=false) */ - private ?\Chill\PersonBundle\Entity\Household\Household $household = null; + private ?Household $household = null; /** * @ORM\Id @@ -70,7 +70,7 @@ class PersonHouseholdAddress * * @ORM\JoinColumn(nullable=false) */ - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @ORM\Column(type="date_immutable") diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index db06be0f4..050be3260 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -227,7 +227,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\MainBundle\Entity\Civility $civility = null; + private ?Civility $civility = null; /** * Contact information for contacting the person. @@ -245,7 +245,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\MainBundle\Entity\Country $countryOfBirth = null; + private ?Country $countryOfBirth = null; /** * @ORM\Column(type="datetime", nullable=true, options={"default": NULL}) @@ -257,7 +257,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\MainBundle\Entity\User $createdBy = null; + private ?User $createdBy = null; /** * Cache the computation of household. @@ -390,7 +390,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\PersonBundle\Entity\MaritalStatus $maritalStatus = null; + private ?MaritalStatus $maritalStatus = null; /** * Comment on marital status. @@ -433,7 +433,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @ORM\JoinColumn(nullable=true) */ - private ?\Chill\MainBundle\Entity\Country $nationality = null; + private ?Country $nationality = null; /** * Number of children. @@ -525,7 +525,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * targetEntity=User::class * ) */ - private ?\Chill\MainBundle\Entity\User $updatedBy = null; + private ?User $updatedBy = null; /** * Person constructor. @@ -1356,7 +1356,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI /** * @return PersonResource[]|Collection */ - public function getResources(): array|\Doctrine\Common\Collections\Collection + public function getResources(): array|Collection { return $this->resources; } diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php index 551f8fd03..3cc618af4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php @@ -63,7 +63,7 @@ class PersonCenterCurrent * * @internal Should not be instantied, unless inside Person entity */ - public function __construct(PersonCenterHistory $history) + public function __construct(Person\PersonCenterHistory $history) { $this->person = $history->getPerson(); $this->center = $history->getCenter(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index c5c2c8d08..7f0a3e978 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -71,7 +71,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * * @Groups({"read", "docgen:read"}) */ - private ?PersonResourceKind $kind = null; + private ?Person\PersonResourceKind $kind = null; /** * The person which host the owner of this resource. @@ -127,7 +127,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this->id; } - public function getKind(): ?PersonResourceKind + public function getKind(): ?Person\PersonResourceKind { return $this->kind; } @@ -196,7 +196,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setKind(?PersonResourceKind $kind): self + public function setKind(?Person\PersonResourceKind $kind): self { $this->kind = $kind; diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php index 9b6b24621..78d820298 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php @@ -52,7 +52,7 @@ class PersonAltName * inversedBy="altNames" * ) */ - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * Get id. diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php b/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php index ad0f4236f..7d296576c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php @@ -43,17 +43,17 @@ class PersonNotDuplicate /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") */ - private ?\Chill\PersonBundle\Entity\Person $person1 = null; + private ?Person $person1 = null; /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") */ - private ?\Chill\PersonBundle\Entity\Person $person2 = null; + private ?Person $person2 = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") */ - private ?\Chill\MainBundle\Entity\User $user = null; + private ?User $user = null; public function __construct() { diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 8361399f5..19fd7395b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -79,7 +79,7 @@ class SocialAction /** * @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="socialActions") */ - private ?\Chill\PersonBundle\Entity\SocialWork\SocialIssue $issue = null; + private ?SocialIssue $issue = null; /** * @ORM\Column(type="float", name="ordering", options={"default": 0.0}) @@ -89,7 +89,7 @@ class SocialAction /** * @ORM\ManyToOne(targetEntity=SocialAction::class, inversedBy="children") */ - private ?\Chill\PersonBundle\Entity\SocialWork\SocialAction $parent = null; + private ?SocialAction $parent = null; /** * @var Collection @@ -166,7 +166,7 @@ class SocialAction * * @return Collection|SocialAction[] a list with the elements of the given list which are parent of other elements in the given list */ - public static function findAncestorSocialActions(array|\Doctrine\Common\Collections\Collection $socialActions): Collection + public static function findAncestorSocialActions(array|Collection $socialActions): Collection { $ancestors = new ArrayCollection(); @@ -246,7 +246,7 @@ class SocialAction /** * @param Collection|SocialAction[] $socialActions */ - public static function getDescendantsWithThisForActions(array|\Doctrine\Common\Collections\Collection $socialActions): Collection + public static function getDescendantsWithThisForActions(array|Collection $socialActions): Collection { $unique = []; diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 12e1c1742..397e5a826 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -57,7 +57,7 @@ class SocialIssue /** * @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="children") */ - private ?\Chill\PersonBundle\Entity\SocialWork\SocialIssue $parent = null; + private ?SocialIssue $parent = null; /** * @var Collection @@ -115,7 +115,7 @@ class SocialIssue * * @return Collection|SocialIssue[] */ - public static function findAncestorSocialIssues(array|\Doctrine\Common\Collections\Collection $socialIssues): Collection + public static function findAncestorSocialIssues(array|Collection $socialIssues): Collection { $ancestors = new ArrayCollection(); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index 53906931a..bc2232a65 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserJobRepository; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -59,7 +58,7 @@ class CreatorJobAggregator implements AggregatorInterface ->leftJoin( UserJobHistory::class, "{$p}_jobHistory", - Expr\Join::WITH, + Join::WITH, $qb->expr()->andX( $qb->expr()->eq("{$p}_jobHistory.user", "{$p}_userHistory.createdBy"), // et si il est null ? $qb->expr()->andX( diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index 5865bb4da..9b8902ba6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -110,6 +110,8 @@ final readonly class ListAccompanyingPeriodHelper return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }, 'acpCreatedBy', 'acpUpdatedBy', 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acp.'.$key), + 'acpParticipantsPersons' => function ($value) { + }, 'locationPersonName', 'requestorPerson' => function ($value) use ($key) { if ('_header' === $value) { return 'export.list.acp.'.$key; diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php index a89f5adc7..db77c5672 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php @@ -34,7 +34,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase private ?object $em = null; - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @var string The url using for seeing the person's information diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php index 3fbbf667b..6463c246b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php @@ -23,7 +23,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase { private ?object $em = null; - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @var string The url to view the person details diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php index 6b6e7b7b4..6eb058f2c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWorkTest.php @@ -33,7 +33,7 @@ final class CountAccompanyingPeriodWorkAssociatePersonOnWorkTest extends Abstrac $em = self::$container->get(EntityManagerInterface::class); yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(true)); - yield new CountAccompanyingPeriodWorkAssociatePersonOnwork($em, $this->getParameters(false)); + yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(false)); } public function getFormData(): array diff --git a/src/Bundle/ChillReportBundle/Entity/Report.php b/src/Bundle/ChillReportBundle/Entity/Report.php index 1db2ed080..53878aa10 100644 --- a/src/Bundle/ChillReportBundle/Entity/Report.php +++ b/src/Bundle/ChillReportBundle/Entity/Report.php @@ -41,7 +41,7 @@ class Report implements HasCenterInterface, HasScopeInterface * @ORM\ManyToOne( * targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup") */ - private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $cFGroup = null; + private ?CustomFieldsGroup $cFGroup = null; /** * @ORM\Column(type="datetime") @@ -60,17 +60,17 @@ class Report implements HasCenterInterface, HasScopeInterface /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") */ - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") */ - private ?\Chill\MainBundle\Entity\Scope $scope = null; + private ?Scope $scope = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") */ - private ?\Chill\MainBundle\Entity\User $user = null; + private ?User $user = null; /** * @return Center diff --git a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php index ad6a16e57..d7a4054f7 100644 --- a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php @@ -28,7 +28,7 @@ final class TimelineProviderTest extends WebTestCase { private static ?object $em = null; - private \Chill\PersonBundle\Entity\Person $person; + private Person $person; /** * @var Report diff --git a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php index 15827738e..268335cbc 100644 --- a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php +++ b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php @@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; */ class Version20150622233319 extends AbstractMigration implements ContainerAwareInterface { - private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null; + private ?ContainerInterface $container = null; public function down(Schema $schema): void { diff --git a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php index 51ab8166d..948f9a81a 100644 --- a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php @@ -39,14 +39,14 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface * * @Serializer\Groups({"read"}) */ - private ?\Chill\MainBundle\Entity\User $assignee = null; + private ?User $assignee = null; /** * @ORM\ManyToOne( * targetEntity="\Chill\MainBundle\Entity\Scope" * ) */ - private ?\Chill\MainBundle\Entity\Scope $circle = null; + private ?Scope $circle = null; /** * @ORM\Column(name="closed", type="boolean", options={ "default": false }) @@ -60,7 +60,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface * * @Serializer\Groups({"read"}) */ - private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $course = null; + private ?AccompanyingPeriod $course = null; /** * @ORM\Column(name="current_states", type="json", options={"jsonb"=true, "default"="[]"}) @@ -83,7 +83,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface * * @Serializer\Groups({"read"}) */ - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @ORM\Column(name="title", type="text") diff --git a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php index 91dfeaf61..f5ed0d3b0 100644 --- a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php @@ -71,7 +71,7 @@ class SingleTask extends AbstractTask * inversedBy="singleTasks" * ) */ - private ?\Chill\TaskBundle\Entity\RecurringTask $recurringTask = null; + private ?RecurringTask $recurringTask = null; /** * @ORM\Column(name="start_date", type="date", nullable=true) diff --git a/src/Bundle/ChillTaskBundle/Entity/Task/AbstractTaskPlaceEvent.php b/src/Bundle/ChillTaskBundle/Entity/Task/AbstractTaskPlaceEvent.php index 8a47eda19..367bfbfb8 100644 --- a/src/Bundle/ChillTaskBundle/Entity/Task/AbstractTaskPlaceEvent.php +++ b/src/Bundle/ChillTaskBundle/Entity/Task/AbstractTaskPlaceEvent.php @@ -26,7 +26,7 @@ class AbstractTaskPlaceEvent * targetEntity="\Chill\MainBundle\Entity\User" * ) */ - private ?\Chill\MainBundle\Entity\User $author = null; + private ?User $author = null; /** * @ORM\Column(name="data", type="json") diff --git a/src/Bundle/ChillTaskBundle/Entity/Task/SingleTaskPlaceEvent.php b/src/Bundle/ChillTaskBundle/Entity/Task/SingleTaskPlaceEvent.php index 47e3eabfb..50f1dce64 100644 --- a/src/Bundle/ChillTaskBundle/Entity/Task/SingleTaskPlaceEvent.php +++ b/src/Bundle/ChillTaskBundle/Entity/Task/SingleTaskPlaceEvent.php @@ -48,7 +48,7 @@ class SingleTaskPlaceEvent extends AbstractTaskPlaceEvent * inversedBy="taskPlaceEvents" * ) */ - protected ?\Chill\TaskBundle\Entity\SingleTask $task = null; + protected ?SingleTask $task = null; public function getTask(): SingleTask { From 15a927a9f83c97b2376ae123fec67bca1a4d7195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 22 Jan 2024 12:46:20 +0100 Subject: [PATCH 10/42] [Export][List of accompanying periods] Add a list of persons, names and ids --- .../unreleased/Feature-20240122-124849.yaml | 6 +++++ .../Helper/ListAccompanyingPeriodHelper.php | 24 ++++++++++++++++++- .../translations/messages.fr.yml | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Feature-20240122-124849.yaml diff --git a/.changes/unreleased/Feature-20240122-124849.yaml b/.changes/unreleased/Feature-20240122-124849.yaml new file mode 100644 index 000000000..82703bd2c --- /dev/null +++ b/.changes/unreleased/Feature-20240122-124849.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: '[Export][List of accompanyign period] Add two columns: the list of persons + participating to the period, and their ids' +time: 2024-01-22T12:48:49.824833412+01:00 +custom: + Issue: "241" diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index 9b8902ba6..2c2bc1d02 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Export\Helper\ExportAddressHelper; use Chill\MainBundle\Export\Helper\UserHelper; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Repository\PersonRepository; @@ -40,6 +41,8 @@ final readonly class ListAccompanyingPeriodHelper 'closingDate', 'referrer', 'referrerSince', + 'acpParticipantPersons', + 'acpParticipantPersonsIds', 'administrativeLocation', 'locationIsPerson', 'locationIsTemp', @@ -79,6 +82,7 @@ final readonly class ListAccompanyingPeriodHelper private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator, private UserHelper $userHelper, + private LabelPersonHelper $labelPersonHelper, ) { } @@ -110,7 +114,20 @@ final readonly class ListAccompanyingPeriodHelper return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }, 'acpCreatedBy', 'acpUpdatedBy', 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acp.'.$key), - 'acpParticipantsPersons' => function ($value) { + + 'acpParticipantPersons' => $this->labelPersonHelper->getLabelMulti($key, $values, 'export.list.acp.'.$key), + 'acpParticipantPersonsIds' => function ($value) use ($key): string { + if ('_header' === $value) { + return 'export.list.acp.'.$key; + } + + if (null === $value || '' === $value) { + return ''; + } + + $keys = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); + + return implode('|', $keys); }, 'locationPersonName', 'requestorPerson' => function ($value) use ($key) { if ('_header' === $value) { @@ -224,6 +241,11 @@ final readonly class ListAccompanyingPeriodHelper ->addSelect(sprintf('%s_t.%s AS %s', $entity, $field, $entity)); } + // persons + $qb + ->addSelect(sprintf('(SELECT AGGREGATE(IDENTITY(participant_persons_n.person)) FROM %s participant_persons_n WHERE participant_persons_n.accompanyingPeriod = acp) AS acpParticipantPersons', AccompanyingPeriodParticipation::class)) + ->addSelect(sprintf('(SELECT AGGREGATE(IDENTITY(participant_persons_ids.person)) FROM %s participant_persons_ids WHERE participant_persons_ids.accompanyingPeriod = acp) AS acpParticipantPersonsIds', AccompanyingPeriodParticipation::class)); + // step at date $qb ->addSelect('stepHistory.step AS step') diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 82c538c69..60dd6b09b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1296,6 +1296,8 @@ export: socialIssues: Problématiques sociales requestorPerson: Demandeur (personne) requestorThirdParty: Demandeur (tiers) + acpParticipantPersons: Usagers concernés + acpParticipantPersonsIds: Usagers concernés (identifiants) eval: List of evaluations: Liste des évaluations From 7a126026990cbe080a7f429164ac636bc217459d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 23 Jan 2024 10:51:48 +0100 Subject: [PATCH 11/42] fix testContextGenerationDataNormalizeDenormalizeGetData The method `Relationship::getOpposite` does not only compare the object equality, but also the object id. --- .../Entity/Relationships/Relationship.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php index f736913ae..ce56fa013 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php @@ -147,10 +147,16 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface public function getOpposite(Person $counterpart): Person { if ($this->fromPerson !== $counterpart && $this->toPerson !== $counterpart) { - throw new \RuntimeException('the counterpart is neither the from nor to person for this relationship'); + // during tests, comparing using equality does not work. We have to compare the ids + if ( + ($this->fromPerson->getId() === $counterpart->getId() && $this->toPerson->getId() === $counterpart->getId()) + || null === $counterpart->getId() + ) { + throw new \RuntimeException(sprintf('the counterpart is neither the from nor to person for this relationship, expecting counterpart from %d and available %d and %d', $counterpart->getId(), $this->getFromPerson()->getId(), $this->getToPerson()->getId())); + } } - if ($this->fromPerson === $counterpart) { + if ($this->fromPerson === $counterpart || $this->fromPerson->getId() === $counterpart->getId()) { return $this->toPerson; } From 0bf6c07e8d3dfa7f9cae9ecd2a14da2e29ec48a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 23 Jan 2024 11:32:22 +0100 Subject: [PATCH 12/42] Add Symfony Deprecations Helper to Gitlab CI configuration The Gitlab CI configuration for the Chill Project has been updated to include the Symfony Deprecations Helper setting. This addition helps to avoid direct deprecations and provide a more efficient testing process. The helper is integrated using Symfony's PHPUnit bridge. --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e976a4d18..945d13532 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,8 @@ variables: DEFAULT_CARRIER_CODE: BE # force a timezone TZ: Europe/Brussels + # avoid direct deprecations (using symfony phpunit bridge: https://symfony.com/doc/4.x/components/phpunit_bridge.html#internal-deprecations + SYMFONY_DEPRECATIONS_HELPER: max[total]=99999999&max[self]=0&max[direct]=0&verbose=0 stages: - Composer install From 51ebc253aa752c83a4f11982a201a05adb771503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 24 Jan 2024 15:07:24 +0000 Subject: [PATCH 13/42] fix url of the base skeleton --- docs/source/installation/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index 9e6f2ed87..67a0b6ec6 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -48,7 +48,7 @@ Clone or download the chill-skeleton project and `cd` into the main directory. .. code-block:: bash - git clone https://gitlab.com/Chill-Projet/chill-skeleton-basic.git + git clone https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic.git cd chill-skeleton-basic From 036fe8d6f868d1878b5eba5900d7014e1ad2371a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 10:43:53 +0100 Subject: [PATCH 14/42] upgrade php-cs 3.49 --- .../ByActivityTypeAggregator.php | 2 +- .../Aggregator/ActivityPresenceAggregator.php | 2 +- .../Aggregator/ActivityTypeAggregator.php | 2 +- .../ActivityDocumentACLAwareRepository.php | 8 +- ...ityDocumentACLAwareRepositoryInterface.php | 4 +- .../Repository/ActivityPresenceRepository.php | 2 +- .../ActivityPresenceRepositoryInterface.php | 2 +- .../Repository/ActivityTypeRepository.php | 2 +- ...anyingPeriodActivityGenericDocProvider.php | 4 +- .../PersonActivityGenericDocProvider.php | 2 +- .../Authorization/ActivityVoterTest.php | 2 +- .../Controller/AsideActivityController.php | 2 +- .../AsideActivityCategoryRepository.php | 2 +- .../Entity/AbstractElement.php | 4 +- .../Repository/ChargeKindRepository.php | 2 +- .../ChargeKindRepositoryInterface.php | 2 +- .../Repository/ResourceKindRepository.php | 2 +- .../ResourceKindRepositoryInterface.php | 2 +- .../migrations/Version20221207105407.php | 2 +- .../Exception/UserAbsenceSyncException.php | 2 +- .../Connector/MSGraph/MSUserAbsenceReader.php | 2 +- .../MSGraph/MSUserAbsenceReaderInterface.php | 2 +- .../Connector/MSGraph/MachineHttpClient.php | 4 +- .../Connector/MSGraph/MapCalendarToUser.php | 4 +- .../MSGraph/OnBehalfOfUserHttpClient.php | 4 +- .../MSGraphRemoteCalendarConnector.php | 2 +- .../Connector/NullRemoteCalendarConnector.php | 2 +- .../RemoteCalendarConnectorInterface.php | 2 +- .../Repository/CalendarACLAwareRepository.php | 4 +- .../CalendarACLAwareRepositoryInterface.php | 4 +- .../Repository/CalendarDocRepository.php | 2 +- .../CalendarDocRepositoryInterface.php | 2 +- .../Repository/CalendarRangeRepository.php | 6 +- .../Repository/CalendarRepository.php | 10 +-- .../Repository/InviteRepository.php | 2 +- ...anyingPeriodCalendarGenericDocProvider.php | 4 +- .../PersonCalendarGenericDocProvider.php | 4 +- .../DocGenerator/CalendarContextTest.php | 4 +- .../CustomFieldsGroupController.php | 2 +- .../CustomFields/CustomFieldChoice.php | 4 +- .../Entity/CustomField.php | 2 +- .../Entity/CustomFieldLongChoice/Option.php | 2 +- .../Entity/CustomFieldsGroup.php | 2 +- .../Service/CustomFieldProvider.php | 2 +- .../GeneratorDriver/DriverInterface.php | 2 +- .../Exception/TemplateException.php | 2 +- .../GeneratorDriver/RelatorioDriver.php | 2 +- .../DocGeneratorTemplateRepository.php | 4 +- .../Helper/NormalizeNullValueHelper.php | 2 +- .../Service/Context/BaseContextData.php | 2 +- .../Service/Generator/Generator.php | 6 +- .../Service/Generator/GeneratorException.php | 2 +- .../Service/Generator/GeneratorInterface.php | 6 +- .../RelatedEntityNotFoundException.php | 2 +- .../Service/Context/BaseContextDataTest.php | 2 +- .../ChillDocStoreBundle/Entity/Document.php | 2 +- ...ForAccompanyingPeriodProviderInterface.php | 8 +- .../GenericDocForPersonProviderInterface.php | 8 +- .../GenericDoc/Manager.php | 30 +++---- ...anyingCourseDocumentGenericDocProvider.php | 6 +- .../PersonDocumentGenericDocProvider.php | 10 +-- .../AccompanyingCourseDocumentRepository.php | 2 +- .../Repository/DocumentCategoryRepository.php | 2 +- .../PersonDocumentACLAwareRepository.php | 8 +- ...sonDocumentACLAwareRepositoryInterface.php | 12 +-- .../Repository/PersonDocumentRepository.php | 2 +- .../Repository/StoredObjectRepository.php | 2 +- .../WopiEditTwigExtensionRuntime.php | 6 +- .../Tests/GenericDoc/ManagerTest.php | 4 +- ...ngCourseDocumentGenericDocProviderTest.php | 2 +- .../PersonDocumentACLAwareRepositoryTest.php | 8 +- .../Tests/StoredObjectManagerTest.php | 4 +- src/Bundle/ChillEventBundle/Entity/Event.php | 2 +- .../ChillEventBundle/Entity/Participation.php | 14 ++-- src/Bundle/ChillEventBundle/Entity/Role.php | 2 +- src/Bundle/ChillEventBundle/Entity/Status.php | 2 +- .../Form/ChoiceLoader/EventChoiceLoader.php | 2 +- .../CRUD/Controller/CRUDController.php | 12 +-- .../Controller/ExportController.php | 6 +- .../Controller/PermissionsGroupController.php | 2 +- .../Controller/UserController.php | 6 +- .../ChillMainBundle/Cron/CronJobInterface.php | 2 +- .../ChillMainBundle/Cron/CronManager.php | 2 +- .../Cron/CronManagerInterface.php | 2 +- .../ORM/LoadAddressReferences.php | 2 +- .../DataFixtures/ORM/LoadCountries.php | 2 +- .../DataFixtures/ORM/LoadLanguages.php | 2 +- .../DataFixtures/ORM/LoadLocationType.php | 2 +- .../DataFixtures/ORM/LoadUsers.php | 2 +- .../ChillMainBundle/Doctrine/DQL/Extract.php | 2 +- .../Doctrine/DQL/JsonExtract.php | 2 +- .../ChillMainBundle/Doctrine/DQL/ToChar.php | 2 +- .../Hydration/FlatHierarchyEntityHydrator.php | 2 +- src/Bundle/ChillMainBundle/Entity/Address.php | 6 +- .../Entity/AddressReference.php | 2 +- .../ChillMainBundle/Entity/PostalCode.php | 2 +- .../ChillMainBundle/Entity/RoleScope.php | 4 +- src/Bundle/ChillMainBundle/Entity/User.php | 4 +- .../Entity/User/UserJobHistory.php | 4 +- .../Entity/User/UserScopeHistory.php | 4 +- .../ChillMainBundle/Export/ExportManager.php | 8 +- .../Export/Helper/UserHelper.php | 2 +- .../ChoiceLoader/PostalCodeChoiceLoader.php | 2 +- .../IdToEntityDataTransformer.php | 2 +- .../ChillMainBundle/Notification/Mailer.php | 2 +- .../Pagination/PaginatorFactory.php | 4 +- .../PhoneNumberHelperInterface.php | 2 +- .../Phonenumber/PhonenumberHelper.php | 2 +- .../Repository/AddressReferenceRepository.php | 4 +- .../Repository/AddressRepository.php | 6 +- .../Repository/CenterRepository.php | 4 +- .../Repository/CivilityRepository.php | 2 +- .../CivilityRepositoryInterface.php | 2 +- .../Repository/CountryRepository.php | 6 +- .../Repository/CronJobExecutionRepository.php | 2 +- .../CronJobExecutionRepositoryInterface.php | 2 +- .../GeographicalUnitLayerLayerRepository.php | 2 +- .../Repository/GeographicalUnitRepository.php | 2 +- .../Repository/GroupCenterRepository.php | 4 +- .../Repository/LanguageRepository.php | 4 +- .../LanguageRepositoryInterface.php | 4 +- .../Repository/NotificationRepository.php | 4 +- .../Repository/PermissionsGroupRepository.php | 4 +- .../Repository/PostalCodeRepository.php | 4 +- .../PostalCodeRepositoryInterface.php | 4 +- .../Repository/RegroupmentRepository.php | 4 +- .../Repository/RoleScopeRepository.php | 4 +- .../Repository/SavedExportRepository.php | 4 +- .../SavedExportRepositoryInterface.php | 4 +- .../Repository/ScopeRepository.php | 4 +- .../Repository/ScopeRepositoryInterface.php | 4 +- .../Repository/UserJobRepository.php | 2 +- .../Repository/UserJobRepositoryInterface.php | 2 +- .../Repository/UserRepository.php | 10 +-- .../Repository/UserRepositoryInterface.php | 6 +- .../Workflow/EntityWorkflowRepository.php | 12 +-- .../Workflow/EntityWorkflowStepRepository.php | 4 +- .../ChillMainBundle/Routing/MenuTwig.php | 2 +- .../Search/SearchApiNoQueryException.php | 2 +- .../Authorization/AuthorizationHelper.php | 4 +- .../AuthorizationHelperForCurrentUser.php | 2 +- ...orizationHelperForCurrentUserInterface.php | 2 +- .../AuthorizationHelperInterface.php | 2 +- .../Resolver/ScopeResolverDispatcher.php | 2 +- .../CommentEmbeddableDocGenNormalizer.php | 4 +- .../Normalizer/EntityWorkflowNormalizer.php | 4 +- .../EntityWorkflowStepNormalizer.php | 4 +- .../Normalizer/NotificationNormalizer.php | 4 +- .../Normalizer/PhonenumberNormalizer.php | 4 +- .../PrivateCommentEmbeddableNormalizer.php | 6 +- ...ddressWithReferenceOrPostalCodeCronJob.php | 2 +- ...eographicalUnitMaterializedViewCronJob.php | 2 +- .../Import/AddressReferenceBaseImporter.php | 6 +- .../Import/GeographicalUnitBaseImporter.php | 2 +- .../Service/Mailer/ChillMailer.php | 2 +- .../Templating/Listing/FilterOrderHelper.php | 4 +- .../Listing/FilterOrderHelperBuilder.php | 4 +- .../Cron/CronJobDatabaseInteractionTest.php | 2 +- .../Tests/Cron/CronManagerTest.php | 4 +- .../Tests/Export/ExportManagerTest.php | 10 +-- .../Tests/Export/SortExportElementTest.php | 2 +- .../Email/NotificationMailerTest.php | 2 +- .../Normalizer/DateNormalizerTest.php | 2 +- .../Normalizer/UserNormalizerTest.php | 6 +- .../Util/DateRangeCovering.php | 4 +- .../Workflow/Helper/MetadataExtractor.php | 2 +- .../AccompanyingPeriodStepChangeCronjob.php | 2 +- .../AccompanyingPeriodStepChanger.php | 2 +- .../ReassignAccompanyingPeriodController.php | 2 +- .../SocialWork/SocialIssueController.php | 2 +- .../Doctrine/DQL/AddressPart.php | 2 +- .../Entity/AccompanyingPeriod.php | 22 ++--- .../AccompanyingPeriodLocationHistory.php | 10 +-- .../AccompanyingPeriodStepHistory.php | 2 +- .../AccompanyingPeriodWork.php | 16 ++-- .../Entity/AccompanyingPeriod/Resource.php | 4 +- .../Entity/AccompanyingPeriod/UserHistory.php | 2 +- .../ChillPersonBundle/Entity/HasPerson.php | 2 +- .../Entity/Household/Household.php | 24 +++--- .../Entity/Household/HouseholdMember.php | 4 +- .../ChillPersonBundle/Entity/Person.php | 24 +++--- .../Entity/Person/PersonCenterCurrent.php | 2 +- .../Entity/Person/PersonResource.php | 6 +- .../Entity/PersonAltName.php | 2 +- .../ClosingDateAggregator.php | 2 +- .../JobWorkingOnCourseAggregator.php | 2 +- .../OpeningDateAggregator.php | 2 +- .../ScopeWorkingOnCourseAggregator.php | 2 +- .../UserWorkingOnCourseAggregator.php | 2 +- .../ChildrenNumberAggregator.php | 2 +- .../PersonAggregators/CenterAggregator.php | 2 +- .../PostalCodeAggregator.php | 2 +- .../Export/Helper/LabelPersonHelper.php | 2 +- .../Form/ChoiceLoader/PersonChoiceLoader.php | 2 +- .../ChillPersonBundle/Form/PersonType.php | 2 +- .../Household/MembersEditor.php | 2 +- .../Household/MembersEditorFactory.php | 2 +- .../AccompanyingPeriodInfoRepository.php | 2 +- ...PeriodWorkEvaluationDocumentRepository.php | 2 +- ...mpanyingPeriodWorkEvaluationRepository.php | 2 +- .../AccompanyingPeriodWorkRepository.php | 4 +- .../ClosingMotiveRepository.php | 2 +- .../AccompanyingPeriodACLAwareRepository.php | 8 +- ...nyingPeriodACLAwareRepositoryInterface.php | 6 +- .../AccompanyingPeriodRepository.php | 4 +- .../HouseholdCompositionRepository.php | 4 +- ...ouseholdCompositionRepositoryInterface.php | 4 +- .../HouseholdCompositionTypeRepository.php | 2 +- ...holdCompositionTypeRepositoryInterface.php | 2 +- .../Household/HouseholdRepository.php | 2 +- .../PersonHouseholdAddressRepository.php | 4 +- .../Household/PositionRepository.php | 2 +- .../Repository/MaritalStatusRepository.php | 2 +- .../MaritalStatusRepositoryInterface.php | 2 +- .../Person/PersonCenterHistoryRepository.php | 2 +- .../Repository/PersonACLAwareRepository.php | 80 +++++++++---------- .../PersonACLAwareRepositoryInterface.php | 60 +++++++------- .../Repository/PersonRepository.php | 4 +- .../Repository/PersonResourceRepository.php | 4 +- .../Relationships/RelationRepository.php | 2 +- .../Relationships/RelationshipRepository.php | 2 +- .../ResidentialAddressRepository.php | 4 +- .../SocialWork/EvaluationRepository.php | 4 +- .../EvaluationRepositoryInterface.php | 4 +- .../Repository/SocialWork/GoalRepository.php | 6 +- .../SocialWork/ResultRepository.php | 8 +- .../SocialWork/SocialActionRepository.php | 6 +- .../SocialWork/SocialIssueRepository.php | 4 +- ...PeriodWorkEvaluationDocumentNormalizer.php | 4 +- ...mpanyingPeriodWorkEvaluationNormalizer.php | 4 +- .../AccompanyingPeriodWorkNormalizer.php | 4 +- .../Normalizer/WorkflowNormalizer.php | 4 +- ...PeriodWorkEvaluationGenericDocProvider.php | 6 +- .../Events/PersonMoveEventSubscriberTest.php | 8 +- .../Controller/PersonControllerCreateTest.php | 2 +- .../Tests/Household/MembersEditorTest.php | 4 +- ...companyingPeriodACLAwareRepositoryTest.php | 2 +- .../Authorization/PersonVoterTest.php | 2 +- .../Normalizer/PersonDocGenNormalizerTest.php | 22 ++--- .../DocGenerator/PersonContextTest.php | 28 +++---- ...odWorkEvaluationGenericDocProviderTest.php | 6 +- .../Authorization/ReportVoterTest.php | 4 +- .../migrations/Version20150622233319.php | 2 +- .../ChillTaskBundle/Entity/AbstractTask.php | 2 +- .../ChillTaskBundle/Entity/SingleTask.php | 8 +- .../SingleTaskAclAwareRepository.php | 24 +++--- .../SingleTaskAclAwareRepositoryInterface.php | 16 ++-- .../Repository/SingleTaskRepository.php | 4 +- .../Authorization/AuthorizationEvent.php | 2 +- .../Templating/TaskTwigExtension.php | 2 +- .../Workflow/TaskWorkflowManager.php | 2 +- .../Controller/ThirdPartyController.php | 6 +- .../Entity/ThirdParty.php | 10 +-- .../ThirdPartyACLAwareRepository.php | 6 +- .../Repository/ThirdPartyRepository.php | 4 +- .../src/Service/Controller/Responder.php | 2 +- .../Service/Controller/ResponderInterface.php | 2 +- 257 files changed, 605 insertions(+), 605 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php index d8551c11d..0f41547d9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php @@ -57,7 +57,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|int|string $value): string { + return function (int|string|null $value): string { if ('_header' === $value) { return 'export.aggregator.acp.by_activity_type.activity_type'; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php index a22a75189..392ff5b19 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php @@ -35,7 +35,7 @@ final readonly class ActivityPresenceAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|int|string $value): string { + return function (int|string|null $value): string { if ('_header' === $value) { return 'export.aggregator.activity.by_activity_presence.header'; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 0cb185857..d433e6a86 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -58,7 +58,7 @@ class ActivityTypeAggregator implements AggregatorInterface public function getLabels($key, array $values, $data): \Closure { - return function (null|int|string $value): string { + return function (int|string|null $value): string { if ('_header' === $value) { return 'Activity type'; } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php index 38bb42e51..0623601a5 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php @@ -36,14 +36,14 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum ) { } - public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface + public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface { $query = $this->buildBaseFetchQueryActivityDocumentLinkedToPersonFromPersonContext($person, $startDate, $endDate, $content); return $this->addFetchQueryByPersonACL($query, $person); } - public function buildBaseFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + public function buildBaseFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); $activityMetadata = $this->em->getClassMetadata(Activity::class); @@ -72,7 +72,7 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum return $this->addWhereClauses($query, $startDate, $endDate, $content); } - public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); $activityMetadata = $this->em->getClassMetadata(Activity::class); @@ -123,7 +123,7 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum return $this->addWhereClauses($query, $startDate, $endDate, $content); } - private function addWhereClauses(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + private function addWhereClauses(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepositoryInterface.php index dcd45c016..79c320ba2 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepositoryInterface.php @@ -25,12 +25,12 @@ interface ActivityDocumentACLAwareRepositoryInterface * * This method must check the rights to see a document: the user must be allowed to see the given activities */ - public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface; + public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface; /** * Return a fetch query for querying document's activities for an activity in accompanying periods, but for a given person. * * This method must check the rights to see a document: the user must be allowed to see the given accompanying periods */ - public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery; + public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery; } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php index ae3296e7f..3ed96074b 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php @@ -34,7 +34,7 @@ class ActivityPresenceRepository implements ActivityPresenceRepositoryInterface return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php index d2daa1d5d..228d70856 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php @@ -25,7 +25,7 @@ interface ActivityPresenceRepositoryInterface /** * @return array|ActivityPresence[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?ActivityPresence; diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php index 6f7453a74..99adf4fe0 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php @@ -48,7 +48,7 @@ final class ActivityTypeRepository implements ActivityTypeRepositoryInterface /** * @return array|ActivityType[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php index ff198b345..291ef5832 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php @@ -37,7 +37,7 @@ final readonly class AccompanyingPeriodActivityGenericDocProvider implements Gen ) { } - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); $activityMetadata = $this->em->getClassMetadata(Activity::class); @@ -100,7 +100,7 @@ final readonly class AccompanyingPeriodActivityGenericDocProvider implements Gen return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $person); } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { return $this->activityDocumentACLAwareRepository ->buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext($person, $startDate, $endDate, $content); diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php index 1b0ed507b..618775452 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php @@ -28,7 +28,7 @@ final readonly class PersonActivityGenericDocProvider implements GenericDocForPe ) { } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { return $this->personActivityDocumentACLAwareRepository->buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext( $person, diff --git a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php index b907363a3..e3ab7b60a 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php @@ -157,7 +157,7 @@ final class ActivityVoterTest extends KernelTestCase * * @return \Symfony\Component\Security\Core\Authentication\Token\TokenInterface */ - protected function prepareToken(User $user = null) + protected function prepareToken(?User $user = null) { $token = $this->prophet->prophesize(); $token diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 0a7891a07..6bd2affe7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -49,7 +49,7 @@ final class AsideActivityController extends CRUDController return $asideActivity; } - protected function buildQueryEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null) + protected function buildQueryEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null) { $qb = parent::buildQueryEntities($action, $request); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php b/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php index 533e567b4..6735606ce 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php @@ -49,7 +49,7 @@ class AsideActivityCategoryRepository implements ObjectRepository * * @return AsideActivityCategory[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php index 52a52c99f..85420e670 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php +++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php @@ -132,14 +132,14 @@ abstract class AbstractElement return $this; } - public function setComment(string $comment = null): self + public function setComment(?string $comment = null): self { $this->comment = $comment; return $this; } - public function setEndDate(\DateTimeInterface $endDate = null): self + public function setEndDate(?\DateTimeInterface $endDate = null): self { if ($endDate instanceof \DateTime) { $this->endDate = \DateTimeImmutable::createFromMutable($endDate); diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php index 577be07db..a0c23a4ad 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php @@ -66,7 +66,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface * * @return array */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php index 7a930bea8..d9ec3e269 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php @@ -36,7 +36,7 @@ interface ChargeKindRepositoryInterface extends ObjectRepository /** * @return array */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?ChargeKind; diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php index e10913195..723f26748 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php @@ -71,7 +71,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface * * @return list */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepositoryInterface.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepositoryInterface.php index d639d54ee..950487225 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepositoryInterface.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepositoryInterface.php @@ -36,7 +36,7 @@ interface ResourceKindRepositoryInterface extends ObjectRepository /** * @return list */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?ResourceKind; diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php b/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php index 1d2707120..cfe3a0089 100644 --- a/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php +++ b/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php @@ -32,7 +32,7 @@ final class Version20221207105407 extends AbstractMigration implements Container return 'Use new budget admin entities'; } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillCalendarBundle/Exception/UserAbsenceSyncException.php b/src/Bundle/ChillCalendarBundle/Exception/UserAbsenceSyncException.php index dd2c0b9c2..7466f93a4 100644 --- a/src/Bundle/ChillCalendarBundle/Exception/UserAbsenceSyncException.php +++ b/src/Bundle/ChillCalendarBundle/Exception/UserAbsenceSyncException.php @@ -13,7 +13,7 @@ namespace Chill\CalendarBundle\Exception; class UserAbsenceSyncException extends \LogicException { - public function __construct(string $message = '', int $code = 20_230_706, \Throwable $previous = null) + public function __construct(string $message = '', int $code = 20_230_706, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php index 2d1006cca..58cd04dfa 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php @@ -33,7 +33,7 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface /** * @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft */ - public function isUserAbsent(User $user): null|bool + public function isUserAbsent(User $user): bool|null { $id = $this->mapCalendarToUser->getUserId($user); diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderInterface.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderInterface.php index f67562e27..a918bb7ea 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderInterface.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReaderInterface.php @@ -18,5 +18,5 @@ interface MSUserAbsenceReaderInterface /** * @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft */ - public function isUserAbsent(User $user): null|bool; + public function isUserAbsent(User $user): bool|null; } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php index ce490ce3f..f84d04120 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php @@ -29,7 +29,7 @@ class MachineHttpClient implements HttpClientInterface private readonly HttpClientInterface $decoratedClient; - public function __construct(private readonly MachineTokenStorage $machineTokenStorage, HttpClientInterface $decoratedClient = null) + public function __construct(private readonly MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); } @@ -68,7 +68,7 @@ class MachineHttpClient implements HttpClientInterface return $this->decoratedClient->request($method, $url, $options); } - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { return $this->decoratedClient->stream($responses, $timeout); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index 70a0fae55..aa3b1c4a4 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -178,8 +178,8 @@ class MapCalendarToUser public function writeSubscriptionMetadata( User $user, int $expiration, - string $id = null, - string $secret = null + ?string $id = null, + ?string $secret = null ): void { $user->setAttributeByDomain(self::METADATA_KEY, self::EXPIRATION_SUBSCRIPTION_EVENT, $expiration); diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php index d969a56b6..02c9ea806 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php @@ -29,7 +29,7 @@ class OnBehalfOfUserHttpClient private readonly HttpClientInterface $decoratedClient; - public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, HttpClientInterface $decoratedClient = null) + public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); } @@ -63,7 +63,7 @@ class OnBehalfOfUserHttpClient return $this->decoratedClient->request($method, $url, $options); } - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { return $this->decoratedClient->stream($responses, $timeout); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 23f83688a..27297f3ac 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -171,7 +171,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface } } - public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, CalendarRange $associatedCalendarRange = null): void + public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void { if ('' === $remoteId) { return; diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php index 4acb40554..7da67df0c 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php @@ -46,7 +46,7 @@ class NullRemoteCalendarConnector implements RemoteCalendarConnectorInterface return []; } - public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, CalendarRange $associatedCalendarRange = null): void + public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/RemoteCalendarConnectorInterface.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/RemoteCalendarConnectorInterface.php index 53d2c8602..1e3c16845 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/RemoteCalendarConnectorInterface.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/RemoteCalendarConnectorInterface.php @@ -47,7 +47,7 @@ interface RemoteCalendarConnectorInterface */ public function listEventsForUser(User $user, \DateTimeImmutable $startDate, \DateTimeImmutable $endDate, ?int $offset = 0, ?int $limit = 50): array; - public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, CalendarRange $associatedCalendarRange = null): void; + public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void; public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void; diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php index c91794c6b..a3350a7cd 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php @@ -159,7 +159,7 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface /** * @return array|Calendar[] */ - public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array + public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array { $qb = $this->buildQueryByAccompanyingPeriod($period, $startDate, $endDate)->select('c'); @@ -178,7 +178,7 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface return $qb->getQuery()->getResult(); } - public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array + public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array { $qb = $this->buildQueryByPerson($person, $startDate, $endDate) ->select('c'); diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepositoryInterface.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepositoryInterface.php index f6d1b5c17..78f71229d 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepositoryInterface.php @@ -46,7 +46,7 @@ interface CalendarACLAwareRepositoryInterface /** * @return array|Calendar[] */ - public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array; + public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array; /** * Return all the calendars which are associated with a person, either on @see{Calendar::person} or within. @@ -58,5 +58,5 @@ interface CalendarACLAwareRepositoryInterface * * @return array|Calendar[] */ - public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], int $offset = null, int $limit = null): array; + public function findByPerson(Person $person, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?array $orderBy = [], ?int $offset = null, ?int $limit = null): array; } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php index fb71717d0..dd593bf3c 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php @@ -35,7 +35,7 @@ class CalendarDocRepository implements ObjectRepository, CalendarDocRepositoryIn return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepositoryInterface.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepositoryInterface.php index 6d86fd943..d2b1951df 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepositoryInterface.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepositoryInterface.php @@ -25,7 +25,7 @@ interface CalendarDocRepositoryInterface /** * @return array|CalendarDoc[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null); + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null); public function findOneBy(array $criteria): ?CalendarDoc; diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php index a707ccde9..d6e1ac8a5 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php @@ -52,7 +52,7 @@ class CalendarRangeRepository implements ObjectRepository /** * @return array|CalendarRange[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -64,8 +64,8 @@ class CalendarRangeRepository implements ObjectRepository User $user, \DateTimeImmutable $from, \DateTimeImmutable $to, - int $limit = null, - int $offset = null + ?int $limit = null, + ?int $offset = null ): array { $qb = $this->buildQueryAvailableRangesForUser($user, $from, $to); diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php index 486493b21..3121854e5 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php @@ -46,7 +46,7 @@ class CalendarRepository implements ObjectRepository ->getSingleScalarResult(); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -67,7 +67,7 @@ class CalendarRepository implements ObjectRepository /** * @return array|Calendar[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -75,7 +75,7 @@ class CalendarRepository implements ObjectRepository /** * @return array|Calendar[] */ - public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $orderBy = null, int $limit = null, int $offset = null): array + public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->findBy( [ @@ -87,7 +87,7 @@ class CalendarRepository implements ObjectRepository ); } - public function findByNotificationAvailable(\DateTimeImmutable $startDate, \DateTimeImmutable $endDate, int $limit = null, int $offset = null): array + public function findByNotificationAvailable(\DateTimeImmutable $startDate, \DateTimeImmutable $endDate, ?int $limit = null, ?int $offset = null): array { $qb = $this->queryByNotificationAvailable($startDate, $endDate)->select('c'); @@ -105,7 +105,7 @@ class CalendarRepository implements ObjectRepository /** * @return array|Calendar[] */ - public function findByUser(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to, int $limit = null, int $offset = null): array + public function findByUser(User $user, \DateTimeImmutable $from, \DateTimeImmutable $to, ?int $limit = null, ?int $offset = null): array { $qb = $this->buildQueryByUser($user, $from, $to)->select('c'); diff --git a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php index c6f163aa3..8778330f8 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php @@ -41,7 +41,7 @@ class InviteRepository implements ObjectRepository /** * @return array|Invite[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null) { return $this->entityRepository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index 7b566a2f1..faca60a67 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -44,7 +44,7 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen /** * @throws MappingException */ - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $classMetadata = $this->em->getClassMetadata(CalendarDoc::class); $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); @@ -91,7 +91,7 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen return $this->security->isGranted(CalendarVoter::SEE, $accompanyingPeriod); } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $classMetadata = $this->em->getClassMetadata(CalendarDoc::class); $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php index 7b7a8f96d..f088e27ba 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php @@ -40,7 +40,7 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe ) { } - private function addWhereClausesToQuery(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); @@ -74,7 +74,7 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe /** * @throws MappingException */ - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $classMetadata = $this->em->getClassMetadata(CalendarDoc::class); $storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class); diff --git a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php index 506baa98b..4a4b4f7d4 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php @@ -202,8 +202,8 @@ final class CalendarContextTest extends TestCase } private function buildCalendarContext( - EntityManagerInterface $entityManager = null, - NormalizerInterface $normalizer = null + ?EntityManagerInterface $entityManager = null, + ?NormalizerInterface $normalizer = null ): CalendarContext { $baseContext = $this->prophesize(BaseContextData::class); $baseContext->getData(null)->willReturn(['base_context' => 'data']); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index b88a005dc..a218e2cd2 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -363,7 +363,7 @@ class CustomFieldsGroupController extends AbstractController * * @return \Symfony\Component\Form\Form */ - private function createMakeDefaultForm(CustomFieldsGroup $group = null) + private function createMakeDefaultForm(?CustomFieldsGroup $group = null) { return $this->createFormBuilder($group, [ 'method' => 'POST', diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 3daee9ecb..b57b45bc9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -156,7 +156,7 @@ class CustomFieldChoice extends AbstractCustomField return $serialized; } - public function extractOtherValue(CustomField $cf, array $data = null) + public function extractOtherValue(CustomField $cf, ?array $data = null) { return $data['_other']; } @@ -355,7 +355,7 @@ class CustomFieldChoice extends AbstractCustomField * If the value had an 'allow_other' = true option, the returned value * **is not** the content of the _other field, but the `_other` string. */ - private function guessValue(null|array|string $value) + private function guessValue(array|string|null $value) { if (null === $value) { return null; diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index 93eeafdea..6d1373fb0 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -212,7 +212,7 @@ class CustomField * * @return CustomField */ - public function setCustomFieldsGroup(CustomFieldsGroup $customFieldGroup = null) + public function setCustomFieldsGroup(?CustomFieldsGroup $customFieldGroup = null) { $this->customFieldGroup = $customFieldGroup; diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index a17bb5aaf..2d9889066 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -182,7 +182,7 @@ class Option /** * @return $this */ - public function setParent(Option $parent = null) + public function setParent(?Option $parent = null) { $this->parent = $parent; $this->key = $parent->getKey(); diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index 9d2be4979..99eb51cce 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -139,7 +139,7 @@ class CustomFieldsGroup /** * Get name. */ - public function getName(string $language = null): array|string + public function getName(?string $language = null): array|string { // TODO set this in a service, PLUS twig function if (null !== $language) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php index aad28a2b2..fcccf01ed 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php +++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php @@ -84,7 +84,7 @@ class CustomFieldProvider implements ContainerAwareInterface * * @see \Symfony\Component\DependencyInjection\ContainerAwareInterface::setContainer() */ - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { if (null === $container) { throw new \LogicException('container should not be null'); diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/DriverInterface.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/DriverInterface.php index a408ec8e6..4d802d2ca 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/DriverInterface.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/DriverInterface.php @@ -13,5 +13,5 @@ namespace Chill\DocGeneratorBundle\GeneratorDriver; interface DriverInterface { - public function generateFromString(string $template, string $resourceType, array $data, string $templateName = null): string; + public function generateFromString(string $template, string $resourceType, array $data, ?string $templateName = null): string; } diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php index 9fa6f6654..041133c50 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php @@ -17,7 +17,7 @@ namespace Chill\DocGeneratorBundle\GeneratorDriver\Exception; */ class TemplateException extends \RuntimeException { - public function __construct(private readonly array $errors, $code = 0, \Throwable $previous = null) + public function __construct(private readonly array $errors, $code = 0, ?\Throwable $previous = null) { parent::__construct('Error while generating document from template', $code, $previous); } diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php index 547af44c9..b46ee09b2 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php @@ -33,7 +33,7 @@ final class RelatorioDriver implements DriverInterface $this->url = $parameterBag->get('chill_doc_generator')['driver']['relatorio']['url']; } - public function generateFromString(string $template, string $resourceType, array $data, string $templateName = null): string + public function generateFromString(string $template, string $resourceType, array $data, ?string $templateName = null): string { $form = new FormDataPart( [ diff --git a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php index 85486c2ce..0f2771b4e 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php +++ b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php @@ -58,7 +58,7 @@ final class DocGeneratorTemplateRepository implements ObjectRepository * * @return DocGeneratorTemplate[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -85,7 +85,7 @@ final class DocGeneratorTemplateRepository implements ObjectRepository ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?DocGeneratorTemplate + public function findOneBy(array $criteria, ?array $orderBy = null): ?DocGeneratorTemplate { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php index c7167670d..79cf47be5 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php @@ -20,7 +20,7 @@ class NormalizeNullValueHelper { } - public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadataInterface $classMetadata = null) + public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ?ClassMetadataInterface $classMetadata = null) { $data = []; $data['isNull'] = true; diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index 28092331f..2773d3816 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -21,7 +21,7 @@ class BaseContextData { } - public function getData(User $user = null): array + public function getData(?User $user = null): array { $data = []; diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 25b5f9f03..6c9a6f219 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -46,10 +46,10 @@ class Generator implements GeneratorInterface DocGeneratorTemplate $template, int $entityId, array $contextGenerationDataNormalized, - StoredObject $destinationStoredObject = null, + ?StoredObject $destinationStoredObject = null, bool $isTest = false, - File $testFile = null, - User $creator = null + ?File $testFile = null, + ?User $creator = null ): ?string { if ($destinationStoredObject instanceof StoredObject && StoredObject::STATUS_PENDING !== $destinationStoredObject->getStatus()) { $this->logger->info(self::LOG_PREFIX.'Aborting generation of an already generated document'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php index 2c91942bc..cd7669240 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php @@ -16,7 +16,7 @@ class GeneratorException extends \RuntimeException /** * @param string[] $errors */ - public function __construct(private readonly array $errors = [], \Throwable $previous = null) + public function __construct(private readonly array $errors = [], ?\Throwable $previous = null) { parent::__construct( 'Could not generate the document', diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php index 64d99f801..c4ff38ac5 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php @@ -33,9 +33,9 @@ interface GeneratorInterface DocGeneratorTemplate $template, int $entityId, array $contextGenerationDataNormalized, - StoredObject $destinationStoredObject = null, + ?StoredObject $destinationStoredObject = null, bool $isTest = false, - File $testFile = null, - User $creator = null + ?File $testFile = null, + ?User $creator = null ): ?string; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php index a252755ea..3b1bd6f97 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php @@ -13,7 +13,7 @@ namespace Chill\DocGeneratorBundle\Service\Generator; class RelatedEntityNotFoundException extends \RuntimeException { - public function __construct(string $relatedEntityClass, int $relatedEntityId, \Throwable $previous = null) + public function __construct(string $relatedEntityClass, int $relatedEntityId, ?\Throwable $previous = null) { parent::__construct( sprintf('Related entity not found: %s, %s', $relatedEntityClass, $relatedEntityId), diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Service/Context/BaseContextDataTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Service/Context/BaseContextDataTest.php index 7ce52dee0..476f7abe4 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Service/Context/BaseContextDataTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Service/Context/BaseContextDataTest.php @@ -56,7 +56,7 @@ final class BaseContextDataTest extends KernelTestCase } private function buildBaseContext( - NormalizerInterface $normalizer = null + ?NormalizerInterface $normalizer = null ): BaseContextData { return new BaseContextData( $normalizer ?? self::$container->get(NormalizerInterface::class) diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php index d4d6dc945..a56b6b800 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php @@ -138,7 +138,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setObject(StoredObject $object = null) + public function setObject(?StoredObject $object = null) { $this->object = $object; diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php index 9ceec5438..bffa19b53 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForAccompanyingPeriodProviderInterface.php @@ -17,10 +17,10 @@ interface GenericDocForAccompanyingPeriodProviderInterface { public function buildFetchQueryForAccompanyingPeriod( AccompanyingPeriod $accompanyingPeriod, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, - string $origin = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, + ?string $origin = null ): FetchQueryInterface; /** diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForPersonProviderInterface.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForPersonProviderInterface.php index 815459f20..264a1d8f2 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForPersonProviderInterface.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocForPersonProviderInterface.php @@ -17,10 +17,10 @@ interface GenericDocForPersonProviderInterface { public function buildFetchQueryForPerson( Person $person, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, - string $origin = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, + ?string $origin = null ): FetchQueryInterface; /** diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Manager.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Manager.php index bfeddc8dc..a185ce9b6 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Manager.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Manager.php @@ -43,9 +43,9 @@ final readonly class Manager */ public function countDocForAccompanyingPeriod( AccompanyingPeriod $accompanyingPeriod, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, array $places = [] ): int { ['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($accompanyingPeriod, $startDate, $endDate, $content, $places); @@ -73,9 +73,9 @@ final readonly class Manager public function countDocForPerson( Person $person, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, array $places = [] ): int { ['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($person, $startDate, $endDate, $content, $places); @@ -94,9 +94,9 @@ final readonly class Manager AccompanyingPeriod $accompanyingPeriod, int $offset = 0, int $limit = 20, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, array $places = [] ): iterable { ['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($accompanyingPeriod, $startDate, $endDate, $content, $places); @@ -137,9 +137,9 @@ final readonly class Manager Person $person, int $offset = 0, int $limit = 20, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, array $places = [] ): iterable { ['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($person, $startDate, $endDate, $content, $places); @@ -183,9 +183,9 @@ final readonly class Manager */ private function buildUnionQuery( AccompanyingPeriod|Person $linked, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, array $places = [], ): array { $queries = []; diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php index 3ef5d5482..d45f68a38 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php @@ -34,7 +34,7 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen ) { } - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $classMetadata = $this->entityManager->getClassMetadata(AccompanyingCourseDocument::class); @@ -59,7 +59,7 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen return $this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod); } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $classMetadata = $this->entityManager->getClassMetadata(AccompanyingCourseDocument::class); @@ -108,7 +108,7 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $person); } - private function addWhereClause(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + private function addWhereClause(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $classMetadata = $this->entityManager->getClassMetadata(AccompanyingCourseDocument::class); diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php index 3345b1c7e..9f4cd4aff 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php @@ -32,10 +32,10 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe public function buildFetchQueryForPerson( Person $person, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null, - string $origin = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null, + ?string $origin = null ): FetchQueryInterface { return $this->personDocumentACLAwareRepository->buildFetchQueryForPerson( $person, @@ -50,7 +50,7 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe return $this->security->isGranted(PersonDocumentVoter::SEE, $person); } - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { return $this->personDocumentACLAwareRepository->buildFetchQueryForAccompanyingPeriod($accompanyingPeriod, $startDate, $endDate, $content); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php index 6c6e93fd7..2679993c4 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php @@ -55,7 +55,7 @@ class AccompanyingCourseDocumentRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php index 166749f71..460418951 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php @@ -41,7 +41,7 @@ class DocumentCategoryRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index dacd141f3..b43605018 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -48,14 +48,14 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA return $qb; } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface { $query = $this->buildBaseFetchQueryForPerson($person, $startDate, $endDate, $content); return $this->addFetchQueryByPersonACL($query, $person); } - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $period, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface { $personDocMetadata = $this->em->getClassMetadata(PersonDocument::class); $participationMetadata = $this->em->getClassMetadata(AccompanyingPeriodParticipation::class); @@ -114,7 +114,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA return $this->addFilterClauses($query, $startDate, $endDate, $content); } - public function buildBaseFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + public function buildBaseFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $personDocMetadata = $this->em->getClassMetadata(PersonDocument::class); @@ -134,7 +134,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA return $this->addFilterClauses($query, $startDate, $endDate, $content); } - private function addFilterClauses(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + private function addFilterClauses(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $personDocMetadata = $this->em->getClassMetadata(PersonDocument::class); diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepositoryInterface.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepositoryInterface.php index 4bb55ce50..f1bc70812 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepositoryInterface.php @@ -29,15 +29,15 @@ interface PersonDocumentACLAwareRepositoryInterface public function buildFetchQueryForPerson( Person $person, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null ): FetchQueryInterface; public function buildFetchQueryForAccompanyingPeriod( AccompanyingPeriod $period, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null ): FetchQueryInterface; } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentRepository.php index 4dfeb74fe..f880c0d67 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentRepository.php @@ -39,7 +39,7 @@ readonly class PersonDocumentRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php index 92644c97d..d2e715f7e 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php @@ -44,7 +44,7 @@ final class StoredObjectRepository implements ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index 969e4f95e..f833200c8 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -136,13 +136,13 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt } /** - * @param array{small: boolean} $options + * @param array{small: bool} $options * * @throws \Twig\Error\LoaderError * @throws \Twig\Error\RuntimeError * @throws \Twig\Error\SyntaxError */ - public function renderButtonGroup(Environment $environment, StoredObject $document, string $title = null, bool $canEdit = true, array $options = []): string + public function renderButtonGroup(Environment $environment, StoredObject $document, ?string $title = null, bool $canEdit = true, array $options = []): string { return $environment->render(self::TEMPLATE_BUTTON_GROUP, [ 'document' => $document, @@ -153,7 +153,7 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt ]); } - public function renderEditButton(Environment $environment, StoredObject $document, array $options = null): string + public function renderEditButton(Environment $environment, StoredObject $document, ?array $options = null): string { return $environment->render(self::TEMPLATE, [ 'document' => $document, diff --git a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/ManagerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/ManagerTest.php index 1b22a4d2e..8d4e67282 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/ManagerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/ManagerTest.php @@ -174,7 +174,7 @@ class ManagerTest extends KernelTestCase final readonly class SimpleGenericDocAccompanyingPeriodProvider implements GenericDocForAccompanyingPeriodProviderInterface { - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $query = new FetchQuery( 'accompanying_course_document_dummy', @@ -196,7 +196,7 @@ final readonly class SimpleGenericDocAccompanyingPeriodProvider implements Gener final readonly class SimpleGenericDocPersonProvider implements GenericDocForPersonProviderInterface { - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $query = new FetchQuery( 'dummy_person_doc', diff --git a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php index edbe59c13..1250b132c 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProviderTest.php @@ -40,7 +40,7 @@ class AccompanyingCourseDocumentGenericDocProviderTest extends KernelTestCase /** * @dataProvider provideSearchArguments */ - public function testWithoutAnyArgument(?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, string $content = null): void + public function testWithoutAnyArgument(?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?string $content = null): void { $period = $this->entityManager->createQuery('SELECT a FROM '.AccompanyingPeriod::class.' a') ->setMaxResults(1) diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php index 6dfd521a1..d24afe17f 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Repository/PersonDocumentACLAwareRepositoryTest.php @@ -53,7 +53,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException */ - public function testBuildFetchQueryForPerson(\DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): void + public function testBuildFetchQueryForPerson(?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): void { $centerManager = $this->prophesize(CenterResolverManagerInterface::class); $centerManager->resolveCenters(Argument::type(Person::class)) @@ -92,9 +92,9 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase */ public function testBuildFetchQueryForAccompanyingPeriod( AccompanyingPeriod $period, - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null ): void { $centerManager = $this->prophesize(CenterResolverManagerInterface::class); $centerManager->resolveCenters(Argument::type(Person::class)) diff --git a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php index bf659ba9b..bb6971939 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/StoredObjectManagerTest.php @@ -90,7 +90,7 @@ final class StoredObjectManagerTest extends TestCase /** * @dataProvider getDataProvider */ - public function testRead(StoredObject $storedObject, string $encodedContent, string $clearContent, string $exceptionClass = null) + public function testRead(StoredObject $storedObject, string $encodedContent, string $clearContent, ?string $exceptionClass = null) { if (null !== $exceptionClass) { $this->expectException($exceptionClass); @@ -104,7 +104,7 @@ final class StoredObjectManagerTest extends TestCase /** * @dataProvider getDataProvider */ - public function testWrite(StoredObject $storedObject, string $encodedContent, string $clearContent, string $exceptionClass = null) + public function testWrite(StoredObject $storedObject, string $encodedContent, string $clearContent, ?string $exceptionClass = null) { if (null !== $exceptionClass) { $this->expectException($exceptionClass); diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 9d7b4d935..b5d013588 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -136,7 +136,7 @@ class Event implements HasCenterInterface, HasScopeInterface return $this->id; } - public function getModerator(): null|User + public function getModerator(): User|null { return $this->moderator; } diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 37899262f..464feaf30 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -83,7 +83,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * Get event. */ - public function getEvent(): null|Event + public function getEvent(): Event|null { return $this->event; } @@ -121,7 +121,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * Get role. */ - public function getRole(): null|Role + public function getRole(): Role|null { return $this->role; } @@ -141,7 +141,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * Get status. */ - public function getStatus(): null|Status + public function getStatus(): Status|null { return $this->status; } @@ -233,7 +233,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa * * @return Participation */ - public function setEvent(Event $event = null) + public function setEvent(?Event $event = null) { if ($this->event !== $event) { $this->update(); @@ -249,7 +249,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa * * @return Participation */ - public function setPerson(Person $person = null) + public function setPerson(?Person $person = null) { if ($person !== $this->person) { $this->update(); @@ -265,7 +265,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa * * @return Participation */ - public function setRole(Role $role = null) + public function setRole(?Role $role = null) { if ($role !== $this->role) { $this->update(); @@ -280,7 +280,7 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa * * @return Participation */ - public function setStatus(Status $status = null) + public function setStatus(?Status $status = null) { if ($this->status !== $status) { $this->update(); diff --git a/src/Bundle/ChillEventBundle/Entity/Role.php b/src/Bundle/ChillEventBundle/Entity/Role.php index d0e07021e..d51fb87e3 100644 --- a/src/Bundle/ChillEventBundle/Entity/Role.php +++ b/src/Bundle/ChillEventBundle/Entity/Role.php @@ -125,7 +125,7 @@ class Role * * @return Role */ - public function setType(EventType $type = null) + public function setType(?EventType $type = null) { $this->type = $type; diff --git a/src/Bundle/ChillEventBundle/Entity/Status.php b/src/Bundle/ChillEventBundle/Entity/Status.php index 3c4237eb5..59ae93df1 100644 --- a/src/Bundle/ChillEventBundle/Entity/Status.php +++ b/src/Bundle/ChillEventBundle/Entity/Status.php @@ -125,7 +125,7 @@ class Status * * @return Status */ - public function setType(EventType $type = null) + public function setType(?EventType $type = null) { $this->type = $type; diff --git a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php index 7507550c2..9aa001170 100644 --- a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php +++ b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php @@ -41,7 +41,7 @@ class EventChoiceLoader implements ChoiceLoaderInterface */ public function __construct( EntityRepository $eventRepository, - array $centers = null + ?array $centers = null ) { $this->eventRepository = $eventRepository; diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 78e559ad8..213efba24 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -181,7 +181,7 @@ class CRUDController extends AbstractController /** * Count the number of entities. */ - protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int + protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -210,7 +210,7 @@ class CRUDController extends AbstractController * It is preferable to override customizeForm instead of overriding * this method. */ - protected function createFormFor(string $action, mixed $entity, string $formClass = null, array $formOptions = []): FormInterface + protected function createFormFor(string $action, mixed $entity, ?string $formClass = null, array $formOptions = []): FormInterface { $formClass ??= $this->getFormClassFor($action); @@ -463,7 +463,7 @@ class CRUDController extends AbstractController * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ - protected function formEditAction(string $action, Request $request, mixed $id, string $formClass = null, array $formOptions = []): Response + protected function formEditAction(string $action, Request $request, mixed $id, ?string $formClass = null, array $formOptions = []): Response { $entity = $this->getEntity($action, $id, $request); @@ -660,7 +660,7 @@ class CRUDController extends AbstractController Request $request, int $totalItems, PaginatorInterface $paginator, - FilterOrderHelper $filterOrder = null + ?FilterOrderHelper $filterOrder = null ) { $query = $this->queryEntities($action, $request, $paginator, $filterOrder); @@ -670,7 +670,7 @@ class CRUDController extends AbstractController /** * @return \Chill\MainBundle\Entity\Center[] */ - protected function getReachableCenters(string $role, Scope $scope = null) + protected function getReachableCenters(string $role, ?Scope $scope = null) { return $this->getAuthorizationHelper() ->getReachableCenters($this->getUser(), $role, $scope); @@ -934,7 +934,7 @@ class CRUDController extends AbstractController * * @return type */ - protected function queryEntities(string $action, Request $request, PaginatorInterface $paginator, FilterOrderHelper $filterOrder = null) + protected function queryEntities(string $action, Request $request, PaginatorInterface $paginator, ?FilterOrderHelper $filterOrder = null) { $query = $this->buildQueryEntities($action, $request) ->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber()) diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 963e03322..2df7008d6 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -334,7 +334,7 @@ class ExportController extends AbstractController * When the method is POST, the form is stored if valid, and a redirection * is done to next step. */ - private function exportFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, SavedExport $savedExport = null): Response + private function exportFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, ?SavedExport $savedExport = null): Response { $exportManager = $this->exportManager; @@ -392,7 +392,7 @@ class ExportController extends AbstractController * If the form is posted and valid, store the data in session and * redirect to the next step. */ - private function formatterFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, SavedExport $savedExport = null): Response + private function formatterFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, ?SavedExport $savedExport = null): Response { // check we have data from the previous step (export step) $data = $this->session->get('export_step', null); @@ -521,7 +521,7 @@ class ExportController extends AbstractController * * @return Response */ - private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, SavedExport $savedExport = null) + private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport = null) { if (!$this->filterStatsByCenters) { return $this->redirectToRoute('chill_main_export_new', [ diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index b5fdeca7e..42d0d6a78 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -400,7 +400,7 @@ final class PermissionsGroupController extends AbstractController * get a role scope by his parameters. The role scope is persisted if it * doesn't exist in database. */ - protected function getPersistentRoleScopeBy(string $role, Scope $scope = null): RoleScope + protected function getPersistentRoleScopeBy(string $role, ?Scope $scope = null): RoleScope { $roleScope = $this->roleScopeRepository ->findOneBy(['role' => $role, 'scope' => $scope]); diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 69e9a5d80..b335b356a 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -268,7 +268,7 @@ class UserController extends CRUDController ->build(); } - protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int + protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int { if (!$filterOrder instanceof FilterOrderHelper) { return parent::countEntities($action, $request, $filterOrder); @@ -281,7 +281,7 @@ class UserController extends CRUDController return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString()); } - protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface + protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface { // for "new", add special config if ('new' === $action) { @@ -325,7 +325,7 @@ class UserController extends CRUDController Request $request, int $totalItems, PaginatorInterface $paginator, - FilterOrderHelper $filterOrder = null + ?FilterOrderHelper $filterOrder = null ) { if (0 === $totalItems) { return []; diff --git a/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php b/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php index 41e4b41a8..dcc19f01c 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php +++ b/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php @@ -28,5 +28,5 @@ interface CronJobInterface * * @return array|null optionally return an array with the same data than the previous execution */ - public function run(array $lastExecutionData): null|array; + public function run(array $lastExecutionData): array|null; } diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index 147d035cd..14878235d 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -58,7 +58,7 @@ final readonly class CronManager implements CronManagerInterface ) { } - public function run(string $forceJob = null): void + public function run(?string $forceJob = null): void { if (null !== $forceJob) { $this->runForce($forceJob); diff --git a/src/Bundle/ChillMainBundle/Cron/CronManagerInterface.php b/src/Bundle/ChillMainBundle/Cron/CronManagerInterface.php index 19b151657..d2292d455 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManagerInterface.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManagerInterface.php @@ -16,5 +16,5 @@ interface CronManagerInterface /** * Execute one job, with a given priority, or the given job (identified by his key). */ - public function run(string $forceJob = null): void; + public function run(?string $forceJob = null): void; } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php index 68f16cd01..d04ef29e8 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php @@ -50,7 +50,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt $manager->flush(); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php index 9f36a315e..3433eebd7 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php @@ -43,7 +43,7 @@ class LoadCountries extends AbstractFixture implements ContainerAwareInterface, $manager->flush(); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php index 70c7e90a9..c5c03277f 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php @@ -57,7 +57,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface, $manager->flush(); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php index 3058ed635..aab896add 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php @@ -65,7 +65,7 @@ class LoadLocationType extends AbstractFixture implements ContainerAwareInterfac $manager->flush(); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index 766d2246b..8cb335fba 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -92,7 +92,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde $manager->flush(); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { if (null === $container) { throw new \LogicException('$container should not be null'); diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php index 1fb51c15b..93000be9c 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php @@ -29,7 +29,7 @@ class Extract extends FunctionNode { private string $field; - private null|\Doctrine\ORM\Query\AST\Node|string $value = null; + private \Doctrine\ORM\Query\AST\Node|string|null $value = null; // private PathExpression $value; // private FunctionNode $value; // private DateDiffFunction $value; diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php index 7d93071b7..95d851790 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Query\SqlWalker; class JsonExtract extends FunctionNode { - private null|\Doctrine\ORM\Query\AST\Node|string $element = null; + private \Doctrine\ORM\Query\AST\Node|string|null $element = null; private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $keyToExtract = null; diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php index a5e73209d..ef150867e 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php @@ -23,7 +23,7 @@ class ToChar extends FunctionNode { private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $datetime = null; - private null|\Doctrine\ORM\Query\AST\Node|string $fmt = null; + private \Doctrine\ORM\Query\AST\Node|string|null $fmt = null; public function getSql(SqlWalker $sqlWalker) { diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index 704b95861..110842a2a 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -39,7 +39,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator ); } - private function flatListGenerator(array $hashMap, object $parent = null): \Generator + private function flatListGenerator(array $hashMap, ?object $parent = null): \Generator { $parent = null === $parent ? null : spl_object_id($parent); $hashMap += [$parent => []]; diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 94f66b6d2..f6584fddd 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -440,7 +440,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface return $this->getIsNoAddress(); } - public function setAddressReference(AddressReference $addressReference = null): Address + public function setAddressReference(?AddressReference $addressReference = null): Address { $this->addressReference = $addressReference; @@ -529,7 +529,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @return Address */ - public function setPostcode(PostalCode $postcode = null) + public function setPostcode(?PostalCode $postcode = null) { $this->postcode = $postcode; @@ -620,7 +620,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setValidTo(\DateTimeInterface $validTo = null): self + public function setValidTo(?\DateTimeInterface $validTo = null): self { $this->validTo = $validTo; diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index 140028da5..49b510f8c 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -219,7 +219,7 @@ class AddressReference * * @return Address */ - public function setPostcode(PostalCode $postcode = null) + public function setPostcode(?PostalCode $postcode = null) { $this->postcode = $postcode; diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index b4c246bd5..4d906d6c8 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -210,7 +210,7 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * * @return PostalCode */ - public function setCountry(Country $country = null) + public function setCountry(?Country $country = null) { $this->country = $country; diff --git a/src/Bundle/ChillMainBundle/Entity/RoleScope.php b/src/Bundle/ChillMainBundle/Entity/RoleScope.php index f7dc5fa2f..4777505f5 100644 --- a/src/Bundle/ChillMainBundle/Entity/RoleScope.php +++ b/src/Bundle/ChillMainBundle/Entity/RoleScope.php @@ -78,14 +78,14 @@ class RoleScope return $this->scope; } - public function setRole(string $role = null): self + public function setRole(?string $role = null): self { $this->role = $role; return $this; } - public function setScope(Scope $scope = null): self + public function setScope(?Scope $scope = null): self { $this->scope = $scope; diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 423d0f3ba..d5821c08f 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -274,7 +274,7 @@ class User implements UserInterface, \Stringable return $this->mainLocation; } - public function getMainScope(\DateTimeImmutable $at = null): ?Scope + public function getMainScope(?\DateTimeImmutable $at = null): ?Scope { $at ??= new \DateTimeImmutable('now'); @@ -326,7 +326,7 @@ class User implements UserInterface, \Stringable return $this->salt; } - public function getUserJob(\DateTimeImmutable $at = null): ?UserJob + public function getUserJob(?\DateTimeImmutable $at = null): ?UserJob { $at ??= new \DateTimeImmutable('now'); diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php index 6bda2afec..7916d9891 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php @@ -84,7 +84,7 @@ class UserJobHistory return $this; } - public function setJob(?UserJob $job): User\UserJobHistory + public function setJob(?UserJob $job): UserJobHistory { $this->job = $job; @@ -98,7 +98,7 @@ class UserJobHistory return $this; } - public function setUser(User $user): User\UserJobHistory + public function setUser(User $user): UserJobHistory { $this->user = $user; diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php index a82599ed6..6ac768de2 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php @@ -84,7 +84,7 @@ class UserScopeHistory return $this; } - public function setScope(?Scope $scope): User\UserScopeHistory + public function setScope(?Scope $scope): UserScopeHistory { $this->scope = $scope; @@ -98,7 +98,7 @@ class UserScopeHistory return $this; } - public function setUser(User $user): User\UserScopeHistory + public function setUser(User $user): UserScopeHistory { $this->user = $user; diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index 067cc72e9..159b90b6b 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -89,7 +89,7 @@ class ExportManager * * @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias */ - public function getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array + public function getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): array { if ($export instanceof DirectExportInterface) { return []; @@ -116,7 +116,7 @@ class ExportManager * * @return array an array that contains aggregators. The key is the filter's alias */ - public function getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array + public function getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): array { if ($export instanceof ListInterface || $export instanceof DirectExportInterface) { return []; @@ -450,8 +450,8 @@ class ExportManager */ public function isGrantedForElement( DirectExportInterface|ExportInterface|ModifierInterface $element, - DirectExportInterface|ExportInterface $export = null, - array $centers = null + DirectExportInterface|ExportInterface|null $export = null, + ?array $centers = null ): bool { if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) { $role = $element->requiredRole(); diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index 693bb0376..36b126df9 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -34,7 +34,7 @@ class UserHelper */ public function getLabel($key, array $values, string $header): callable { - return function (null|int|string $value) use ($header) { + return function (int|string|null $value) use ($header) { if ('_header' === $value) { return $header; } diff --git a/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php b/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php index 2bc89f97d..d2dd47962 100644 --- a/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php +++ b/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php @@ -46,7 +46,7 @@ class PostalCodeChoiceLoader implements ChoiceLoaderInterface { return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList( $this->lazyLoadedPostalCodes, - static fn (PostalCode $pc = null) => \call_user_func($value, $pc) + static fn (?PostalCode $pc = null) => \call_user_func($value, $pc) ); } diff --git a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php index 3532c3d9e..1796f7ed2 100644 --- a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php @@ -35,7 +35,7 @@ class IdToEntityDataTransformer implements DataTransformerInterface public function __construct( private readonly ObjectRepository $repository, private readonly bool $multiple = false, - callable $getId = null + ?callable $getId = null ) { $this->getId = $getId ?? static fn (object $o) => $o->getId(); } diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index 246480361..d62d6bc75 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -74,7 +74,7 @@ class Mailer mixed $recipient, array $subject, array $bodies, - callable $callback = null, + ?callable $callback = null, mixed $force = false ) { $fromEmail = $this->routeParameters['from_email']; diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 166dcdb68..0daad7283 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -59,8 +59,8 @@ class PaginatorFactory */ public function create( $totalItems, - string $route = null, - array $routeParameters = null + ?string $route = null, + ?array $routeParameters = null ) { return new Paginator( $totalItems, diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php index bd3eeffe5..c7cf1ddfd 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php @@ -22,7 +22,7 @@ use libphonenumber\PhoneNumber; */ interface PhoneNumberHelperInterface { - public function format(PhoneNumber $phoneNumber = null): string; + public function format(?PhoneNumber $phoneNumber = null): string; /** * Get type (mobile, landline, ...) for phone number. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index 9006268bd..d08d393a3 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -66,7 +66,7 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface * * @throws NumberParseException */ - public function format(PhoneNumber $phoneNumber = null): string + public function format(?PhoneNumber $phoneNumber = null): string { if (null === $phoneNumber) { return ''; diff --git a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php index d029226d0..86faf6ea1 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php @@ -71,7 +71,7 @@ final class AddressReferenceRepository implements ObjectRepository * * @return AddressReference[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -103,7 +103,7 @@ final class AddressReferenceRepository implements ObjectRepository ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?AddressReference + public function findOneBy(array $criteria, ?array $orderBy = null): ?AddressReference { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php index eee1d5b1f..074b1fc32 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php @@ -26,7 +26,7 @@ final class AddressRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Address::class); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -50,12 +50,12 @@ final class AddressRepository implements ObjectRepository * * @return Address[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Address + public function findOneBy(array $criteria, ?array $orderBy = null): ?Address { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php index 46e87cb10..0b507faa1 100644 --- a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php @@ -51,12 +51,12 @@ final class CenterRepository implements CenterRepositoryInterface * * @return Center[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Center + public function findOneBy(array $criteria, ?array $orderBy = null): ?Center { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php index 9ed4cbf01..982d3dd4c 100644 --- a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php @@ -34,7 +34,7 @@ class CivilityRepository implements CivilityRepositoryInterface return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Repository/CivilityRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/CivilityRepositoryInterface.php index f838b54e8..5d687ac7e 100644 --- a/src/Bundle/ChillMainBundle/Repository/CivilityRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/CivilityRepositoryInterface.php @@ -26,7 +26,7 @@ interface CivilityRepositoryInterface extends ObjectRepository /** * @return array|Civility[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?Civility; diff --git a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php index 000ecb4e1..701019dba 100644 --- a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php @@ -26,7 +26,7 @@ final class CountryRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Country::class); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -50,12 +50,12 @@ final class CountryRepository implements ObjectRepository * * @return Country[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Country + public function findOneBy(array $criteria, ?array $orderBy = null): ?Country { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php index 8fa4ea8f6..1f369ef4e 100644 --- a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php @@ -40,7 +40,7 @@ class CronJobExecutionRepository implements CronJobExecutionRepositoryInterface /** * @return array|CronJobExecution[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepositoryInterface.php index cef997edd..df894bbfb 100644 --- a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepositoryInterface.php @@ -26,7 +26,7 @@ interface CronJobExecutionRepositoryInterface extends ObjectRepository /** * @return array|CronJobExecution[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?CronJobExecution; diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php index 88d92a7dc..11a03c209 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php @@ -49,7 +49,7 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye /** * @return array|GeographicalUnitLayer[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php index 2bb22b842..608609a11 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php @@ -86,7 +86,7 @@ final class GeographicalUnitRepository implements GeographicalUnitRepositoryInte ->getResult(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): ?GeographicalUnit + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): ?GeographicalUnit { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php index a07087369..2d9ad8c5a 100644 --- a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php @@ -44,12 +44,12 @@ final class GroupCenterRepository implements ObjectRepository * * @return GroupCenter[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?GroupCenter + public function findOneBy(array $criteria, ?array $orderBy = null): ?GroupCenter { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php index 1bbf2c168..d8c5d54f8 100644 --- a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php @@ -43,12 +43,12 @@ final class LanguageRepository implements LanguageRepositoryInterface * * @return Language[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Language + public function findOneBy(array $criteria, ?array $orderBy = null): ?Language { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/LanguageRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/LanguageRepositoryInterface.php index ab110fc24..397b264e4 100644 --- a/src/Bundle/ChillMainBundle/Repository/LanguageRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/LanguageRepositoryInterface.php @@ -29,9 +29,9 @@ interface LanguageRepositoryInterface extends ObjectRepository * * @return Language[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; - public function findOneBy(array $criteria, array $orderBy = null): ?Language; + public function findOneBy(array $criteria, ?array $orderBy = null): ?Language; public function getClassName(): string; } diff --git a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php index bc26981b2..ef7e05240 100644 --- a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php @@ -194,7 +194,7 @@ final class NotificationRepository implements ObjectRepository * * @return Notification[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -214,7 +214,7 @@ final class NotificationRepository implements ObjectRepository ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?Notification + public function findOneBy(array $criteria, ?array $orderBy = null): ?Notification { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php index 59b7c93a4..910d924db 100644 --- a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php @@ -57,12 +57,12 @@ final class PermissionsGroupRepository implements ObjectRepository * * @return PermissionsGroup[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?PermissionsGroup + public function findOneBy(array $criteria, ?array $orderBy = null): ?PermissionsGroup { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php index 45e10816a..0949f52ba 100644 --- a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php @@ -54,7 +54,7 @@ final class PostalCodeRepository implements PostalCodeRepositoryInterface return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -79,7 +79,7 @@ final class PostalCodeRepository implements PostalCodeRepositoryInterface ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?PostalCode + public function findOneBy(array $criteria, ?array $orderBy = null): ?PostalCode { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepositoryInterface.php index 590598cb0..fe3dee195 100644 --- a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepositoryInterface.php @@ -32,11 +32,11 @@ interface PostalCodeRepositoryInterface extends ObjectRepository * * @return PostalCode[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; public function findByPattern(string $pattern, ?Country $country, ?int $start = 0, ?int $limit = 50): array; - public function findOneBy(array $criteria, array $orderBy = null): ?PostalCode; + public function findOneBy(array $criteria, ?array $orderBy = null): ?PostalCode; public function getClassName(): string; } diff --git a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php index cd51b7913..e18279944 100644 --- a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php @@ -51,12 +51,12 @@ final class RegroupmentRepository implements ObjectRepository * * @return Regroupment[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Regroupment + public function findOneBy(array $criteria, ?array $orderBy = null): ?Regroupment { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php index 6ee488ffe..ddf52af5b 100644 --- a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php @@ -44,12 +44,12 @@ final class RoleScopeRepository implements ObjectRepository * * @return RoleScope[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?RoleScope + public function findOneBy(array $criteria, ?array $orderBy = null): ?RoleScope { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php b/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php index 4c0a5035b..702fdf7d6 100644 --- a/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php @@ -42,12 +42,12 @@ class SavedExportRepository implements SavedExportRepositoryInterface return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findByUser(User $user, ?array $orderBy = [], int $limit = null, int $offset = null): array + public function findByUser(User $user, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array { $qb = $this->repository->createQueryBuilder('se'); diff --git a/src/Bundle/ChillMainBundle/Repository/SavedExportRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/SavedExportRepositoryInterface.php index 488139846..3b168505f 100644 --- a/src/Bundle/ChillMainBundle/Repository/SavedExportRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/SavedExportRepositoryInterface.php @@ -27,12 +27,12 @@ interface SavedExportRepositoryInterface extends ObjectRepository */ public function findAll(): array; - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; /** * @return array|SavedExport[] */ - public function findByUser(User $user, ?array $orderBy = [], int $limit = null, int $offset = null): array; + public function findByUser(User $user, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?SavedExport; diff --git a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php index 21e55954b..ba4ddae9b 100644 --- a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php @@ -58,12 +58,12 @@ final class ScopeRepository implements ScopeRepositoryInterface * * @return Scope[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Scope + public function findOneBy(array $criteria, ?array $orderBy = null): ?Scope { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/ScopeRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/ScopeRepositoryInterface.php index 6c68b08b2..436be847b 100644 --- a/src/Bundle/ChillMainBundle/Repository/ScopeRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/ScopeRepositoryInterface.php @@ -37,9 +37,9 @@ interface ScopeRepositoryInterface extends ObjectRepository * * @return Scope[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; - public function findOneBy(array $criteria, array $orderBy = null): ?Scope; + public function findOneBy(array $criteria, ?array $orderBy = null): ?Scope; public function getClassName(): string; } diff --git a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php index dee7ac9d7..3c92c7f60 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php @@ -58,7 +58,7 @@ readonly class UserJobRepository implements UserJobRepositoryInterface * * @return array|object[]|UserJob[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Repository/UserJobRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/UserJobRepositoryInterface.php index ef7488042..75c2a5671 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserJobRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/UserJobRepositoryInterface.php @@ -41,7 +41,7 @@ interface UserJobRepositoryInterface extends ObjectRepository * * @return array|object[]|UserJob[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null); + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null); public function findOneBy(array $criteria): ?UserJob; diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php index 3bc24a6ac..dc5a9adfe 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php @@ -164,7 +164,7 @@ final readonly class UserRepository implements UserRepositoryInterface * * @return User[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -172,7 +172,7 @@ final readonly class UserRepository implements UserRepositoryInterface /** * @return array|User[] */ - public function findByActive(array $orderBy = null, int $limit = null, int $offset = null): array + public function findByActive(?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->findBy(['enabled' => true], $orderBy, $limit, $offset); } @@ -182,7 +182,7 @@ final readonly class UserRepository implements UserRepositoryInterface * * @return array|User[] */ - public function findByNotHavingAttribute(string $key, int $limit = null, int $offset = null): array + public function findByNotHavingAttribute(string $key, ?int $limit = null, ?int $offset = null): array { $rsm = new ResultSetMappingBuilder($this->entityManager); $rsm->addRootEntityFromClassMetadata(User::class, 'u'); @@ -200,7 +200,7 @@ final readonly class UserRepository implements UserRepositoryInterface return $this->entityManager->createNativeQuery($sql, $rsm)->setParameter(':key', $key)->getResult(); } - public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], int $limit = null, int $offset = null): array + public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array { $qb = $this->queryByUsernameOrEmail($pattern); @@ -221,7 +221,7 @@ final readonly class UserRepository implements UserRepositoryInterface return $qb->getQuery()->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?User + public function findOneBy(array $criteria, ?array $orderBy = null): ?User { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/UserRepositoryInterface.php index f05da315d..b7a20f315 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepositoryInterface.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepositoryInterface.php @@ -51,16 +51,16 @@ interface UserRepositoryInterface extends ObjectRepository /** * @return array|User[] */ - public function findByActive(array $orderBy = null, int $limit = null, int $offset = null): array; + public function findByActive(?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; /** * Find users which does not have a key on attribute column. * * @return array|User[] */ - public function findByNotHavingAttribute(string $key, int $limit = null, int $offset = null): array; + public function findByNotHavingAttribute(string $key, ?int $limit = null, ?int $offset = null): array; - public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], int $limit = null, int $offset = null): array; + public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array; public function findOneByUsernameOrEmail(string $pattern): ?User; diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php index 234ea258e..66b3ab379 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php @@ -105,12 +105,12 @@ class EntityWorkflowRepository implements ObjectRepository * * @return array|EntityWorkflow[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findByCc(User $user, array $orderBy = null, $limit = null, $offset = null): array + public function findByCc(User $user, ?array $orderBy = null, $limit = null, $offset = null): array { $qb = $this->buildQueryByCc($user)->select('ew'); @@ -123,7 +123,7 @@ class EntityWorkflowRepository implements ObjectRepository return $qb->getQuery()->getResult(); } - public function findByDest(User $user, array $orderBy = null, $limit = null, $offset = null): array + public function findByDest(User $user, ?array $orderBy = null, $limit = null, $offset = null): array { $qb = $this->buildQueryByDest($user)->select('ew'); @@ -136,7 +136,7 @@ class EntityWorkflowRepository implements ObjectRepository return $qb->getQuery()->getResult(); } - public function findByPreviousDestWithoutReaction(User $user, array $orderBy = null, $limit = null, $offset = null): array + public function findByPreviousDestWithoutReaction(User $user, ?array $orderBy = null, $limit = null, $offset = null): array { $qb = $this->buildQueryByPreviousDestWithoutReaction($user)->select('ew'); @@ -149,7 +149,7 @@ class EntityWorkflowRepository implements ObjectRepository return $qb->getQuery()->getResult(); } - public function findByPreviousTransitionned(User $user, array $orderBy = null, $limit = null, $offset = null): array + public function findByPreviousTransitionned(User $user, ?array $orderBy = null, $limit = null, $offset = null): array { $qb = $this->buildQueryByPreviousTransitionned($user)->select('ew')->distinct(true); @@ -162,7 +162,7 @@ class EntityWorkflowRepository implements ObjectRepository return $qb->getQuery()->getResult(); } - public function findBySubscriber(User $user, array $orderBy = null, $limit = null, $offset = null): array + public function findBySubscriber(User $user, ?array $orderBy = null, $limit = null, $offset = null): array { $qb = $this->buildQueryBySubscriber($user)->select('ew'); diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php index d7e5455ba..545ec2873 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -27,7 +27,7 @@ class EntityWorkflowStepRepository implements ObjectRepository $this->repository = $entityManager->getRepository(EntityWorkflowStep::class); } - public function countUnreadByUser(User $user, array $orderBy = null, $limit = null, $offset = null): int + public function countUnreadByUser(User $user, ?array $orderBy = null, $limit = null, $offset = null): int { $qb = $this->buildQueryByUser($user)->select('count(e)'); @@ -44,7 +44,7 @@ class EntityWorkflowStepRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index 2989187a8..7431833ab 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -87,7 +87,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface return 'chill_menu'; } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { $this->container = $container; } diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php index b16cec9c5..d7920097c 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php @@ -17,7 +17,7 @@ class SearchApiNoQueryException extends \RuntimeException private readonly array $types; - public function __construct(string $pattern = '', array $types = [], private readonly array $parameters = [], $code = 0, \Throwable $previous = null) + public function __construct(string $pattern = '', array $types = [], private readonly array $parameters = [], $code = 0, ?\Throwable $previous = null) { $typesStr = \implode(', ', $types); $message = "No query for this search: pattern : {$pattern}, types: {$typesStr}"; diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index 7e5d8a325..48c9b836f 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -61,7 +61,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @return User[] */ - public function findUsersReaching(string $role, array|Center $center, array|Scope $scope = null, bool $onlyEnabled = true): array + public function findUsersReaching(string $role, array|Center $center, array|Scope|null $scope = null, bool $onlyEnabled = true): array { return $this->userACLAwareRepository ->findUsersByReachedACL($role, $center, $scope, $onlyEnabled); @@ -86,7 +86,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @return list
*/ - public function getReachableCenters(UserInterface $user, string $role, Scope $scope = null): array + public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array { if (!$user instanceof User) { return []; diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php index 4bc07f915..0a9d837a6 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php @@ -21,7 +21,7 @@ class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrent { } - public function getReachableCenters(string $role, Scope $scope = null): array + public function getReachableCenters(string $role, ?Scope $scope = null): array { if (!$this->security->getUser() instanceof User) { return []; diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUserInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUserInterface.php index 04b34c8e5..d0e0085a5 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUserInterface.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUserInterface.php @@ -22,7 +22,7 @@ interface AuthorizationHelperForCurrentUserInterface * * @return Center[] */ - public function getReachableCenters(string $role, Scope $scope = null): array; + public function getReachableCenters(string $role, ?Scope $scope = null): array; /** * @param list
|Center $center diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php index 5df54a0d6..cea27f1ad 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php @@ -23,7 +23,7 @@ interface AuthorizationHelperInterface * * @return list
*/ - public function getReachableCenters(UserInterface $user, string $role, Scope $scope = null): array; + public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array; /** * @param Center|array
$center diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index ce1e16862..a61d92b4a 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -37,7 +37,7 @@ final readonly class ScopeResolverDispatcher /** * @return Scope|iterable|Scope|null */ - public function resolveScope(mixed $entity, ?array $options = []): null|iterable|Scope + public function resolveScope(mixed $entity, ?array $options = []): iterable|Scope|null { foreach ($this->resolvers as $resolver) { if ($resolver->supports($entity, $options)) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index e1d692a19..4cf80ccd7 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -32,7 +32,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa * * @throws ExceptionInterface */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { if (null === $object || $object->isEmpty()) { return [ @@ -65,7 +65,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa ]; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { if ('docgen' !== $format) { return false; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php index df125994d..83e84f7a0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php @@ -32,7 +32,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn * * @return array */ - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, ?string $format = null, array $context = []) { $workflow = $this->registry->get($object, $object->getWorkflowName()); $handler = $this->entityWorkflowManager->getHandler($object); @@ -50,7 +50,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn ]; } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, ?string $format = null): bool { return $data instanceof EntityWorkflow && 'json' === $format; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 47ec0427e..46dbd00cc 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -28,7 +28,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz /** * @param EntityWorkflowStep $object */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { $data = [ 'type' => 'entity_workflow_step', @@ -77,7 +77,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz return $data; } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, ?string $format = null): bool { return $data instanceof EntityWorkflowStep && 'json' === $format; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 50b3e33f6..70cd9a838 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -32,7 +32,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte * * @return array|\ArrayObject|bool|float|int|string|void|null */ - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, ?string $format = null, array $context = []) { $entity = $this->entityManager ->getRepository($object->getRelatedEntityClass()) @@ -53,7 +53,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte ]; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, ?string $format = null) { return $data instanceof Notification && 'json' === $format; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index 583c8a75b..28d7c623d 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -50,7 +50,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal } } - public function normalize($object, string $format = null, array $context = []): string + public function normalize($object, ?string $format = null, array $context = []): string { if ('docgen' === $format && null === $object) { return ''; @@ -64,7 +64,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal return 'libphonenumber\PhoneNumber' === $type; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { if ($data instanceof PhoneNumber && 'json' === $format) { return true; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php index 80407a6b1..1d7ee43ce 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -22,7 +22,7 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma { } - public function denormalize($data, string $type, string $format = null, array $context = []): PrivateCommentEmbeddable + public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable { $comment = new PrivateCommentEmbeddable(); @@ -40,12 +40,12 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma return $object->getCommentForUser($this->security->getUser()); } - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, ?string $format = null): bool { return PrivateCommentEmbeddable::class === $type; } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, ?string $format = null): bool { return $data instanceof PrivateCommentEmbeddable; } diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php index d2c9fc960..0267b126d 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php @@ -41,7 +41,7 @@ final readonly class CollateAddressWithReferenceOrPostalCodeCronJob implements C return 'collate-address'; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { $maxId = ($this->collateAddressWithReferenceOrPostalCode)($lastExecutionData[self::LAST_MAX_ID] ?? 0); diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index 31982d6eb..46c79a250 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -46,7 +46,7 @@ final readonly class RefreshAddressToGeographicalUnitMaterializedViewCronJob imp return 'refresh-materialized-view-address-to-geog-units'; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { $this->connection->executeQuery('REFRESH MATERIALIZED VIEW view_chill_main_address_geographical_unit'); diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php index 1eaf42e76..9407bd600 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php @@ -68,9 +68,9 @@ final class AddressReferenceBaseImporter string $street, string $streetNumber, string $source, - float $lat = null, - float $lon = null, - int $srid = null + ?float $lat = null, + ?float $lon = null, + ?int $srid = null ): void { if (!$this->isInitialized) { $this->initialize($source); diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index 6196f8fad..6b6885ff2 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -66,7 +66,7 @@ final class GeographicalUnitBaseImporter string $unitName, string $unitKey, string $geomAsWKT, - int $srid = null + ?int $srid = null ): void { $this->initialize(); diff --git a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php index b0bfae2b3..0d5d6b2d8 100644 --- a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php +++ b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php @@ -26,7 +26,7 @@ class ChillMailer implements MailerInterface { } - public function send(RawMessage $message, Envelope $envelope = null): void + public function send(RawMessage $message, ?Envelope $envelope = null): void { if ($message instanceof Email) { $message->subject($this->prefix.$message->getSubject()); diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index ebce380b0..9f42461c6 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -76,7 +76,7 @@ final class FilterOrderHelper return $this->entityChoices; } - public function addUserPicker(string $name, string $label = null, array $options = []): self + public function addUserPicker(string $name, ?string $label = null, array $options = []): self { $this->userPickers[$name] = ['label' => $label, 'options' => $options]; @@ -99,7 +99,7 @@ final class FilterOrderHelper return $this; } - public function addDateRange(string $name, string $label = null, \DateTimeImmutable $from = null, \DateTimeImmutable $to = null): self + public function addDateRange(string $name, ?string $label = null, ?\DateTimeImmutable $from = null, ?\DateTimeImmutable $to = null): self { $this->dateRanges[$name] = ['from' => $from, 'to' => $to, 'label' => $label]; diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index 4bef35046..14189b88d 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -65,7 +65,7 @@ class FilterOrderHelperBuilder return $this; } - public function addDateRange(string $name, string $label = null, \DateTimeImmutable $from = null, \DateTimeImmutable $to = null): self + public function addDateRange(string $name, ?string $label = null, ?\DateTimeImmutable $from = null, ?\DateTimeImmutable $to = null): self { $this->dateRanges[$name] = ['from' => $from, 'to' => $to, 'label' => $label]; @@ -79,7 +79,7 @@ class FilterOrderHelperBuilder return $this; } - public function addUserPicker(string $name, string $label = null, ?array $options = []): self + public function addUserPicker(string $name, ?string $label = null, ?array $options = []): self { $this->userPickers[$name] = ['label' => $label, 'options' => $options]; diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php index 594bd6460..38e2c9509 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php @@ -91,7 +91,7 @@ class JobWithReturn implements CronJobInterface return 'with-data'; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { return ['data' => 'test']; } diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index 489bab4cb..417e1117b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -175,7 +175,7 @@ class JobCanRun implements CronJobInterface return $this->key; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { return null; } @@ -193,7 +193,7 @@ class JobCannotRun implements CronJobInterface return 'job-b'; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { return null; } diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index 44091f38b..8d71a132b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -498,11 +498,11 @@ final class ExportManagerTest extends KernelTestCase * user 'center a_social' from database. */ protected function createExportManager( - LoggerInterface $logger = null, - EntityManagerInterface $em = null, - AuthorizationCheckerInterface $authorizationChecker = null, - AuthorizationHelper $authorizationHelper = null, - UserInterface $user = null, + ?LoggerInterface $logger = null, + ?EntityManagerInterface $em = null, + ?AuthorizationCheckerInterface $authorizationChecker = null, + ?AuthorizationHelper $authorizationHelper = null, + ?UserInterface $user = null, array $exports = [], array $aggregators = [], array $filters = [], diff --git a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php index d7fdc49c8..a14747c68 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php @@ -102,7 +102,7 @@ class SortExportElementTest extends KernelTestCase private function makeTranslator(): TranslatorInterface { return new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } diff --git a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php index 2bd7708b8..fad4a89f5 100644 --- a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php @@ -113,7 +113,7 @@ class NotificationMailerTest extends TestCase } private function buildNotificationMailer( - MailerInterface $mailer = null, + ?MailerInterface $mailer = null, ): NotificationMailer { return new NotificationMailer( $mailer, diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php index c820b615d..8d80490c1 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php @@ -84,7 +84,7 @@ final class DateNormalizerTest extends KernelTestCase $this->assertFalse($this->buildDateNormalizer()->supportsNormalization(new \DateTime(), 'xml')); } - private function buildDateNormalizer(string $locale = null): DateNormalizer + private function buildDateNormalizer(?string $locale = null): DateNormalizer { $requestStack = $this->prophet->prophesize(RequestStack::class); $parameterBag = new ParameterBag(); diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php index 123f1c3ae..15334298e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php @@ -117,19 +117,19 @@ final class UserNormalizerTest extends TestCase * * @throws ExceptionInterface */ - public function testNormalize(null|User $user, mixed $format, mixed $context, mixed $expected) + public function testNormalize(User|null $user, mixed $format, mixed $context, mixed $expected) { $userRender = $this->prophesize(UserRender::class); $userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : ''); $normalizer = new UserNormalizer($userRender->reveal()); $normalizer->setNormalizer(new class () implements NormalizerInterface { - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, ?string $format = null, array $context = []) { return ['context' => $context['docgen:expects'] ?? null]; } - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, ?string $format = null) { return true; } diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php index 821c66e4e..b91d7627a 100644 --- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php +++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php @@ -66,7 +66,7 @@ class DateRangeCovering $this->minCover = $minCover; } - public function add(\DateTimeInterface $start, \DateTimeInterface $end = null, $metadata = null): self + public function add(\DateTimeInterface $start, ?\DateTimeInterface $end = null, $metadata = null): self { if ($this->computed) { throw new \LogicException('You cannot add intervals to a computed instance'); @@ -152,7 +152,7 @@ class DateRangeCovering return \count($this->intersections) > 0; } - private function addToSequence($timestamp, int $start = null, int $end = null) + private function addToSequence($timestamp, ?int $start = null, ?int $end = null) { if (!\array_key_exists($timestamp, $this->sequence)) { $this->sequence[$timestamp] = ['s' => [], 'e' => []]; diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index 05ee58d87..8f0caa62e 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -45,7 +45,7 @@ class MetadataExtractor return $workflowsList; } - public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, EntityWorkflowStep $step = null): array + public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, ?EntityWorkflowStep $step = null): array { $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); $step ??= $entityWorkflow->getCurrentStep(); diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php index 2ddf3415c..33d88e7de 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php @@ -39,7 +39,7 @@ readonly class AccompanyingPeriodStepChangeCronjob implements CronJobInterface return 'accompanying-period-step-change'; } - public function run(array $lastExecutionData): null|array + public function run(array $lastExecutionData): array|null { ($this->requestor)(); diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php index b0fe4c5b2..7e9f87939 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php @@ -33,7 +33,7 @@ class AccompanyingPeriodStepChanger ) { } - public function __invoke(AccompanyingPeriod $period, string $transition, string $workflowName = null): void + public function __invoke(AccompanyingPeriod $period, string $transition, ?string $workflowName = null): void { $workflow = $this->workflowRegistry->get($period, $workflowName); diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index a83b831f1..f8e305552 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -143,7 +143,7 @@ class ReassignAccompanyingPeriodController extends AbstractController return $builder->getForm(); } - private function buildReassignForm(array $periodIds, User $userFrom = null): FormInterface + private function buildReassignForm(array $periodIds, ?User $userFrom = null): FormInterface { $defaultData = [ 'userFrom' => $userFrom, diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php index 7b1dd4211..316417583 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/SocialIssueController.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; class SocialIssueController extends CRUDController { - protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface + protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface { if ('new' === $action) { return parent::createFormFor($action, $entity, $formClass, ['step' => 'create']); diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php index 38d13ea43..229a69f2c 100644 --- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php +++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php @@ -40,7 +40,7 @@ abstract class AddressPart extends FunctionNode 'country_id', ]; - private null|\Doctrine\ORM\Query\AST\Node|string $date = null; + private \Doctrine\ORM\Query\AST\Node|string|null $date = null; /** * @var \Doctrine\ORM\Query\AST\Node diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 4302a17f4..9c88a4a69 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -479,7 +479,7 @@ class AccompanyingPeriod implements * * @uses AccompanyingPeriod::setClosingDate() */ - public function __construct(\DateTime $dateOpening = null) + public function __construct(?\DateTime $dateOpening = null) { $this->calendars = new ArrayCollection(); // TODO we cannot add a dependency between AccompanyingPeriod and calendars $this->participations = new ArrayCollection(); @@ -575,7 +575,7 @@ class AccompanyingPeriod implements return $this; } - public function addPerson(Person $person = null): self + public function addPerson(?Person $person = null): self { if (null !== $person) { $this->createParticipationFor($person); @@ -829,7 +829,7 @@ class AccompanyingPeriod implements * * @Groups({"read"}) */ - public function getLocation(\DateTimeImmutable $at = null): ?Address + public function getLocation(?\DateTimeImmutable $at = null): ?Address { if ($this->getPersonLocation() instanceof Person) { return $this->getPersonLocation()->getCurrentPersonAddress(); @@ -1029,7 +1029,7 @@ class AccompanyingPeriod implements /** * @Groups({"read"}) */ - public function getRequestor(): null|Person|ThirdParty + public function getRequestor(): Person|ThirdParty|null { return $this->requestorPerson ?? $this->requestorThirdParty; } @@ -1257,7 +1257,7 @@ class AccompanyingPeriod implements /** * @Groups({"write"}) */ - public function setAddressLocation(Address $addressLocation = null): self + public function setAddressLocation(?Address $addressLocation = null): self { if ($this->addressLocation !== $addressLocation) { $this->addressLocation = $addressLocation; @@ -1297,7 +1297,7 @@ class AccompanyingPeriod implements return $this; } - public function setClosingMotive(ClosingMotive $closingMotive = null): self + public function setClosingMotive(?ClosingMotive $closingMotive = null): self { $this->closingMotive = $closingMotive; @@ -1372,7 +1372,7 @@ class AccompanyingPeriod implements /** * @Groups({"write"}) */ - public function setPersonLocation(Person $person = null): self + public function setPersonLocation(?Person $person = null): self { if ($this->personLocation !== $person) { $this->personLocation = $person; @@ -1394,7 +1394,7 @@ class AccompanyingPeriod implements /** * @Groups({"write"}) */ - public function setPinnedComment(Comment $comment = null): self + public function setPinnedComment(?Comment $comment = null): self { if (null !== $this->pinnedComment) { $this->addComment($this->pinnedComment); @@ -1405,7 +1405,7 @@ class AccompanyingPeriod implements return $this; } - public function setRemark(string $remark = null): self + public function setRemark(?string $remark = null): self { $this->remark = (string) $remark; @@ -1566,14 +1566,14 @@ class AccompanyingPeriod implements } while ($steps->valid()); } - private function setRequestorPerson(Person $requestorPerson = null): self + private function setRequestorPerson(?Person $requestorPerson = null): self { $this->requestorPerson = $requestorPerson; return $this; } - private function setRequestorThirdParty(ThirdParty $requestorThirdParty = null): self + private function setRequestorThirdParty(?ThirdParty $requestorThirdParty = null): self { $this->requestorThirdParty = $requestorThirdParty; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php index ab6e66f1c..700076506 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodLocationHistory.php @@ -91,14 +91,14 @@ class AccompanyingPeriodLocationHistory implements TrackCreationInterface return $this->startDate; } - public function setAddressLocation(?Address $addressLocation): AccompanyingPeriod\AccompanyingPeriodLocationHistory + public function setAddressLocation(?Address $addressLocation): AccompanyingPeriodLocationHistory { $this->addressLocation = $addressLocation; return $this; } - public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriod\AccompanyingPeriodLocationHistory + public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriodLocationHistory { $this->endDate = $endDate; @@ -108,21 +108,21 @@ class AccompanyingPeriodLocationHistory implements TrackCreationInterface /** * @internal use AccompanyingPeriod::addLocationHistory */ - public function setPeriod(AccompanyingPeriod $period): AccompanyingPeriod\AccompanyingPeriodLocationHistory + public function setPeriod(AccompanyingPeriod $period): AccompanyingPeriodLocationHistory { $this->period = $period; return $this; } - public function setPersonLocation(?Person $personLocation): AccompanyingPeriod\AccompanyingPeriodLocationHistory + public function setPersonLocation(?Person $personLocation): AccompanyingPeriodLocationHistory { $this->personLocation = $personLocation; return $this; } - public function setStartDate(?\DateTimeImmutable $startDate): AccompanyingPeriod\AccompanyingPeriodLocationHistory + public function setStartDate(?\DateTimeImmutable $startDate): AccompanyingPeriodLocationHistory { $this->startDate = $startDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php index 5a3ed774c..15b2f0d2e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php @@ -108,7 +108,7 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda return $this; } - public function setStep(string $step): AccompanyingPeriod\AccompanyingPeriodStepHistory + public function setStep(string $step): AccompanyingPeriodStepHistory { $this->step = $step; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index afb4b1c82..77906b1ba 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -255,7 +255,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues $this->referrersHistory = new ArrayCollection(); } - public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriod\AccompanyingPeriodWorkEvaluation $evaluation): self + public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self { if (!$this->accompanyingPeriodWorkEvaluations->contains($evaluation)) { $this->accompanyingPeriodWorkEvaluations[] = $evaluation; @@ -265,7 +265,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function addGoal(AccompanyingPeriod\AccompanyingPeriodWorkGoal $goal): self + public function addGoal(AccompanyingPeriodWorkGoal $goal): self { if (!$this->goals->contains($goal)) { $this->goals[] = $goal; @@ -288,7 +288,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues { if (!$this->getReferrers()->contains($referrer)) { $this->referrersHistory[] = - new AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory($this, $referrer, new \DateTimeImmutable('today')); + new AccompanyingPeriodWorkReferrerHistory($this, $referrer, new \DateTimeImmutable('today')); } return $this; @@ -393,8 +393,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function getReferrers(): ReadableCollection { $users = $this->referrersHistory - ->filter(fn (AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate()) - ->map(fn (AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()) + ->filter(fn (AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate()) + ->map(fn (AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()) ->getValues() ; @@ -452,7 +452,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this->updatedBy; } - public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriod\AccompanyingPeriodWorkEvaluation $evaluation): self + public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self { $this->accompanyingPeriodWorkEvaluations ->removeElement($evaluation); @@ -461,7 +461,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function removeGoal(AccompanyingPeriod\AccompanyingPeriodWorkGoal $goal): self + public function removeGoal(AccompanyingPeriodWorkGoal $goal): self { if ($this->goals->removeElement($goal)) { // set the owning side to null (unless already changed) @@ -563,7 +563,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues return $this; } - public function setEndDate(\DateTimeInterface $endDate = null): self + public function setEndDate(?\DateTimeInterface $endDate = null): self { $this->endDate = $endDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index 99ef4f7da..f0ff1d956 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -107,7 +107,7 @@ class Resource /** * @Groups({"read"}) */ - public function getResource(): null|Person|ThirdParty + public function getResource(): Person|ThirdParty|null { return $this->person ?? $this->thirdParty; } @@ -124,7 +124,7 @@ class Resource return $this; } - public function setComment(string $comment = null): self + public function setComment(?string $comment = null): self { $this->comment = (string) $comment; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php index 29696cfe1..41b798a3f 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -86,7 +86,7 @@ class UserHistory implements TrackCreationInterface return $this->user; } - public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriod\UserHistory + public function setEndDate(?\DateTimeImmutable $endDate): UserHistory { $this->endDate = $endDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/HasPerson.php b/src/Bundle/ChillPersonBundle/Entity/HasPerson.php index ba4f3699d..ab0854a57 100644 --- a/src/Bundle/ChillPersonBundle/Entity/HasPerson.php +++ b/src/Bundle/ChillPersonBundle/Entity/HasPerson.php @@ -18,5 +18,5 @@ interface HasPerson { public function getPerson(): ?Person; - public function setPerson(Person $person = null): HasPerson; + public function setPerson(?Person $person = null): HasPerson; } diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index 6d5bdf674..cc0ff2d69 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -214,7 +214,7 @@ class Household * * @Serializer\SerializedName("current_address") */ - public function getCurrentAddress(\DateTime $at = null): ?Address + public function getCurrentAddress(?\DateTime $at = null): ?Address { $at ??= new \DateTime('today'); @@ -234,7 +234,7 @@ class Household * * @Serializer\SerializedName("current_composition") */ - public function getCurrentComposition(\DateTimeImmutable $at = null): ?HouseholdComposition + public function getCurrentComposition(?\DateTimeImmutable $at = null): ?HouseholdComposition { $at ??= new \DateTimeImmutable('today'); $criteria = new Criteria(); @@ -262,12 +262,12 @@ class Household /** * @Serializer\Groups({"docgen:read"}) */ - public function getCurrentMembers(\DateTimeImmutable $now = null): Collection + public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection { return $this->getMembers()->matching($this->buildCriteriaCurrentMembers($now)); } - public function getCurrentMembersByPosition(Position $position, \DateTimeInterface $now = null) + public function getCurrentMembersByPosition(Position $position, ?\DateTimeInterface $now = null) { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -286,7 +286,7 @@ class Household * * @Serializer\SerializedName("current_members_id") */ - public function getCurrentMembersIds(\DateTimeImmutable $now = null): ReadableCollection + public function getCurrentMembersIds(?\DateTimeImmutable $now = null): ReadableCollection { return $this->getCurrentMembers($now)->map( static fn (HouseholdMember $m) => $m->getId() @@ -296,7 +296,7 @@ class Household /** * @return HouseholdMember[] */ - public function getCurrentMembersOrdered(\DateTimeImmutable $now = null): Collection + public function getCurrentMembersOrdered(?\DateTimeImmutable $now = null): Collection { $members = $this->getCurrentMembers($now); @@ -338,7 +338,7 @@ class Household return $members; } - public function getCurrentMembersWithoutPosition(\DateTimeInterface $now = null) + public function getCurrentMembersWithoutPosition(?\DateTimeInterface $now = null) { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -355,7 +355,7 @@ class Household * * @return ReadableCollection<(int|string), Person> */ - public function getCurrentPersons(\DateTimeImmutable $now = null): ReadableCollection + public function getCurrentPersons(?\DateTimeImmutable $now = null): ReadableCollection { return $this->getCurrentMembers($now) ->map(static fn (HouseholdMember $m) => $m->getPerson()); @@ -424,7 +424,7 @@ class Household }); } - public function getNonCurrentMembers(\DateTimeImmutable $now = null): Collection + public function getNonCurrentMembers(?\DateTimeImmutable $now = null): Collection { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -444,7 +444,7 @@ class Household return $this->getMembers()->matching($criteria); } - public function getNonCurrentMembersByPosition(Position $position, \DateTimeInterface $now = null) + public function getNonCurrentMembersByPosition(Position $position, ?\DateTimeInterface $now = null) { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -454,7 +454,7 @@ class Household return $this->getNonCurrentMembers($now)->matching($criteria); } - public function getNonCurrentMembersWithoutPosition(\DateTimeInterface $now = null) + public function getNonCurrentMembersWithoutPosition(?\DateTimeInterface $now = null) { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -644,7 +644,7 @@ class Household } } - private function buildCriteriaCurrentMembers(\DateTimeImmutable $now = null): Criteria + private function buildCriteriaCurrentMembers(?\DateTimeImmutable $now = null): Criteria { $criteria = new Criteria(); $expr = Criteria::expr(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php index ccce246c8..21c28f52e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php @@ -153,7 +153,7 @@ class HouseholdMember return $this->startDate; } - public function isCurrent(\DateTimeImmutable $at = null): bool + public function isCurrent(?\DateTimeImmutable $at = null): bool { $at ??= new \DateTimeImmutable('now'); @@ -174,7 +174,7 @@ class HouseholdMember return $this; } - public function setEndDate(\DateTimeImmutable $endDate = null): self + public function setEndDate(?\DateTimeImmutable $endDate = null): self { $this->endDate = $endDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 050be3260..cd28da9a7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -671,7 +671,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @throws \Exception if two lines of the accompanying period are open */ - public function close(AccompanyingPeriod $accompanyingPeriod = null): void + public function close(?AccompanyingPeriod $accompanyingPeriod = null): void { $this->proxyAccompanyingPeriodOpenState = false; } @@ -854,7 +854,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @throws \Exception */ - public function getAddressAt(\DateTimeInterface $at = null): ?Address + public function getAddressAt(?\DateTimeInterface $at = null): ?Address { $at ??= new \DateTime('now'); @@ -1035,7 +1035,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $currentAccompanyingPeriods; } - public function getCurrentHousehold(\DateTimeImmutable $at = null): ?Household + public function getCurrentHousehold(?\DateTimeImmutable $at = null): ?Household { $participation = $this->getCurrentHouseholdParticipationShareHousehold($at); @@ -1050,7 +1050,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * if the given date is 'now', use instead @see{getCurrentPersonAddress}, which is optimized on * database side. */ - public function getCurrentHouseholdAddress(\DateTimeImmutable $at = null): ?Address + public function getCurrentHouseholdAddress(?\DateTimeImmutable $at = null): ?Address { if ( null === $at @@ -1084,7 +1084,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return null; } - public function getCurrentHouseholdParticipationShareHousehold(\DateTimeImmutable $at = null): ?HouseholdMember + public function getCurrentHouseholdParticipationShareHousehold(?\DateTimeImmutable $at = null): ?HouseholdMember { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -1253,7 +1253,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * * @throws \Exception */ - public function getLastAddress(\DateTime $from = null) + public function getLastAddress(?\DateTime $from = null) { return $this->getCurrentHouseholdAddress( null !== $from ? \DateTimeImmutable::createFromMutable($from) : null @@ -1381,7 +1381,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this->updatedBy; } - public function hasCurrentHouseholdAddress(\DateTimeImmutable $at = null): bool + public function hasCurrentHouseholdAddress(?\DateTimeImmutable $at = null): bool { return null !== $this->getCurrentHouseholdAddress($at); } @@ -1468,7 +1468,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return false; } - public function isSharingHousehold(\DateTimeImmutable $at = null): bool + public function isSharingHousehold(?\DateTimeImmutable $at = null): bool { return null !== $this->getCurrentHousehold($at); } @@ -1619,7 +1619,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function setCivility(Civility $civility = null): self + public function setCivility(?Civility $civility = null): self { $this->civility = $civility; @@ -1637,7 +1637,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function setCountryOfBirth(Country $countryOfBirth = null): self + public function setCountryOfBirth(?Country $countryOfBirth = null): self { $this->countryOfBirth = $countryOfBirth; @@ -1707,7 +1707,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function setMaritalStatus(MaritalStatus $maritalStatus = null): self + public function setMaritalStatus(?MaritalStatus $maritalStatus = null): self { $this->maritalStatus = $maritalStatus; @@ -1748,7 +1748,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - public function setNationality(Country $nationality = null): self + public function setNationality(?Country $nationality = null): self { $this->nationality = $nationality; diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php index 3cc618af4..551f8fd03 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterCurrent.php @@ -63,7 +63,7 @@ class PersonCenterCurrent * * @internal Should not be instantied, unless inside Person entity */ - public function __construct(Person\PersonCenterHistory $history) + public function __construct(PersonCenterHistory $history) { $this->person = $history->getPerson(); $this->center = $history->getCenter(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index 7f0a3e978..c5c2c8d08 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -71,7 +71,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * * @Groups({"read", "docgen:read"}) */ - private ?Person\PersonResourceKind $kind = null; + private ?PersonResourceKind $kind = null; /** * The person which host the owner of this resource. @@ -127,7 +127,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this->id; } - public function getKind(): ?Person\PersonResourceKind + public function getKind(): ?PersonResourceKind { return $this->kind; } @@ -196,7 +196,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setKind(?Person\PersonResourceKind $kind): self + public function setKind(?PersonResourceKind $kind): self { $this->kind = $kind; diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php index 78d820298..c17172882 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php @@ -116,7 +116,7 @@ class PersonAltName /** * @return $this */ - public function setPerson(Person $person = null) + public function setPerson(?Person $person = null) { $this->person = $person; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregator.php index ce96c40c9..6a9cce351 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregator.php @@ -48,7 +48,7 @@ final readonly class ClosingDateAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|string $value): string { + return function (string|null $value): string { if ('_header' === $value) { return 'export.aggregator.course.by_closing_date.header'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php index bb2df08d3..cfb9d53aa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php @@ -84,7 +84,7 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface public function getLabels($key, array $values, $data): \Closure { - return function (null|int|string $jobId) { + return function (int|string|null $jobId) { if (null === $jobId || '' === $jobId) { return ''; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregator.php index bf71d04d8..6f9ea4859 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregator.php @@ -48,7 +48,7 @@ final readonly class OpeningDateAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|string $value): string { + return function (string|null $value): string { if ('_header' === $value) { return 'export.aggregator.course.by_opening_date.header'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php index 7248b5b98..23159cae8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php @@ -84,7 +84,7 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa public function getLabels($key, array $values, $data): \Closure { - return function (null|int|string $scopeId) { + return function (int|string|null $scopeId) { if (null === $scopeId || '' === $scopeId) { return ''; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php index f9b033784..b4bc40c10 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php @@ -42,7 +42,7 @@ final readonly class UserWorkingOnCourseAggregator implements AggregatorInterfac public function getLabels($key, array $values, $data): \Closure { - return function (null|int|string $userId) { + return function (int|string|null $userId) { if (null === $userId || '' === $userId) { return ''; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index 4b13bd477..750841337 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -72,7 +72,7 @@ class ChildrenNumberAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - return static function (null|int|string $value): string { + return static function (int|string|null $value): string { if ('_header' === $value) { return 'Number of children'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php index 79d28c24e..fd48bdb01 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php @@ -46,7 +46,7 @@ final readonly class CenterAggregator implements AggregatorInterface public function getLabels($key, array $values, $data): \Closure { - return function (null|int|string $value) { + return function (int|string|null $value) { if (null === $value || '' === $value) { return ''; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php index abb8b0e27..aa06fff61 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php @@ -44,7 +44,7 @@ final readonly class PostalCodeAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|int|string $value): string { + return function (int|string|null $value): string { if ('_header' === $value) { return 'export.aggregator.person.by_postal_code.header'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php index 567f2f7e6..2b3c3674e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php @@ -22,7 +22,7 @@ class LabelPersonHelper public function getLabel(string $key, array $values, string $header): callable { - return function (null|int|string $value) use ($header): string { + return function (int|string|null $value) use ($header): string { if ('_header' === $value) { return $header; } diff --git a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php index 8031de926..9de66b272 100644 --- a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php +++ b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php @@ -27,7 +27,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface public function __construct( protected PersonRepository $personRepository, - array $centers = null + ?array $centers = null ) { if (null !== $centers) { $this->centers = $centers; diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index c971495b6..21717a25b 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -154,7 +154,7 @@ class PersonType extends AbstractType 'allow_delete' => true, 'by_reference' => false, 'label' => false, - 'delete_empty' => static fn (PersonPhone $pp = null) => null === $pp || $pp->isEmpty(), + 'delete_empty' => static fn (?PersonPhone $pp = null) => null === $pp || $pp->isEmpty(), 'error_bubbling' => false, 'empty_collection_explain' => 'No additional phone numbers', ]); diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index c4be4ba5e..e61fbe105 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -53,7 +53,7 @@ class MembersEditor * If the person is also a member of another household, or the same household at the same position, the person * is not associated any more with the previous household. */ - public function addMovement(\DateTimeImmutable $date, Person $person, ?Position $position, ?bool $holder = false, string $comment = null): self + public function addMovement(\DateTimeImmutable $date, Person $person, ?Position $position, ?bool $holder = false, ?string $comment = null): self { if (null === $this->household) { throw new \LogicException('You must define a household first'); diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php index 16e25bc63..cb6f7d4ea 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php @@ -21,7 +21,7 @@ class MembersEditorFactory { } - public function createEditor(Household $household = null): MembersEditor + public function createEditor(?Household $household = null): MembersEditor { return new MembersEditor($this->validator, $household, $this->eventDispatcher); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodInfoRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodInfoRepository.php index 0f68efabb..88c89af7c 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodInfoRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodInfoRepository.php @@ -73,7 +73,7 @@ readonly class AccompanyingPeriodInfoRepository implements AccompanyingPeriodInf return $this->entityRepository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->entityRepository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php index a0364188a..59bb3f915 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php @@ -44,7 +44,7 @@ class AccompanyingPeriodWorkEvaluationDocumentRepository implements ObjectReposi * * @return array|object[]|AccompanyingPeriodWorkEvaluationDocument[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php index 840c44304..9c6ed19fc 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php @@ -53,7 +53,7 @@ class AccompanyingPeriodWorkEvaluationRepository implements ObjectRepository * * @return array|AccompanyingPeriodWorkEvaluation[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index f0f00183d..95b995e74 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -52,7 +52,7 @@ final readonly class AccompanyingPeriodWorkRepository implements ObjectRepositor ->select('count(w)')->getQuery()->getSingleScalarResult(); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -67,7 +67,7 @@ final readonly class AccompanyingPeriodWorkRepository implements ObjectRepositor return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php index c60bdf4a7..de5df1347 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php @@ -41,7 +41,7 @@ final readonly class ClosingMotiveRepository implements ClosingMotiveRepositoryI /** * @return array|ClosingMotive[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index b50a1b18e..e058c4e8d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -108,8 +108,8 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin Person $person, string $role, ?array $orderBy = [], - int $limit = null, - int $offset = null + ?int $limit = null, + ?int $offset = null ): array { $qb = $this->accompanyingPeriodRepository->createQueryBuilder('ap'); $scopes = $this->authorizationHelper @@ -138,7 +138,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin return $qb->getQuery()->getResult(); } - public function addOrderLimitClauses(QueryBuilder $qb, array $orderBy = null, int $limit = null, int $offset = null): QueryBuilder + public function addOrderLimitClauses(QueryBuilder $qb, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): QueryBuilder { if (null !== $orderBy) { foreach ($orderBy as $field => $order) { @@ -231,7 +231,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin return $centerOnScopes; } - public function findByUnDispatched(array $jobs, array $services, array $administrativeAdministrativeLocations, array $orderBy = null, int $limit = null, int $offset = null): array + public function findByUnDispatched(array $jobs, array $services, array $administrativeAdministrativeLocations, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { $qb = $this->buildQueryUnDispatched($jobs, $services, $administrativeAdministrativeLocations); $qb->select('ap'); diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php index 645a4d996..ba3396af8 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php @@ -40,8 +40,8 @@ interface AccompanyingPeriodACLAwareRepositoryInterface Person $person, string $role, ?array $orderBy = [], - int $limit = null, - int $offset = null + ?int $limit = null, + ?int $offset = null ): array; /** @@ -51,7 +51,7 @@ interface AccompanyingPeriodACLAwareRepositoryInterface * * @return list */ - public function findByUnDispatched(array $jobs, array $services, array $administrativeLocations, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findByUnDispatched(array $jobs, array $services, array $administrativeLocations, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; /** * @param array|PostalCode[] $postalCodes diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 449df5160..7b681a8f5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -39,7 +39,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $qb->select('count(a)')->getQuery()->getSingleScalarResult(); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -57,7 +57,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php index bf9ffb1ff..5a0dee15d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php @@ -49,7 +49,7 @@ final class HouseholdCompositionRepository implements HouseholdCompositionReposi * * @return array|object[]|HouseholdComposition[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -57,7 +57,7 @@ final class HouseholdCompositionRepository implements HouseholdCompositionReposi /** * @return array|HouseholdComposition[]|object[] */ - public function findByHousehold(Household $household, array $orderBy = null, int $limit = null, int $offset = null): array + public function findByHousehold(Household $household, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->findBy(['household' => $household], $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepositoryInterface.php index 3fc4bb46f..84c62392b 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepositoryInterface.php @@ -32,12 +32,12 @@ interface HouseholdCompositionRepositoryInterface extends ObjectRepository * * @return array|object[]|HouseholdComposition[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; /** * @return array|HouseholdComposition[]|object[] */ - public function findByHousehold(Household $household, array $orderBy = null, int $limit = null, int $offset = null): array; + public function findByHousehold(Household $household, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array; public function findOneBy(array $criteria): ?HouseholdComposition; diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php index d13b17fe4..2b748865b 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php @@ -51,7 +51,7 @@ final class HouseholdCompositionTypeRepository implements HouseholdCompositionTy * * @return array|HouseholdCompositionType[]|object[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepositoryInterface.php index 4041430d8..2eea434b8 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepositoryInterface.php @@ -34,7 +34,7 @@ interface HouseholdCompositionTypeRepositoryInterface extends ObjectRepository * * @return array|HouseholdCompositionType[]|object[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; public function findOneBy(array $criteria): ?HouseholdCompositionType; diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php index 5fa3f22de..2904ffb61 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php @@ -65,7 +65,7 @@ final class HouseholdRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php index 58c89fb7b..ebcfabe4f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php @@ -44,12 +44,12 @@ final class PersonHouseholdAddressRepository implements ObjectRepository * * @return PersonHouseholdAddress[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?PersonHouseholdAddress + public function findOneBy(array $criteria, ?array $orderBy = null): ?PersonHouseholdAddress { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php index b2fc2b2d1..32ca5b8fa 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php @@ -49,7 +49,7 @@ final class PositionRepository implements ObjectRepository * * @return Position[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php index b2409eace..3324ee444 100644 --- a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php @@ -34,7 +34,7 @@ class MaritalStatusRepository implements MaritalStatusRepositoryInterface return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php index 13be6842e..1f51060e9 100644 --- a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php @@ -19,7 +19,7 @@ interface MaritalStatusRepositoryInterface public function findAll(): array; - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; public function findOneBy(array $criteria): ?MaritalStatus; diff --git a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php index bf8ec9344..b6d80a721 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php @@ -40,7 +40,7 @@ class PersonCenterHistoryRepository implements PersonCenterHistoryInterface /** * @return array|PersonCenterHistory[] */ - public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 7b6010718..f59f843ac 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -30,16 +30,16 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor } public function buildAuthorizedQuery( - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): SearchApiQuery { $query = $this->createSearchQuery( $default, @@ -58,16 +58,16 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor } public function countBySearchCriteria( - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): int { $query = $this->buildAuthorizedQuery( $default, @@ -92,16 +92,16 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor * @throws ParsingException */ public function createSearchQuery( - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): SearchApiQuery { $query = new SearchApiQuery(); $query @@ -249,16 +249,16 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor int $start, int $limit, bool $simplify = false, - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): array { $query = $this->buildAuthorizedQuery( $default, diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php index b9f62b89f..c327ecd40 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php @@ -17,29 +17,29 @@ use Chill\PersonBundle\Entity\Person; interface PersonACLAwareRepositoryInterface { public function buildAuthorizedQuery( - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): SearchApiQuery; public function countBySearchCriteria( - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ); /** @@ -49,15 +49,15 @@ interface PersonACLAwareRepositoryInterface int $start, int $limit, bool $simplify = false, - string $default = null, - string $firstname = null, - string $lastname = null, - \DateTimeInterface $birthdate = null, - \DateTimeInterface $birthdateBefore = null, - \DateTimeInterface $birthdateAfter = null, - string $gender = null, - string $countryCode = null, - string $phonenumber = null, - string $city = null + ?string $default = null, + ?string $firstname = null, + ?string $lastname = null, + ?\DateTimeInterface $birthdate = null, + ?\DateTimeInterface $birthdateBefore = null, + ?\DateTimeInterface $birthdateAfter = null, + ?string $gender = null, + ?string $countryCode = null, + ?string $phonenumber = null, + ?string $city = null ): array; } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index 0d951e3bd..b7104a843 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -44,7 +44,7 @@ class PersonRepository implements ObjectRepository return $qb->getQuery()->getSingleScalarResult(); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -59,7 +59,7 @@ class PersonRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php index 04d8d09f9..b2bff2ce5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php @@ -26,7 +26,7 @@ final class PersonResourceRepository implements ObjectRepository $this->repository = $entityManager->getRepository(PersonResource::class); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -50,7 +50,7 @@ final class PersonResourceRepository implements ObjectRepository * * @return PersonResource[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php index d66d14572..d3fe813dc 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php @@ -35,7 +35,7 @@ class RelationRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php index 26ae266d8..932b872c5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php @@ -48,7 +48,7 @@ class RelationshipRepository implements ObjectRepository return $this->repository->findAll(); } - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php index a866d5eec..22556d747 100644 --- a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php @@ -41,7 +41,7 @@ class ResidentialAddressRepository extends ServiceEntityRepository ->getSingleScalarResult(); } - public function buildQueryFindCurrentResidentialAddresses(Person $person, \DateTimeImmutable $at = null): QueryBuilder + public function buildQueryFindCurrentResidentialAddresses(Person $person, ?\DateTimeImmutable $at = null): QueryBuilder { $date = $at ?? new \DateTimeImmutable('today'); $qb = $this->createQueryBuilder('ra'); @@ -66,7 +66,7 @@ class ResidentialAddressRepository extends ServiceEntityRepository /** * @return array|ResidentialAddress[]|null */ - public function findCurrentResidentialAddressByPerson(Person $person, \DateTimeImmutable $at = null): array + public function findCurrentResidentialAddressByPerson(Person $person, ?\DateTimeImmutable $at = null): array { return $this->buildQueryFindCurrentResidentialAddresses($person, $at) ->select('ra') diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php index 8391132f1..a7b739f7d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php @@ -48,12 +48,12 @@ final class EvaluationRepository implements EvaluationRepositoryInterface * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?Evaluation + public function findOneBy(array $criteria, ?array $orderBy = null): ?Evaluation { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepositoryInterface.php index cba57efe0..aa1de34eb 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepositoryInterface.php @@ -34,9 +34,9 @@ interface EvaluationRepositoryInterface extends ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array; + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array; - public function findOneBy(array $criteria, array $orderBy = null): ?Evaluation; + public function findOneBy(array $criteria, ?array $orderBy = null): ?Evaluation; /** * @return class-string diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php index 8a2831996..f99bd54a5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php @@ -56,7 +56,7 @@ final class GoalRepository implements ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -64,7 +64,7 @@ final class GoalRepository implements ObjectRepository /** * @return Goal[] */ - public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], int $limit = null, int $offset = null): array + public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], ?int $limit = null, ?int $offset = null): array { $qb = $this->buildQueryBySocialActionWithDescendants($action); $qb->select('g'); @@ -88,7 +88,7 @@ final class GoalRepository implements ObjectRepository ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?Goal + public function findOneBy(array $criteria, ?array $orderBy = null): ?Goal { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php index 8b8fbfc2b..786c6635a 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php @@ -67,7 +67,7 @@ final class ResultRepository implements ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } @@ -75,7 +75,7 @@ final class ResultRepository implements ObjectRepository /** * @return array */ - public function findByGoal(Goal $goal, array $orderBy = null, int $limit = null, int $offset = null): array + public function findByGoal(Goal $goal, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { $qb = $this->buildQueryByGoal($goal); @@ -96,7 +96,7 @@ final class ResultRepository implements ObjectRepository /** * @return Result[] */ - public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], int $limit = null, int $offset = null): array + public function findBySocialActionWithDescendants(SocialAction $action, array $orderBy = [], ?int $limit = null, ?int $offset = null): array { $qb = $this->buildQueryBySocialActionWithDescendants($action); $qb->select('r'); @@ -112,7 +112,7 @@ final class ResultRepository implements ObjectRepository ->getResult(); } - public function findOneBy(array $criteria, array $orderBy = null): ?Result + public function findOneBy(array $criteria, ?array $orderBy = null): ?Result { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php index 2fc3b35df..da6bfcc46 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php @@ -26,7 +26,7 @@ final class SocialActionRepository implements ObjectRepository $this->repository = $entityManager->getRepository(SocialAction::class); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -58,12 +58,12 @@ final class SocialActionRepository implements ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?SocialAction + public function findOneBy(array $criteria, ?array $orderBy = null): ?SocialAction { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php index d3e6fa10f..21f06afd1 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php @@ -53,12 +53,12 @@ final class SocialIssueRepository implements ObjectRepository * * @return array */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function findOneBy(array $criteria, array $orderBy = null): ?SocialIssue + public function findOneBy(array $criteria, ?array $orderBy = null): ?SocialIssue { return $this->repository->findOneBy($criteria, $orderBy); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php index d6cc4c25f..b476c2f5f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php @@ -29,7 +29,7 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware { } - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { $initial = $this->normalizer->normalize($object, $format, array_merge($context, [ self::SKIP => spl_object_hash($object), @@ -49,7 +49,7 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware return $initial; } - public function supportsNormalization($data, string $format = null, array $context = []) + public function supportsNormalization($data, ?string $format = null, array $context = []) { return $data instanceof AccompanyingPeriodWorkEvaluationDocument && 'json' === $format diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 39560883e..016098535 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -33,7 +33,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz /** * @param AccompanyingPeriodWorkEvaluation $object */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { $initial = $this->normalizer->normalize($object, $format, array_merge( $context, @@ -66,7 +66,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz return $initial; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return 'json' === $format && $data instanceof AccompanyingPeriodWorkEvaluation diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php index 361321f38..438e89093 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php @@ -37,7 +37,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac * * @throws ExceptionInterface */ - public function normalize($object, string $format = null, array $context = []): null|array|\ArrayObject|bool|float|int|string + public function normalize($object, ?string $format = null, array $context = []): array|\ArrayObject|bool|float|int|string|null { $initial = $this->normalizer->normalize($object, $format, array_merge( $context, @@ -78,7 +78,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac return $initial; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return 'json' === $format && $data instanceof AccompanyingPeriodWork diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php index cfd310013..99314ebdc 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php @@ -36,7 +36,7 @@ class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerA * * @throws ExceptionInterface */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { $data = $this->normalizer->normalize($object, $format, array_merge( $context, @@ -53,7 +53,7 @@ class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerA return $data; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return 'json' === $format && $data instanceof EntityWorkflow diff --git a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php index a6f82be91..7d6e199bd 100644 --- a/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php +++ b/src/Bundle/ChillPersonBundle/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProvider.php @@ -33,7 +33,7 @@ final readonly class AccompanyingPeriodWorkEvaluationGenericDocProvider implemen ) { } - public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $accompanyingPeriodWorkMetadata = $this->entityManager->getClassMetadata(AccompanyingPeriod\AccompanyingPeriodWork::class); $query = $this->buildBaseQuery(); @@ -52,7 +52,7 @@ final readonly class AccompanyingPeriodWorkEvaluationGenericDocProvider implemen return $this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $accompanyingPeriod); } - private function addWhereClausesToQuery(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery + private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery { $classMetadata = $this->entityManager->getClassMetadata(AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument::class); $storedObjectMetadata = $this->entityManager->getClassMetadata(StoredObject::class); @@ -84,7 +84,7 @@ final readonly class AccompanyingPeriodWorkEvaluationGenericDocProvider implemen return $query; } - public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface + public function buildFetchQueryForPerson(Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { $storedObjectMetadata = $this->entityManager->getClassMetadata(StoredObject::class); $accompanyingPeriodWorkMetadata = $this->entityManager->getClassMetadata(AccompanyingPeriod\AccompanyingPeriodWork::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php index 021cab706..bb833c96b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php @@ -244,10 +244,10 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase } private function buildSubscriber( - \Twig\Environment $engine = null, - NotificationPersisterInterface $notificationPersister = null, - Security $security = null, - TranslatorInterface $translator = null + ?\Twig\Environment $engine = null, + ?NotificationPersisterInterface $notificationPersister = null, + ?Security $security = null, + ?TranslatorInterface $translator = null ): PersonAddressMoveEventSubscriber { if (null === $translator) { $double = $this->prophesize(TranslatorInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php index 86796fc3f..a0223e660 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php @@ -222,7 +222,7 @@ final class PersonControllerCreateTest extends WebTestCase Form &$creationForm, string $firstname = 'God', string $lastname = 'Jesus', - \DateTime $birthdate = null + ?\DateTime $birthdate = null ) { $creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname.'_'.uniqid()); $creationForm->get(self::LASTNAME_INPUT)->setValue($lastname.'_'.uniqid()); diff --git a/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php b/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php index 827b2a2e2..99515562c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Household/MembersEditorTest.php @@ -561,8 +561,8 @@ final class MembersEditorTest extends TestCase } private function buildMembersEditorFactory( - EventDispatcherInterface $eventDispatcher = null, - ValidatorInterface $validator = null + ?EventDispatcherInterface $eventDispatcher = null, + ?ValidatorInterface $validator = null ) { if (null === $eventDispatcher) { $double = $this->getProphet()->prophesize(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php index 87c57be86..609ee03fb 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Repository/AccompanyingPeriodACLAwareRepositoryTest.php @@ -521,7 +521,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase /** * @param array $scopes */ - private function buildPeriod(Person $person, array $scopes, null|User $creator, bool $confirm): AccompanyingPeriod + private function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod { $period = new AccompanyingPeriod(); $period->addPerson($person); diff --git a/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php b/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php index 1dbbceb3e..ec8893ff9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php @@ -155,7 +155,7 @@ final class PersonVoterTest extends KernelTestCase * * @return \Symfony\Component\Security\Core\Authentication\Token\TokenInterface */ - protected function prepareToken(array $permissions = null) + protected function prepareToken(?array $permissions = null) { $token = $this->prophet->prophesize(); $token diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php index 59bb0a731..70fe30e6a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php @@ -237,12 +237,12 @@ final class PersonDocGenNormalizerTest extends KernelTestCase } private function buildNormalizer( - PersonRender $personRender = null, - RelationshipRepository $relationshipRepository = null, - TranslatorInterface $translator = null, - TranslatableStringHelper $translatableStringHelper = null, - NormalizerInterface $normalizer = null, - SummaryBudgetInterface $summaryBudget = null + ?PersonRender $personRender = null, + ?RelationshipRepository $relationshipRepository = null, + ?TranslatorInterface $translator = null, + ?TranslatableStringHelper $translatableStringHelper = null, + ?NormalizerInterface $normalizer = null, + ?SummaryBudgetInterface $summaryBudget = null ): PersonDocGenNormalizer { if (null === $summaryBudget) { $summaryBudget = $this->prophesize(SummaryBudgetInterface::class); @@ -274,11 +274,11 @@ final class PersonDocGenNormalizerTest extends KernelTestCase } private function buildPersonNormalizer( - PersonRender $personRender = null, - RelationshipRepository $relationshipRepository = null, - TranslatorInterface $translator = null, - TranslatableStringHelper $translatableStringHelper = null, - SummaryBudgetInterface $summaryBudget = null + ?PersonRender $personRender = null, + ?RelationshipRepository $relationshipRepository = null, + ?TranslatorInterface $translator = null, + ?TranslatableStringHelper $translatableStringHelper = null, + ?SummaryBudgetInterface $summaryBudget = null ): PersonDocGenNormalizer { if (null === $relationshipRepository) { $relationshipRepository = $this->prophesize(RelationshipRepository::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php index 772e669bb..f6b2bdde9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php @@ -341,20 +341,20 @@ final class PersonContextTest extends KernelTestCase } private function buildPersonContext( - AuthorizationHelperInterface $authorizationHelper = null, - BaseContextData $baseContextData = null, - CenterResolverManagerInterface $centerResolverManager = null, - DocumentCategoryRepository $documentCategoryRepository = null, - EntityManagerInterface $em = null, - NormalizerInterface $normalizer = null, - ParameterBagInterface $parameterBag = null, - ScopeRepositoryInterface $scopeRepository = null, - Security $security = null, - TranslatorInterface $translator = null, - TranslatableStringHelperInterface $translatableStringHelper = null, - ThirdPartyRender $thirdPartyRender = null, - ThirdPartyRepository $thirdPartyRepository = null, - ResidentialAddressRepository $residentialAddressRepository = null + ?AuthorizationHelperInterface $authorizationHelper = null, + ?BaseContextData $baseContextData = null, + ?CenterResolverManagerInterface $centerResolverManager = null, + ?DocumentCategoryRepository $documentCategoryRepository = null, + ?EntityManagerInterface $em = null, + ?NormalizerInterface $normalizer = null, + ?ParameterBagInterface $parameterBag = null, + ?ScopeRepositoryInterface $scopeRepository = null, + ?Security $security = null, + ?TranslatorInterface $translator = null, + ?TranslatableStringHelperInterface $translatableStringHelper = null, + ?ThirdPartyRender $thirdPartyRender = null, + ?ThirdPartyRepository $thirdPartyRepository = null, + ?ResidentialAddressRepository $residentialAddressRepository = null ): PersonContext { if (null === $authorizationHelper) { $authorizationHelper = $this->prophesize(AuthorizationHelperInterface::class)->reveal(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php index afbc0b2ab..35617e37a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/GenericDoc/Providers/AccompanyingPeriodWorkEvaluationGenericDocProviderTest.php @@ -39,9 +39,9 @@ class AccompanyingPeriodWorkEvaluationGenericDocProviderTest extends KernelTestC * @dataProvider provideSearchArguments */ public function testBuildFetchQueryForAccompanyingPeriod( - \DateTimeImmutable $startDate = null, - \DateTimeImmutable $endDate = null, - string $content = null + ?\DateTimeImmutable $startDate = null, + ?\DateTimeImmutable $endDate = null, + ?string $content = null ): void { $period = $this->entityManager->createQuery('SELECT a FROM '.AccompanyingPeriod::class.' a') ->setMaxResults(1) diff --git a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php index 90163fd2e..743d83c8a 100644 --- a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php @@ -134,7 +134,7 @@ final class ReportVoterTest extends KernelTestCase Report $report, $action, $message, - User $user = null + ?User $user = null ) { $token = $this->prepareToken($user); $result = $this->voter->vote($token, $report, [$action]); @@ -161,7 +161,7 @@ final class ReportVoterTest extends KernelTestCase * * @return \Symfony\Component\Security\Core\Authentication\Token\TokenInterface */ - protected function prepareToken(User $user = null) + protected function prepareToken(?User $user = null) { $token = $this->prophet->prophesize(); $token diff --git a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php index 268335cbc..c4c261cd3 100644 --- a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php +++ b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php @@ -37,7 +37,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI $this->addSql('ALTER TABLE Report DROP scope_id'); } - public function setContainer(ContainerInterface $container = null) + public function setContainer(?ContainerInterface $container = null) { if (null === $container) { throw new \RuntimeException('Container is not provided. This migration need container to set a default center'); diff --git a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php index 948f9a81a..f9118737f 100644 --- a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php @@ -189,7 +189,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface return $this->closed; } - public function setAssignee(User $assignee = null) + public function setAssignee(?User $assignee = null) { $this->assignee = $assignee; diff --git a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php index f5ed0d3b0..25b5008b0 100644 --- a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php @@ -112,7 +112,7 @@ class SingleTask extends AbstractTask * message="An end date is required if a warning interval is set" * ) */ - private null|\DateInterval $warningInterval = null; + private \DateInterval|null $warningInterval = null; public function __construct() { @@ -122,7 +122,7 @@ class SingleTask extends AbstractTask /** * Get endDate. */ - public function getEndDate(): null|\DateTime + public function getEndDate(): \DateTime|null { return $this->endDate; } @@ -184,7 +184,7 @@ class SingleTask extends AbstractTask /** * Get warningInterval. */ - public function getWarningInterval(): null|\DateInterval + public function getWarningInterval(): \DateInterval|null { return $this->warningInterval; } @@ -234,7 +234,7 @@ class SingleTask extends AbstractTask * * @return SingleTask */ - public function setWarningInterval(null|\DateInterval $warningInterval) + public function setWarningInterval(\DateInterval|null $warningInterval) { $this->warningInterval = $warningInterval; diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index e55a8f700..d72c23298 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -28,7 +28,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function buildBaseQuery( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?array $types = [], ?array $users = [] @@ -150,7 +150,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function buildQueryByCourse( AccompanyingPeriod $course, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): QueryBuilder { $qb = $this->buildBaseQuery($pattern, $flags); @@ -162,7 +162,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function buildQueryByPerson( Person $person, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): QueryBuilder { $qb = $this->buildBaseQuery($pattern, $flags); @@ -173,7 +173,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function buildQueryMyTasks( - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): QueryBuilder { $qb = $this->buildBaseQuery($pattern, $flags); @@ -184,7 +184,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function countByAllViewable( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?array $types = [], ?array $users = [] @@ -199,7 +199,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function countByCourse( AccompanyingPeriod $course, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): int { $qb = $this->buildQueryByCourse($course, $pattern, $flags); @@ -211,7 +211,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function countByCurrentUsersTasks( - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): int { return $this->buildQueryMyTasks($pattern, $flags) @@ -221,7 +221,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function countByPerson( Person $person, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): int { $qb = $this->buildQueryByPerson($person, $pattern, $flags); @@ -233,7 +233,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function findByAllViewable( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?array $types = [], ?array $users = [], @@ -249,7 +249,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function findByCourse( AccompanyingPeriod $course, - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, @@ -262,7 +262,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR } public function findByCurrentUsersTasks( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, @@ -275,7 +275,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR public function findByPerson( Person $person, - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php index 2f305ae3e..bb63c0caa 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php @@ -17,7 +17,7 @@ use Chill\PersonBundle\Entity\Person; interface SingleTaskAclAwareRepositoryInterface { public function countByAllViewable( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?array $types = [], ?array $users = [] @@ -25,20 +25,20 @@ interface SingleTaskAclAwareRepositoryInterface public function countByCourse( AccompanyingPeriod $course, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): int; - public function countByCurrentUsersTasks(string $pattern = null, ?array $flags = []): int; + public function countByCurrentUsersTasks(?string $pattern = null, ?array $flags = []): int; public function countByPerson( Person $person, - string $pattern = null, + ?string $pattern = null, ?array $flags = [] ): int; public function findByAllViewable( - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?array $types = [], ?array $users = [], @@ -49,18 +49,18 @@ interface SingleTaskAclAwareRepositoryInterface public function findByCourse( AccompanyingPeriod $course, - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = [] ): array; - public function findByCurrentUsersTasks(string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array; + public function findByCurrentUsersTasks(?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array; public function findByPerson( Person $person, - string $pattern = null, + ?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php index 6260b90c1..c8a84cbf8 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php @@ -56,7 +56,7 @@ class SingleTaskRepository extends EntityRepository * * @return int */ - public function countByParameters($params, User $currentUser = null) + public function countByParameters($params, ?User $currentUser = null) { $qb = $this->createQueryBuilder('st') ->select('COUNT(st)'); @@ -175,7 +175,7 @@ class SingleTaskRepository extends EntityRepository $qb->where($where); } - protected function buildQuery(QueryBuilder $qb, $params, User $currentUser = null) + protected function buildQuery(QueryBuilder $qb, $params, ?User $currentUser = null) { if (null !== $currentUser) { $this->buildACLQuery($qb, $currentUser); diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index cc65d0215..3b2de6ed5 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -26,7 +26,7 @@ class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event protected $vote; public function __construct( - private readonly null|AbstractTask|AccompanyingPeriod|Person $subject, + private readonly AbstractTask|AccompanyingPeriod|Person|null $subject, private readonly string $attribute, private readonly TokenInterface $token ) { diff --git a/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php b/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php index 878ae43cd..affaab8c7 100644 --- a/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php +++ b/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php @@ -39,7 +39,7 @@ class TaskTwigExtension extends AbstractExtension AbstractTask $task, string $key, $metadataSubject = null, - string $name = null + ?string $name = null ) { return $this->taskWorkflowManager->getWorkflowMetadata($task, $key, $metadataSubject, $name); } diff --git a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php index 949786dd5..c0ce60dbe 100644 --- a/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php +++ b/src/Bundle/ChillTaskBundle/Workflow/TaskWorkflowManager.php @@ -56,7 +56,7 @@ class TaskWorkflowManager implements WorkflowSupportStrategyInterface return $definitions[0]; } - public function getWorkflowMetadata(AbstractTask $task, string $key, $metadataSubject = null, string $name = null) + public function getWorkflowMetadata(AbstractTask $task, string $key, $metadataSubject = null, ?string $name = null) { return $this->getTaskWorkflowDefinition($task) ->getWorkflowMetadata($task, $key, $metadataSubject); diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 214d9ba36..30082d90b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -59,7 +59,7 @@ final class ThirdPartyController extends CRUDController ->build(); } - protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int + protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int { if (null === $filterOrder) { throw new \LogicException('filterOrder should not be null'); @@ -71,7 +71,7 @@ final class ThirdPartyController extends CRUDController ); } - protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface + protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface { if ('new' === $action) { return parent::createFormFor($action, $entity, $formClass, \array_merge( @@ -90,7 +90,7 @@ final class ThirdPartyController extends CRUDController return parent::createFormFor($action, $entity, $formClass, $formOptions); } - protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, FilterOrderHelper $filterOrder = null) + protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, ?FilterOrderHelper $filterOrder = null) { return $this->thirdPartyACLAwareRepository ->listThirdParties( diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index f4ad5293c..721fbcb67 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -655,7 +655,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin throw new \UnexpectedValueException(sprintf('typeAndCategory should be a string or a %s', ThirdPartyCategory::class)); } - public function setAcronym(string $acronym = null): ThirdParty + public function setAcronym(?string $acronym = null): ThirdParty { $this->acronym = (string) $acronym; @@ -679,7 +679,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin /** * @return $this */ - public function setAddress(Address $address = null) + public function setAddress(?Address $address = null) { $this->address = $address; @@ -716,7 +716,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @return ThirdParty */ - public function setComment(string $comment = null) + public function setComment(?string $comment = null) { $this->comment = $comment; @@ -754,7 +754,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @return ThirdParty */ - public function setEmail(string $email = null) + public function setEmail(?string $email = null) { $this->email = trim((string) $email); @@ -806,7 +806,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin /** * Set telephone. */ - public function setTelephone(PhoneNumber $telephone = null): self + public function setTelephone(?PhoneNumber $telephone = null): self { $this->telephone = $telephone; diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php index 63538cfc2..3538a7877 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php @@ -21,7 +21,7 @@ final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareR { } - public function buildQuery(string $filterString = null): QueryBuilder + public function buildQuery(?string $filterString = null): QueryBuilder { $qb = $this->thirdPartyRepository->createQueryBuilder('tp'); @@ -53,8 +53,8 @@ final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareR string $role, ?string $filterString, ?array $orderBy = [], - int $limit = null, - int $offset = null + ?int $limit = null, + ?int $offset = null ): array { $qb = $this->buildQuery($filterString); diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php index c2e6c74c1..7390808c8 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php @@ -38,7 +38,7 @@ class ThirdPartyRepository implements ObjectRepository return $qb->getQuery()->getSingleScalarResult(); } - public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); } @@ -62,7 +62,7 @@ class ThirdPartyRepository implements ObjectRepository * * @return array|ThirdParty[] */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } diff --git a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php index 633529d02..b85d1b8b3 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php @@ -28,7 +28,7 @@ final readonly class Responder implements ResponderInterface public function file( $file, - string $filename = null, + ?string $filename = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT ): BinaryFileResponse { $response = new BinaryFileResponse($file); diff --git a/src/Bundle/ChillWopiBundle/src/Service/Controller/ResponderInterface.php b/src/Bundle/ChillWopiBundle/src/Service/Controller/ResponderInterface.php index 734a5b5b3..a2d7b5518 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Controller/ResponderInterface.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Controller/ResponderInterface.php @@ -27,7 +27,7 @@ interface ResponderInterface */ public function file( $file, - string $filename = null, + ?string $filename = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT ): BinaryFileResponse; From f02168950f62be6d1c944c9eeb0ca5699eb1c7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 10:40:07 +0100 Subject: [PATCH 15/42] Export: group accompanying period by person participating --- .../unreleased/Feature-20240207-103951.yaml | 5 ++ .../PersonParticipatingAggregator.php | 78 +++++++++++++++++++ .../PersonParticipatingAggregatorTest.php | 61 +++++++++++++++ .../services/exports_accompanying_course.yaml | 4 + .../translations/messages.fr.yml | 4 + 5 files changed, 152 insertions(+) create mode 100644 .changes/unreleased/Feature-20240207-103951.yaml create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php diff --git a/.changes/unreleased/Feature-20240207-103951.yaml b/.changes/unreleased/Feature-20240207-103951.yaml new file mode 100644 index 000000000..b0f71b7cf --- /dev/null +++ b/.changes/unreleased/Feature-20240207-103951.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: 'Export: group accompanying period by person participating' +time: 2024-02-07T10:39:51.97331052+01:00 +custom: + Issue: "253" diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php new file mode 100644 index 000000000..632d0402d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php @@ -0,0 +1,78 @@ + $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.course.by-user.header'), + default => throw new \UnexpectedValueException('key not supported: '.$key), + }; + } + + public function getQueryKeys($data) + { + return [self::KEY]; + } + + public function getTitle() + { + return 'export.aggregator.course.by-user.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $k = self::KEY; + + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } + + $qb->addSelect("IDENTITY(acppart.person) AS {$k}") + ->addGroupBy($k); + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php new file mode 100644 index 000000000..8e9cdaf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregatorTest.php @@ -0,0 +1,61 @@ +labelPersonHelper = self::$container->get(LabelPersonHelper::class); + } + + public function getAggregator() + { + return new PersonParticipatingAggregator($this->labelPersonHelper); + } + + public function getFormData() + { + return [[]]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(acp.id)') + ->from(AccompanyingPeriod::class, 'acp'), + $em->createQueryBuilder() + ->select('count(acp.id)') + ->from(AccompanyingPeriod::class, 'acp') + ->join('acp.participations', 'acppart'), + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 4eaaf67b0..c869a4494 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -259,3 +259,7 @@ services: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ClosingDateAggregator: tags: - { name: chill.export_aggregator, alias: accompanyingcourse_closing_date_aggregator } + + Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\PersonParticipatingAggregator: + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_person_part_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 783bc6be0..2b5ce5c97 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1038,6 +1038,10 @@ export: header: Code postal course: + by-user: + title: Grouper les parcours par usager participant + header: Usager participant + by_referrer: Computation date for referrer: Date à laquelle le référent était actif by_user_scope: From 439fecd69f1a66d32deb24a459f9da47860d663f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 13:25:49 +0100 Subject: [PATCH 16/42] fix cs --- .../PersonFilters/WithParticipationBetweenDatesFilter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php index 289af5f07..1df656a00 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php @@ -25,7 +25,8 @@ final readonly class WithParticipationBetweenDatesFilter implements FilterInterf { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function addRole(): ?string { From 950835c10b117e3439117711a7885bd86026a1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 11:46:43 +0100 Subject: [PATCH 17/42] Add filter for courses not linked to a reference address This commit introduces a new filter to the Accompanying Course section. It allows users to filter for courses that are not associated with a reference address. The accompanying test and translation changes are also included in this update. --- .../unreleased/Feature-20240207-114629.yaml | 5 + ...tAssociatedWithAReferenceAddressFilter.php | 99 +++++++++++++++++++ ...ociatedWithAReferenceAddressFilterTest.php | 66 +++++++++++++ .../services/exports_accompanying_course.yaml | 4 + .../translations/messages+intl-icu.fr.yaml | 5 + .../translations/messages.fr.yml | 3 + 6 files changed, 182 insertions(+) create mode 100644 .changes/unreleased/Feature-20240207-114629.yaml create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php diff --git a/.changes/unreleased/Feature-20240207-114629.yaml b/.changes/unreleased/Feature-20240207-114629.yaml new file mode 100644 index 000000000..813d14ba7 --- /dev/null +++ b/.changes/unreleased/Feature-20240207-114629.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: 'Export: add filter for courses not linked to a reference address' +time: 2024-02-07T11:46:29.491027007+01:00 +custom: + Issue: "243" diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php new file mode 100644 index 000000000..72197234c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php @@ -0,0 +1,99 @@ +add('date_calc', PickRollingDateType::class, [ + 'label' => 'export.filter.course.not_having_address_reference.adress_at', + ]); + } + + public function getFormDefaultData(): array + { + return [ + 'date_calc' => new RollingDate(RollingDate::T_TODAY), + ]; + } + + public function describeAction($data, $format = 'string') + { + return [ + 'exports.filter.course.not_having_address_reference.describe', + [ + 'date_calc' => $this->rollingDateConverter->convert($data['date_calc']), + ], + ]; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $k = 'acp_not_associated_ref_filter'; + + $qb + ->leftJoin( + 'acp.locationHistories', + $k, + Join::WITH, + "{$k}.period = acp AND {$k}.startDate <= :{$k}_date_calc AND ({$k}.endDate IS NULL OR {$k}.endDate > :{$k}_date_calc)" + ) + ->leftJoin( + PersonHouseholdAddress::class, + "{$k}_p_address", + Join::WITH, + "{$k}.personLocation = {$k}_p_address.person AND {$k}_p_address.validFrom <= :{$k}_date_calc AND ({$k}_p_address.validTo IS NULL OR {$k}_p_address.validTo > :{$k}_date_calc)" + ) + ->join( + Address::class, + "{$k}_address", + Join::WITH, + "{$k}_address.id = COALESCE(IDENTITY({$k}_p_address.address), IDENTITY({$k}.addressLocation))" + ) + ; + + $qb->andWhere("{$k}_address.addressReference IS NULL"); + $qb->setParameter("{$k}_date_calc", $this->rollingDateConverter->convert($data['date_calc'])); + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php new file mode 100644 index 000000000..c71088159 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilterTest.php @@ -0,0 +1,66 @@ + new RollingDate(RollingDate::T_TODAY)], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from(AccompanyingPeriod::class, 'acp'), + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index c869a4494..38b5d5041 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -147,6 +147,10 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_info_within_filter } + Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\NotAssociatedWithAReferenceAddressFilter: + tags: + - { name: chill.export_filter, alias: accompanyingcourse_not_having_addr_reference_filter } + ## Aggregators chill.person.export.aggregator_referrer_scope: class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ScopeAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index a8d2080fb..af85b2217 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -140,6 +140,11 @@ exports: by_treating_agent: Filtered by treating agent at date: >- Les agents traitant au { agent_at, date, medium }, seulement {agents} + course: + not_having_address_reference: + describe: >- + Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} + 'total persons matching the search pattern': >- { total, plural, =0 {Aucun usager ne correspond aux termes de recherche} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 2b5ce5c97..0864875fa 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1153,6 +1153,9 @@ export: 'Filtered by participations during period: between %dateafter% and %datebefore%': 'Filtré par personne concerné par un parcours dans la periode entre: %dateafter% et %datebefore%' course: + not_having_address_reference: + title: Filtrer les parcours non localisés à une adresse de réference + adress_at: Adresse à la date du having_info_within_interval: title: Filtrer les parcours ayant reçu une intervention entre deux dates start_date: Début de la période From 15f8432ce06e24d83b0fa5a4822bed8a17e5997b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 29 Nov 2023 11:30:14 +0100 Subject: [PATCH 18/42] Use PostUpdateEventArgs typing instead of PostPersistEventArgs --- .../Notification/Counter/NotificationByUserCounter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index 81a8bb3bb..15a33d836 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -16,7 +16,7 @@ use Chill\MainBundle\Entity\NotificationComment; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; -use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -62,7 +62,7 @@ final readonly class NotificationByUserCounter implements NotificationCounterInt return 'chill_main_notif_unread_by_'.$user->getId(); } - public function onEditNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void + public function onEditNotificationComment(NotificationComment $notificationComment, PostUpdateEventArgs $eventArgs): void { $this->resetCacheForNotification($notificationComment->getNotification()); } From d58c0a867d38887f4524623e9b106fbbdc72d5f6 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 29 Nov 2023 11:31:53 +0100 Subject: [PATCH 19/42] add changie --- .changes/unreleased/Fixed-20231129-113138.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixed-20231129-113138.yaml diff --git a/.changes/unreleased/Fixed-20231129-113138.yaml b/.changes/unreleased/Fixed-20231129-113138.yaml new file mode 100644 index 000000000..efe9b10c1 --- /dev/null +++ b/.changes/unreleased/Fixed-20231129-113138.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix error in logs about wrong typing of eventArgs in onEditNotificationComment + method +time: 2023-11-29T11:31:38.933538592+01:00 +custom: + Issue: "220" From 32ae2f8f0df7ea9de3510a75a41024357b66b90c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 13 Dec 2023 10:12:56 +0100 Subject: [PATCH 20/42] Add a separate method for onPersist, use same private resetCache method --- .../Notification/Counter/NotificationByUserCounter.php | 6 ++++++ .../ChillMainBundle/config/services/notification.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index 15a33d836..e08543e8c 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\NotificationComment; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; +use Doctrine\ORM\Event\PostPersistEventArgs; use Doctrine\ORM\Event\PostUpdateEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; use Psr\Cache\CacheItemPoolInterface; @@ -62,6 +63,11 @@ final readonly class NotificationByUserCounter implements NotificationCounterInt return 'chill_main_notif_unread_by_'.$user->getId(); } + public function onPersistNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void + { + $this->resetCacheForNotification($notificationComment->getNotification()); + } + public function onEditNotificationComment(NotificationComment $notificationComment, PostUpdateEventArgs $eventArgs): void { $this->resetCacheForNotification($notificationComment->getNotification()); diff --git a/src/Bundle/ChillMainBundle/config/services/notification.yaml b/src/Bundle/ChillMainBundle/config/services/notification.yaml index 29cbce946..be3252003 100644 --- a/src/Bundle/ChillMainBundle/config/services/notification.yaml +++ b/src/Bundle/ChillMainBundle/config/services/notification.yaml @@ -41,7 +41,7 @@ services: entity: 'Chill\MainBundle\Entity\NotificationComment' # set the 'lazy' option to TRUE to only instantiate listeners when they are used lazy: true - method: 'onEditNotificationComment' + method: 'onPersistNotificationComment' Chill\MainBundle\Notification\Email\NotificationMailer: autowire: true From 4736fca67959aa836f34f7ae4f4abbfd4ae715dd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 30 Jan 2024 14:02:02 +0100 Subject: [PATCH 21/42] Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form --- src/Bundle/ChillActivityBundle/Entity/ActivityType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index c14c8292b..2db0f805d 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -291,7 +291,9 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { + // if social issues are invisible then social actions cannot be optional or required + if social issues are optional then social actions shouldn't be required + if (0 === $this->socialIssuesVisible && (1 === $this->socialActionsVisible || 2 === $this->socialActionsVisible) + || (1 === $this->socialIssuesVisible && 2 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') From 574ad42a76f45fd980a93c9d67b448a42ec70c81 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 30 Jan 2024 14:03:37 +0100 Subject: [PATCH 22/42] Add changie for fix in activity entity/form --- .changes/unreleased/Fixed-20240130-140301.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixed-20240130-140301.yaml diff --git a/.changes/unreleased/Fixed-20240130-140301.yaml b/.changes/unreleased/Fixed-20240130-140301.yaml new file mode 100644 index 000000000..45fb94f6a --- /dev/null +++ b/.changes/unreleased/Fixed-20240130-140301.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix the conditions upon which social actions should be optional or required + in relation to social issues within the activity creation form +time: 2024-01-30T14:03:01.942955636+01:00 +custom: + Issue: "256" From 13854e59de837bf2fc5b9c3834ef7b7dc53fde14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 14:22:18 +0100 Subject: [PATCH 23/42] Add grouping parenthesis on condition about social issue and social action visibility This improve readability and avoid errors with boolean operator precedence --- src/Bundle/ChillActivityBundle/Entity/ActivityType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 2db0f805d..96c369b39 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -292,8 +292,10 @@ class ActivityType { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { // if social issues are invisible then social actions cannot be optional or required + if social issues are optional then social actions shouldn't be required - if (0 === $this->socialIssuesVisible && (1 === $this->socialActionsVisible || 2 === $this->socialActionsVisible) - || (1 === $this->socialIssuesVisible && 2 === $this->socialActionsVisible)) { + if ( + (0 === $this->socialIssuesVisible && (1 === $this->socialActionsVisible || 2 === $this->socialActionsVisible)) + || (1 === $this->socialIssuesVisible && 2 === $this->socialActionsVisible) + ) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') From e2e0b08210fad2f31d0e4debc379451db012e733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 22 Jan 2024 11:44:32 +0100 Subject: [PATCH 24/42] Add HasTemporaryLocationFilter test and update filter parameters A new test HasTemporaryLocationFilterTest has been added under ChillPersonBundle. This test mainly focuses on checking the filter functionalities related to temporary locations. In addition, the 'having_temporarily' parameter has been added to 'calc_date' field in HasTemporaryLocationFilter class. --- .../HasTemporaryLocationFilter.php | 2 +- .../HasTemporaryLocationFilterTest.php | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index ca5ccaf27..3313cb23f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -70,7 +70,7 @@ class HasTemporaryLocationFilter implements FilterInterface }, ]) ->add('calc_date', PickRollingDateType::class, [ - 'label' => 'export.filter.course.having_temporarily.Calculation date', + 'label' => 'export.filter.course.having_temporarily.Calculation date', 'having_temporarily' => true, ]); } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php new file mode 100644 index 000000000..5c1b8b9c7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilterTest.php @@ -0,0 +1,67 @@ +rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + } + + public function getFilter() + { + return new HasTemporaryLocationFilter($this->rollingDateConverter); + } + + public function getFormData() + { + return [ + [ + 'having_temporarily' => true, + 'calc_date' => new RollingDate(RollingDate::T_TODAY), + ], + [ + 'having_temporarily' => false, + 'calc_date' => new RollingDate(RollingDate::T_TODAY), + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} From c707a34f16742b2b913c48ed0fc491faaf4c3644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 23 Jan 2024 14:20:27 +0100 Subject: [PATCH 25/42] [export] Add referrer on accompanying course filter between dates feature and relevant tests Implemented a new filter to the software for social workers. This filter, ReferrerFilterBetweenDates, enables filtering of query results based on a range of dates and accepted referrers. Tests for this new functionality have also been added to ensure the feature works as expected. --- .../ReferrerFilterBetweenDates.php | 123 ++++++++++++++++++ .../ReferrerFilterBetweenDatesTest.php | 89 +++++++++++++ .../services/exports_accompanying_course.yaml | 7 +- .../translations/messages+intl-icu.fr.yaml | 6 + .../translations/messages.fr.yml | 4 + 5 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php new file mode 100644 index 000000000..33a9b4cc3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php @@ -0,0 +1,123 @@ +join('acp.userHistories', self::A) + ->andWhere( + "OVERLAPSI({$history}.startDate, {$history}.endDate),(:{$start}, :{$end}) = TRUE" + ) + ->andWhere( + "{$history}.user IN (:{$users})", + ) + ->setParameter($users, $data['accepted_referrers']) + ->setParameter($start, $this->rollingDateConverter->convert($data['start_date'])) + ->setParameter($end, $this->rollingDateConverter->convert($data['end_date'])); + } + + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('accepted_referrers', PickUserDynamicType::class, [ + 'multiple' => true, + ]) + ->add('start_date', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_referrer_between_dates.start date', + 'required' => true, + ]) + ->add('end_date', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_referrer_between_dates.end date', + 'required' => true, + ]); + } + + public function getFormDefaultData(): array + { + return [ + 'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), + 'end_date' => new RollingDate(RollingDate::T_TODAY), + 'accepted_referrers' => [], + ]; + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_referrers'] as $r) { + $users[] = $this->userRender->renderString($r, []); + } + + return [ + 'exports.filter.course.by_referrer_between_dates.description', [ + 'agents' => implode(', ', $users), + 'start_date' => $this->rollingDateConverter->convert($data['start_date']), + 'end_date' => $this->rollingDateConverter->convert($data['end_date']), + ], ]; + } + + public function getTitle(): string + { + return 'export.filter.course.by_referrer_between_dates.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php new file mode 100644 index 000000000..9b0eb4d72 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDatesTest.php @@ -0,0 +1,89 @@ +rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + $this->userRender = self::$container->get(UserRender::class); + } + + public function getFilter() + { + return new ReferrerFilterBetweenDates($this->rollingDateConverter, $this->userRender); + } + + public function getFormData() + { + self:self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $users = $em->createQueryBuilder() + ->from(User::class, 'u') + ->select('u') + ->getQuery() + ->setMaxResults(1) + ->getResult(); + + return [ + [ + 'accepted_referrers' => $users[0], + 'start_date' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'end_date' => new RollingDate(RollingDate::T_TODAY), + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + yield $em->createQueryBuilder() + ->from(AccompanyingPeriod::class, 'acp') + ->select('acp.id'); + + $qb = $em->createQueryBuilder(); + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person') + ; + + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + + yield $qb; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 38b5d5041..d488df8d6 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -96,11 +96,14 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_activeonedaybetweendates_filter } - chill.person.export.filter_referrer: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilter + Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilter: tags: - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter } + Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilterBetweenDates: + tags: + - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter_between_dates } + chill.person.export.filter_openbetweendates: class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter tags: diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index af85b2217..f94f9d578 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -145,6 +145,12 @@ exports: describe: >- Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} + Les agents traitants au { agent_at, date, medium }, seulement {agents} + + by_referrer_between_dates: + description: >- + Filtré par référent du parcours, entre deux dates: depuis le {start_date, date, medium}, jusqu'au {end_date, date, medium}, seulement {agents} + 'total persons matching the search pattern': >- { total, plural, =0 {Aucun usager ne correspond aux termes de recherche} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ec6036950..e4995d207 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1191,6 +1191,10 @@ export: "Filtered by user main scope: only %scope%": "Filtré par service du référent: uniquement %scope%" by_referrer: Computation date for referrer: Date à laquelle le référent était actif + by_referrer_between_dates: + title: Filtrer les parcours par référent (entre deux dates) + start date: Le référent était actif après le + end date: Le référent était actif avant le having_temporarily: label: Qualité de la localisation Having a temporarily location: Ayant une localisation temporaire From 4a15a89102e89a89ea168493d16523b7e8b7273b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 23 Jan 2024 14:20:27 +0100 Subject: [PATCH 26/42] [export] Add referrer on accompanying course filter between dates feature and relevant tests Implemented a new filter to the software for social workers. This filter, ReferrerFilterBetweenDates, enables filtering of query results based on a range of dates and accepted referrers. Tests for this new functionality have also been added to ensure the feature works as expected. --- .../AccompanyingCourseFilters/ReferrerFilterBetweenDates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php index 33a9b4cc3..c58aad3bb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php @@ -30,7 +30,7 @@ use Symfony\Component\Form\FormBuilderInterface; * * @see ReferrerFilterBetweenDatesTest for tests */ -class ReferrerFilterBetweenDates implements FilterInterface +final readonly class ReferrerFilterBetweenDates implements FilterInterface { private const A = 'acp_referrer_filter_uhistory'; @@ -40,7 +40,7 @@ class ReferrerFilterBetweenDates implements FilterInterface private const PU = 'acp_referrer_filter_users'; public function __construct( - private readonly RollingDateConverterInterface $rollingDateConverter, + private RollingDateConverterInterface $rollingDateConverter, private UserRender $userRender ) { } From 813f2f1e12e82c4137b891b2e41a82bf94d5c513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 15:34:33 +0100 Subject: [PATCH 27/42] Fix call within DI for referrer filter test --- .../Filter/AccompanyingCourseFilters/ReferrerFilterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php index a56741bd3..52173fe8c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php @@ -31,7 +31,7 @@ final class ReferrerFilterTest extends AbstractFilterTest { self::bootKernel(); - $this->filter = self::$container->get('chill.person.export.filter_referrer'); + $this->filter = self::$container->get(ReferrerFilter::class); } public function getFilter() From f8840d89bfcf996ee8060fe3443888766ecdec3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 23 Jan 2024 21:56:17 +0100 Subject: [PATCH 28/42] Add capability to store closing motive when closing accompanying period The commit introduces new functionality in the bundle that allows storing the closing motive when a course is closed. This is achieved by modifying the model and database schema to include a new `closingMotive` field in AccompanyingPeriodStepHistory entity. --- .../AccompanyingCourseController.php | 2 +- .../Entity/AccompanyingPeriod.php | 9 ++-- .../AccompanyingPeriodStepHistory.php | 19 +++++++ .../Tests/Entity/AccompanyingPeriodTest.php | 30 +++++++++++ .../migrations/Version20240123161457.php | 52 +++++++++++++++++++ 5 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20240123161457.php diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index a2ced7fee..6acca44e3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -62,7 +62,7 @@ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Contr $workflow = $this->registry->get($accompanyingCourse); if ($workflow->can($accompanyingCourse, 'close')) { - $workflow->apply($accompanyingCourse, 'close'); + $workflow->apply($accompanyingCourse, 'close', ['closing_motive' => $form['closingMotive']->getData()]); $em->flush(); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 9c88a4a69..4f9c480d0 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -1449,7 +1449,7 @@ class AccompanyingPeriod implements return $this; } - public function setStep(string $step): self + public function setStep(string $step, array $context = []): self { $previous = $this->step; @@ -1464,7 +1464,7 @@ class AccompanyingPeriod implements $history = new AccompanyingPeriodStepHistory(); $history->setStep($this->step)->setStartDate(new \DateTimeImmutable('now')); - $this->addStepHistory($history); + $this->addStepHistory($history, $context); } return $this; @@ -1507,11 +1507,14 @@ class AccompanyingPeriod implements return $this; } - private function addStepHistory(AccompanyingPeriodStepHistory $stepHistory): self + private function addStepHistory(AccompanyingPeriodStepHistory $stepHistory, array $context = []): self { if (!$this->stepHistories->contains($stepHistory)) { $this->stepHistories[] = $stepHistory; $stepHistory->setPeriod($this); + if (($context['closing_motive'] ?? null) instanceof ClosingMotive) { + $stepHistory->setClosingMotive($context['closing_motive']); + } $this->ensureStepContinuity(); } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php index 15b2f0d2e..fd4d573ce 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php @@ -59,6 +59,13 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda */ private string $step; + /** + * @ORM\ManyToOne(targetEntity=ClosingMotive::class) + * + * @ORM\JoinColumn(nullable=true) + */ + private ?AccompanyingPeriod\ClosingMotive $closingMotive = null; + public function getEndDate(): ?\DateTimeImmutable { return $this->endDate; @@ -114,4 +121,16 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda return $this; } + + public function getClosingMotive(): ?AccompanyingPeriod\ClosingMotive + { + return $this->closingMotive; + } + + public function setClosingMotive(?AccompanyingPeriod\ClosingMotive $closingMotive): self + { + $this->closingMotive = $closingMotive; + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php index 5fdb51c15..9e383b789 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Entity/AccompanyingPeriodTest.php @@ -312,4 +312,34 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase $this->assertNull($period->getRequestorPerson()); $this->assertNull($period->getRequestor()); } + + public function testSetStep(): void + { + $period = new AccompanyingPeriod(); + + $period->setStep(AccompanyingPeriod::STEP_CONFIRMED); + + self::assertEquals(AccompanyingPeriod::STEP_CONFIRMED, $period->getStep()); + self::assertCount(1, $period->getStepHistories()); + + $period->setStep(AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT); + + self::assertEquals(AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT, $period->getStep()); + self::assertCount(2, $period->getStepHistories()); + + $periodInactiveSteps = $period->getStepHistories()->filter(fn (AccompanyingPeriod\AccompanyingPeriodStepHistory $h) => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT === $h->getStep()); + self::assertCount(1, $periodInactiveSteps); + + $period->setStep(AccompanyingPeriod::STEP_CLOSED, ['closing_motive' => $closingMotive = new AccompanyingPeriod\ClosingMotive()]); + + self::assertEquals(AccompanyingPeriod::STEP_CLOSED, $period->getStep()); + self::assertCount(3, $period->getStepHistories()); + + $periodClosedSteps = $period->getStepHistories()->filter(fn (AccompanyingPeriod\AccompanyingPeriodStepHistory $h) => AccompanyingPeriod::STEP_CLOSED === $h->getStep()); + self::assertCount(1, $periodClosedSteps); + + $periodClosedStep = $periodClosedSteps->first(); + + self::assertSame($closingMotive, $periodClosedStep->getClosingMotive()); + } } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240123161457.php b/src/Bundle/ChillPersonBundle/migrations/Version20240123161457.php new file mode 100644 index 000000000..4c19e6c8f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240123161457.php @@ -0,0 +1,52 @@ +addSql('ALTER TABLE chill_person_accompanying_period_step_history ADD closingMotive_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_step_history ADD CONSTRAINT FK_84D514AC504CB38D FOREIGN KEY (closingMotive_id) REFERENCES chill_person_accompanying_period_closingmotive (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_step_history ADD CONSTRAINT FK_84D514AC65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql(<<<'EOF' + WITH last_step AS ( + SELECT * FROM ( + SELECT *, rank() OVER (partition by period_id ORDER BY startdate DESC, id DESC) AS r FROM chill_person_accompanying_period_step_history cpapsh + ) as sq + WHERE r = 1 + ) + UPDATE chill_person_accompanying_period_step_history + SET closingMotive_id = chill_person_accompanying_period.closingmotive_id + FROM last_step, chill_person_accompanying_period + WHERE last_step.period_id = chill_person_accompanying_period_step_history.period_id AND chill_person_accompanying_period.id = chill_person_accompanying_period_step_history.period_id + AND last_step.step = 'CLOSED'; + EOF); + $this->addSql('CREATE INDEX IDX_84D514AC504CB38D ON chill_person_accompanying_period_step_history (closingMotive_id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_accompanying_period_step_history DROP CONSTRAINT FK_84D514AC504CB38D'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_step_history DROP CONSTRAINT FK_84D514AC65FF1AEC'); + $this->addSql('DROP INDEX IDX_84D514AC504CB38D'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_step_history DROP closingMotive_id'); + } +} From b6ea857389c14cb4d601cf3aba3e3d005911baab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 09:55:02 +0100 Subject: [PATCH 29/42] Add AccompanyingCourseStepHistory counting capabilities The newly created CountAccompanyingCourseStepHistory class counts changes in AccompanyingPeriod status. Corresponding test file ensures the correct functionality. Supporting translations and necessary export declarations have been added to facilitate this change. --- exports_alias_conventions.md | 140 +++++++++--------- .../ChillPersonBundle/Export/Declarations.php | 2 + .../CountAccompanyingCourseStepHistory.php | 139 +++++++++++++++++ ...CountAccompanyingCourseStepHistoryTest.php | 48 ++++++ .../translations/messages.fr.yml | 3 + 5 files changed, 263 insertions(+), 69 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourseStepHistory.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php diff --git a/exports_alias_conventions.md b/exports_alias_conventions.md index eb0545702..d4d034314 100644 --- a/exports_alias_conventions.md +++ b/exports_alias_conventions.md @@ -5,72 +5,74 @@ Add condition with distinct alias on each export join clauses (Indicators + Filt These are alias conventions : -| Entity | Join | Attribute | Alias | -|:----------------------------------------|:----------------------------------------|:-------------------------------------------|:---------------------------------------| -| AccompanyingPeriod::class | | | acp | -| | AccompanyingPeriodWork::class | acp.works | acpw | -| | AccompanyingPeriodParticipation::class | acp.participations | acppart | -| | Location::class | acp.administrativeLocation | acploc | -| | ClosingMotive::class | acp.closingMotive | acpmotive | -| | UserJob::class | acp.job | acpjob | -| | Origin::class | acp.origin | acporigin | -| | Scope::class | acp.scopes | acpscope | -| | SocialIssue::class | acp.socialIssues | acpsocialissue | -| | User::class | acp.user | acpuser | -| | AccompanyingPeriopStepHistory::class | acp.stepHistories | acpstephistories | -| | AccompanyingPeriodInfo::class | not existing (using custom WITH clause) | acpinfo | -| AccompanyingPeriodWork::class | | | acpw | -| | AccompanyingPeriodWorkEvaluation::class | acpw.accompanyingPeriodWorkEvaluations | workeval | -| | SocialAction::class | acpw.socialAction | acpwsocialaction | -| | Goal::class | acpw.goals | goal | -| | Result::class | acpw.results | result | -| AccompanyingPeriodParticipation::class | | | acppart | -| | Person::class | acppart.person | partperson | -| AccompanyingPeriodWorkEvaluation::class | | | workeval | -| | Evaluation::class | workeval.evaluation | eval | -| AccompanyingPeriodInfo::class | | | acpinfo | -| | User::class | acpinfo.user | acpinfo_user | -| Goal::class | | | goal | -| | Result::class | goal.results | goalresult | -| Person::class | | | person | -| | Center::class | person.center | center | -| | HouseholdMember::class | partperson.householdParticipations | householdmember | -| | MaritalStatus::class | person.maritalStatus | personmarital | -| | VendeePerson::class | | vp | -| | VendeePersonMineur::class | | vpm | -| | CurrentPersonAddress::class | person.currentPersonAddress | currentPersonAddress (on a given date) | -| ResidentialAddress::class | | | resaddr | -| | ThirdParty::class | resaddr.hostThirdParty | tparty | -| ThirdParty::class | | | tparty | -| | ThirdPartyCategory::class | tparty.categories | tpartycat | -| HouseholdMember::class | | | householdmember | -| | Household::class | householdmember.household | household | -| | Person::class | householdmember.person | memberperson | -| | | memberperson.center | membercenter | -| Household::class | | | household | -| | HouseholdComposition::class | household.compositions | composition | -| Activity::class | | | activity | -| | Person::class | activity.person | actperson | -| | AccompanyingPeriod::class | activity.accompanyingPeriod | acp | -| | Person::class | activity\_person\_having\_activity.person | person\_person\_having\_activity | -| | ActivityReason::class | activity\_person\_having\_activity.reasons | reasons\_person\_having\_activity | -| | ActivityType::class | activity.activityType | acttype | -| | Location::class | activity.location | actloc | -| | SocialAction::class | activity.socialActions | actsocialaction | -| | SocialIssue::class | activity.socialIssues | actsocialssue | -| | ThirdParty::class | activity.thirdParties | acttparty | -| | User::class | activity.user | actuser | -| | User::class | activity.users | actusers | -| | ActivityReason::class | activity.reasons | actreasons | -| | Center::class | actperson.center | actcenter | -| | Person::class | activity.createdBy | actcreator | -| ActivityReason::class | | | actreasons | -| | ActivityReasonCategory::class | actreason.category | actreasoncat | -| Calendar::class | | | cal | -| | CancelReason::class | cal.cancelReason | calcancel | -| | Location::class | cal.location | calloc | -| | User::class | cal.user | caluser | -| VendeePerson::class | | | vp | -| | SituationProfessionelle::class | vp.situationProfessionelle | vpprof | -| | StatutLogement::class | vp.statutLogement | vplog | -| | TempsDeTravail::class | vp.tempsDeTravail | vptt | +| Entity | Join | Attribute | Alias | +|:----------------------------------------|:----------------------------------------|:-------------------------------------------|:-------------------------------------------| +| AccompanyingPeriodStepHistory::class | | | acpstephistory (contexte ACP_STEP_HISTORY) | +| | AccompanyingPeriod::class | acpstephistory.period | acp | +| AccompanyingPeriod::class | | | acp | +| | AccompanyingPeriodWork::class | acp.works | acpw | +| | AccompanyingPeriodParticipation::class | acp.participations | acppart | +| | Location::class | acp.administrativeLocation | acploc | +| | ClosingMotive::class | acp.closingMotive | acpmotive | +| | UserJob::class | acp.job | acpjob | +| | Origin::class | acp.origin | acporigin | +| | Scope::class | acp.scopes | acpscope | +| | SocialIssue::class | acp.socialIssues | acpsocialissue | +| | User::class | acp.user | acpuser | +| | AccompanyingPeriopStepHistory::class | acp.stepHistories | acpstephistories | +| | AccompanyingPeriodInfo::class | not existing (using custom WITH clause) | acpinfo | +| AccompanyingPeriodWork::class | | | acpw | +| | AccompanyingPeriodWorkEvaluation::class | acpw.accompanyingPeriodWorkEvaluations | workeval | +| | SocialAction::class | acpw.socialAction | acpwsocialaction | +| | Goal::class | acpw.goals | goal | +| | Result::class | acpw.results | result | +| AccompanyingPeriodParticipation::class | | | acppart | +| | Person::class | acppart.person | partperson | +| AccompanyingPeriodWorkEvaluation::class | | | workeval | +| | Evaluation::class | workeval.evaluation | eval | +| AccompanyingPeriodInfo::class | | | acpinfo | +| | User::class | acpinfo.user | acpinfo_user | +| Goal::class | | | goal | +| | Result::class | goal.results | goalresult | +| Person::class | | | person | +| | Center::class | person.center | center | +| | HouseholdMember::class | partperson.householdParticipations | householdmember | +| | MaritalStatus::class | person.maritalStatus | personmarital | +| | VendeePerson::class | | vp | +| | VendeePersonMineur::class | | vpm | +| | CurrentPersonAddress::class | person.currentPersonAddress | currentPersonAddress (on a given date) | +| ResidentialAddress::class | | | resaddr | +| | ThirdParty::class | resaddr.hostThirdParty | tparty | +| ThirdParty::class | | | tparty | +| | ThirdPartyCategory::class | tparty.categories | tpartycat | +| HouseholdMember::class | | | householdmember | +| | Household::class | householdmember.household | household | +| | Person::class | householdmember.person | memberperson | +| | | memberperson.center | membercenter | +| Household::class | | | household | +| | HouseholdComposition::class | household.compositions | composition | +| Activity::class | | | activity | +| | Person::class | activity.person | actperson | +| | AccompanyingPeriod::class | activity.accompanyingPeriod | acp | +| | Person::class | activity\_person\_having\_activity.person | person\_person\_having\_activity | +| | ActivityReason::class | activity\_person\_having\_activity.reasons | reasons\_person\_having\_activity | +| | ActivityType::class | activity.activityType | acttype | +| | Location::class | activity.location | actloc | +| | SocialAction::class | activity.socialActions | actsocialaction | +| | SocialIssue::class | activity.socialIssues | actsocialssue | +| | ThirdParty::class | activity.thirdParties | acttparty | +| | User::class | activity.user | actuser | +| | User::class | activity.users | actusers | +| | ActivityReason::class | activity.reasons | actreasons | +| | Center::class | actperson.center | actcenter | +| | Person::class | activity.createdBy | actcreator | +| ActivityReason::class | | | actreasons | +| | ActivityReasonCategory::class | actreason.category | actreasoncat | +| Calendar::class | | | cal | +| | CancelReason::class | cal.cancelReason | calcancel | +| | Location::class | cal.location | calloc | +| | User::class | cal.user | caluser | +| VendeePerson::class | | | vp | +| | SituationProfessionelle::class | vp.situationProfessionelle | vpprof | +| | StatutLogement::class | vp.statutLogement | vplog | +| | TempsDeTravail::class | vp.tempsDeTravail | vptt | diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index 4186861cb..83673234c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -18,6 +18,8 @@ abstract class Declarations { final public const ACP_TYPE = 'accompanying_period'; + final public const ACP_STEP_HISTORY = 'accompanying_period_step_history'; + final public const EVAL_TYPE = 'evaluation'; final public const HOUSEHOLD_TYPE = 'household'; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourseStepHistory.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourseStepHistory.php new file mode 100644 index 000000000..4f620fa34 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourseStepHistory.php @@ -0,0 +1,139 @@ +repository = $em->getRepository(AccompanyingPeriod::class); + $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // Nothing to add here + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.acp_closing.description'; + } + + public function getGroup(): string + { + return 'Exports of accompanying courses'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return fn ($value) => '_header' === $value ? $this->getTitle() : $value; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.acp_closing.title'; + } + + public function getType(): string + { + return Declarations::ACP_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriod\AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + $qb + ->leftJoin('acp.participations', 'acppart') + ->leftJoin('acppart.person', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + Declarations::ACP_STEP_HISTORY, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php new file mode 100644 index 000000000..19adee99f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseStepHistoryTest.php @@ -0,0 +1,48 @@ +get(EntityManagerInterface::class); + + yield new CountAccompanyingCourseStepHistory($em, $this->getParameters(true)); + yield new CountAccompanyingCourseStepHistory($em, $this->getParameters(false)); + } + + public function getFormData(): array + { + return [[]]; + } + + public function getModifiersCombination() + { + return [[Declarations::ACP_TYPE], [Declarations::ACP_TYPE, Declarations::ACP_STEP_HISTORY]]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ec6036950..ce7f06ab1 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -985,6 +985,9 @@ export: YYYY-MM: par mois YYYY: par année export: + acp_closing: + title: Nombre de changements de statuts de parcours + description: Compte le nombre de changements de statuts de parcours. Cet export est indiqué pour obtenir le nombre de parcours ouverts ou fermés pendant une période de temps (un parcours pouvant être clôturé, puis ré-ouvert pendant la période de temps indiquée) acp_stats: avg_duration: Moyenne de la durée de participation de chaque usager concerné count_participations: Nombre de participations distinctes From 44ccfe92b61229804bd4268087aa180e8923dbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 11:13:38 +0100 Subject: [PATCH 30/42] Add ByDateFilter and its test for AccompanyingPeriodStepHistoryFilters A new filter called ByDateFilter has been added under AccompanyingPeriodStepHistoryFilters. This filter allows users to filter data based on a date range on the start date. Corresponding unit tests for ByDateFilter are included in this commit. Both English and French translations for the new filter are also added. --- .../ByDateFilter.php | 96 +++++++++++++++++++ .../ByDateFilterTest.php | 67 +++++++++++++ .../translations/messages+intl-icu.fr.yaml | 7 +- .../translations/messages.fr.yml | 7 ++ 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php new file mode 100644 index 000000000..8026f4573 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php @@ -0,0 +1,96 @@ +add('start_date', PickRollingDateType::class, [ + 'label' => 'export.filter.step_history.by_date.start_date_label', + ]) + ->add('end_date', PickRollingDateType::class, [ + 'label' => 'export.filter.step_history.by_date.end_date_label', + ]); + } + + public function getFormDefaultData(): array + { + return [ + 'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), + 'end_date' => new RollingDate(RollingDate::T_TODAY), + ]; + } + + public function describeAction($data, $format = 'string') + { + return [ + 'exports.filter.step_history.by_date.description', + [ + 'start_date' => $this->rollingDateConverter->convert($data['start_date']), + 'end_date' => $this->rollingDateConverter->convert($data['end_date']), + ], + ]; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $startDate = 'acp_step_history_by_date_start_filter'; + $endDate = 'acp_step_history_by_date_end_filter'; + + $qb + ->andWhere( + "acpstephistory.startDate >= :{$startDate} AND (acpstephistory.endDate < :{$endDate} OR acpstephistory.endDate IS NULL)" + ) + ->setParameter($startDate, $this->rollingDateConverter->convert($data['start_date'])) + ->setParameter($endDate, $this->rollingDateConverter->convert($data['end_date'])); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php new file mode 100644 index 000000000..978bf9488 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilterTest.php @@ -0,0 +1,67 @@ +rollingDateConverter = self::$container->get(RollingDateConverterInterface::class); + } + + public function getFilter() + { + return new ByDateFilter($this->rollingDateConverter); + } + + public function getFormData() + { + return [ + [ + 'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START), + 'end_date' => new RollingDate(RollingDate::T_TODAY), + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index af85b2217..52acb0d80 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -140,7 +140,12 @@ exports: by_treating_agent: Filtered by treating agent at date: >- Les agents traitant au { agent_at, date, medium }, seulement {agents} - course: + + step_history: + by_date: + description: >- + Changements de statuts filtrés par date: après le { start_date, date, medium } (inclus), avant le { end_date, date, medium } + not_having_address_reference: describe: >- Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ce7f06ab1..206664b63 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1131,6 +1131,13 @@ export: by_geog_unit: Filtered by person's geographical unit (based on address) computed at %datecalc%, only %units%: Filtré par unité géographique (sur base de l'adresse), calculé le %datecalc%, seulement %units% + step_history: + by_closing_motive + by_date: + title: Filtrer les changements de statut du parcours par date + start_date_label: Changements après le + end_date_label: Changements avant le + person: by_composition: Filter by household composition: Filtrer les usagers par composition du ménage From 97d401b7f67289ec4dc2eefcffc577c6e60a8777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 11:37:59 +0100 Subject: [PATCH 31/42] Implement ByStepFilter for AccompanyingPeriodStepHistoryFilters and its tests A new feature has been added, the ByStepFilter, to the Chill project. The ByStepFilter provides a way to filter data in AccompanyingPeriodStepHistoryFilters based on certain steps. In addition, a new test suite has been introduced to ensure the correct functionality of this filter. The necessary translations for completing this feature have also been included. --- .../ByStepFilter.php | 87 +++++++++++++++++++ .../ByStepFilterTest.php | 66 ++++++++++++++ .../translations/messages.fr.yml | 7 +- 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php new file mode 100644 index 000000000..337b27e8a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php @@ -0,0 +1,87 @@ +add('steps', ChoiceType::class, [ + 'choices' => array_combine( + array_map(static fn (string $step): string => 'accompanying_period.'.$step, $steps), + $steps + ), + 'label' => 'export.filter.step_history.by_step.pick_steps', + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getFormDefaultData(): array + { + return [ + 'steps' => [], + ]; + } + + public function describeAction($data, $format = 'string') + { + return [ + 'export.filter.step_history.by_step.description', + [ + '%steps%' => implode(', ', array_map(fn (string $step) => $this->translator->trans('accompanying_period.'.$step), $data['steps'])), + ], + ]; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->andWhere('acpstephistory.step IN (:acpstephistory_by_step_filter_steps)') + ->setParameter('acpstephistory_by_step_filter_steps', $data['steps']); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php new file mode 100644 index 000000000..a603bd219 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -0,0 +1,66 @@ + [AccompanyingPeriod::STEP_CONFIRMED, AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG], + ], + [ + 'steps' => [AccompanyingPeriod::STEP_CLOSED], + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 206664b63..e865cab76 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -786,6 +786,8 @@ accompanying_period: DRAFT: Brouillon CONFIRMED: Confirmé CLOSED: Clotûré + CONFIRMED_INACTIVE_SHORT: Hors file active + CONFIRMED_INACTIVE_LONG: Pré-archivé emergency: Urgent occasional: ponctuel regular: régulier @@ -1132,7 +1134,10 @@ export: Filtered by person's geographical unit (based on address) computed at %datecalc%, only %units%: Filtré par unité géographique (sur base de l'adresse), calculé le %datecalc%, seulement %units% step_history: - by_closing_motive + by_step: + title: Filtrer les changements de statut du parcours par étape + pick_steps: Nouvelles étapes + description: "Filtré par étape: seulement %steps%" by_date: title: Filtrer les changements de statut du parcours par date start_date_label: Changements après le From 01785ed49416dad42597c9c46589794528dd7d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 12:13:23 +0100 Subject: [PATCH 32/42] Add ByStepAggregator to AccompanyingPeriodStepHistoryAggregators Added a new ByStepAggregator to the AccompanyingPeriodStepHistoryAggregators, allowing to group status changes in the course by step. The corresponding test suite ensures the correct operation of this new class. Updates in the translations file have also been made as part of this addition. --- .../ByStepAggregator.php | 86 +++++++++++++++++++ .../ByStepAggregatorTest.php | 58 +++++++++++++ .../translations/messages.fr.yml | 5 ++ 3 files changed, 149 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php new file mode 100644 index 000000000..005d012f9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php @@ -0,0 +1,86 @@ +translator->trans('accompanying_period.'.$step); + }; + } + + public function getQueryKeys($data) + { + return [ + self::KEY, + ]; + } + + public function getTitle() + { + return 'export.aggregator.step_history.by_step.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->addSelect('acpstephistory.step AS '.self::KEY) + ->addGroupBy(self::KEY); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php new file mode 100644 index 000000000..f71b06351 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -0,0 +1,58 @@ +get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e865cab76..8614a00db 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1042,6 +1042,11 @@ export: at_date: Date de calcul de l'adresse header: Code postal + step_history: + by_step: + title: Grouper les changements de statut du parcours par étape + header: Nouveau statut du parcours + course: by-user: title: Grouper les parcours par usager participant From bf97b2a50cff31abd657102a19e4f4b66e9d0472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 12:31:57 +0100 Subject: [PATCH 33/42] Add ByDateAggregator to AccompanyingPeriodStepHistoryAggregators Implemented a new ByDateAggregator in the AccompanyingPeriodStepHistoryAggregators for grouping status changes by date. A corresponding test suite has been included to verify its function. Necessary translations have also been updated. --- .../ByDateAggregator.php | 90 +++++++++++++++++++ .../ByDateAggregatorTest.php | 61 +++++++++++++ .../translations/messages.fr.yml | 5 +- 3 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregator.php new file mode 100644 index 000000000..fbd80c7a5 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregator.php @@ -0,0 +1,90 @@ +add('frequency', ChoiceType::class, [ + 'choices' => array_combine( + array_map(fn (DateGroupingChoiceEnum $c) => 'export.enum.frequency.'.$c->value, DateGroupingChoiceEnum::cases()), + array_map(fn (DateGroupingChoiceEnum $c) => $c->value, DateGroupingChoiceEnum::cases()), + ), + 'label' => 'export.aggregator.course.by_opening_date.frequency', + 'multiple' => false, + 'expanded' => true, + ]); + } + + public function getFormDefaultData(): array + { + return ['frequency' => DateGroupingChoiceEnum::YEAR->value]; + } + + public function getLabels($key, array $values, mixed $data) + { + return function (?string $value): string { + if ('_header' === $value) { + return 'export.aggregator.step_history.by_date.header'; + } + + if (null === $value || '' === $value) { + return ''; + } + + return $value; + }; + } + + public function getQueryKeys($data) + { + return [self::KEY]; + } + + public function getTitle() + { + return 'export.aggregator.step_history.by_date.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $p = self::KEY; + + $qb->addSelect(sprintf("TO_CHAR(acpstephistory.startDate, '%s') AS {$p}", $data['frequency'])); + $qb->addGroupBy($p); + $qb->addOrderBy($p, 'DESC'); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php new file mode 100644 index 000000000..74a30d1a6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregatorTest.php @@ -0,0 +1,61 @@ + DateGroupingChoiceEnum::YEAR->value, + ], + [ + 'frequency' => DateGroupingChoiceEnum::WEEK->value, + ], + [ + 'frequency' => DateGroupingChoiceEnum::MONTH->value, + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 8614a00db..e751dd538 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1046,7 +1046,10 @@ export: by_step: title: Grouper les changements de statut du parcours par étape header: Nouveau statut du parcours - + by_date: + title: Grouper les changement de statut du parcours par date + header: Date du changement de statut du parcours + date_grouping_label: Grouper par course: by-user: title: Grouper les parcours par usager participant From 568ee079b54f94edee44abe6c4ab22feaae108fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 12:54:44 +0100 Subject: [PATCH 34/42] Add ByClosingMotiveAggregator on AccompanyingPeriodStepHistory exports and corresponding tests Added a new class ByClosingMotiveAggregator to the AccompanyingPeriodStepHistoryAggregators for grouping status changes by closing motive. This also includes a corresponding test class. Additionally, updated relevant translations in the messages.fr.yml file. --- .../ByClosingMotiveAggregator.php | 84 +++++++++++++++++++ .../ByClosingMotiveAggregatorTest.php | 68 +++++++++++++++ .../translations/messages.fr.yml | 6 +- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php new file mode 100644 index 000000000..f999a44db --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php @@ -0,0 +1,84 @@ +closingMotiveRepository->find((int) $value)) { + return ''; + } + + return $this->closingMotiveRender->renderString($closingMotive, []); + }; + } + + public function getQueryKeys($data) + { + return [ + self::KEY, + ]; + } + + public function getTitle() + { + return 'export.aggregator.step_history.by_closing_motive.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->addSelect('IDENTITY(acpstephistory.closingMotive) AS '.self::KEY) + ->addGroupBy(self::KEY); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php new file mode 100644 index 000000000..2ce63af34 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregatorTest.php @@ -0,0 +1,68 @@ +closingMotiveRender = self::$container->get(ClosingMotiveRender::class); + $this->closingMotiveRepository = self::$container->get(ClosingMotiveRepositoryInterface::class); + } + + public function getAggregator() + { + return new ByClosingMotiveAggregator( + $this->closingMotiveRepository, + $this->closingMotiveRender + ); + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e751dd538..4b3094add 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1047,9 +1047,13 @@ export: title: Grouper les changements de statut du parcours par étape header: Nouveau statut du parcours by_date: - title: Grouper les changement de statut du parcours par date + title: Grouper les changements de statut du parcours par date header: Date du changement de statut du parcours date_grouping_label: Grouper par + by_closing_motive: + title: Grouper les changements de statut du parcours par motif de clôture + header: Motif de clôture + course: by-user: title: Grouper les parcours par usager participant From 5849d8d670b78ea51f645d656649d4c829792846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 13:29:42 +0100 Subject: [PATCH 35/42] fix typo --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 4b3094add..ec6dae622 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -785,7 +785,7 @@ accompanying_period: dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date% DRAFT: Brouillon CONFIRMED: Confirmé - CLOSED: Clotûré + CLOSED: Clôturé CONFIRMED_INACTIVE_SHORT: Hors file active CONFIRMED_INACTIVE_LONG: Pré-archivé emergency: Urgent From 21bd6478adb3b60f07ec5d37f239fdf62bfb0ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 13:30:37 +0100 Subject: [PATCH 36/42] Add DI configuration for the export of period step history data within the ChillPersonBundle This commit adds dependency injection configuration for the export of period step history data within the ChillPersonBundle. It specifically configures exports, filters, and aggregators, all related to the accompanying period step history. Additionally, it updates ChillPersonExtension to load this newly created configuration. --- .../ChillPersonExtension.php | 1 + ...orts_accompanying_period_step_history.yaml | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period_step_history.yaml diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 3d5c0bc64..ebbfedeb3 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -98,6 +98,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/exports_accompanying_course.yaml'); $loader->load('services/exports_social_actions.yaml'); $loader->load('services/exports_evaluation.yaml'); + $loader->load('services/exports_accompanying_period_step_history.yaml'); } $loader->load('services/exports_household.yaml'); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period_step_history.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period_step_history.yaml new file mode 100644 index 000000000..09da707c9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period_step_history.yaml @@ -0,0 +1,31 @@ +services: + _defaults: + autowire: true + autoconfigure: true + + # exports + Chill\PersonBundle\Export\Export\CountAccompanyingCourseStepHistory: + tags: + - { name: chill.export, alias: count_acpstephistory } + + # filters + Chill\PersonBundle\Export\Filter\AccompanyingPeriodStepHistoryFilters\ByDateFilter: + tags: + - { name: chill.export_filter, alias: acpstephistory_filter_by_date } + + Chill\PersonBundle\Export\Filter\AccompanyingPeriodStepHistoryFilters\ByStepFilter: + tags: + - { name: chill.export_filter, alias: acpstephistory_filter_by_step } + + # aggregators + Chill\PersonBundle\Export\Aggregator\AccompanyingPeriodStepHistoryAggregators\ByClosingMotiveAggregator: + tags: + - { name: chill.export_aggregator, alias: acpstephistory_agg_by_closing_motive } + + Chill\PersonBundle\Export\Aggregator\AccompanyingPeriodStepHistoryAggregators\ByDateAggregator: + tags: + - { name: chill.export_aggregator, alias: acpstephistory_agg_by_date } + + Chill\PersonBundle\Export\Aggregator\AccompanyingPeriodStepHistoryAggregators\ByStepAggregator: + tags: + - { name: chill.export_aggregator, alias: acpstephistory_agg_by_step } From 86613a9be93b2238bf874cb0431cc8242f434248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 29 Jan 2024 13:34:07 +0100 Subject: [PATCH 37/42] Add changie for the whole feature --- .changes/unreleased/Feature-20240129-133319.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Feature-20240129-133319.yaml diff --git a/.changes/unreleased/Feature-20240129-133319.yaml b/.changes/unreleased/Feature-20240129-133319.yaml new file mode 100644 index 000000000..ff2b96ebf --- /dev/null +++ b/.changes/unreleased/Feature-20240129-133319.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: 'Add capability to generate export about change of steps of accompanying period, and generate exports for this' +time: 2024-01-29T13:33:19.190365565+01:00 +custom: + Issue: "244" From 4bbad4fc61af62643f011e2df0807e62375dcb36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 15:38:56 +0100 Subject: [PATCH 38/42] fix cs with php-cs-fixer 3.49 --- .../AccompanyingPeriod/AccompanyingPeriodStepHistory.php | 6 +++--- .../ByClosingMotiveAggregator.php | 2 +- .../ByStepAggregatorTest.php | 2 +- .../ByStepFilterTest.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php index fd4d573ce..c25c11e69 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodStepHistory.php @@ -64,7 +64,7 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda * * @ORM\JoinColumn(nullable=true) */ - private ?AccompanyingPeriod\ClosingMotive $closingMotive = null; + private ?ClosingMotive $closingMotive = null; public function getEndDate(): ?\DateTimeImmutable { @@ -122,12 +122,12 @@ class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpda return $this; } - public function getClosingMotive(): ?AccompanyingPeriod\ClosingMotive + public function getClosingMotive(): ?ClosingMotive { return $this->closingMotive; } - public function setClosingMotive(?AccompanyingPeriod\ClosingMotive $closingMotive): self + public function setClosingMotive(?ClosingMotive $closingMotive): self { $this->closingMotive = $closingMotive; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php index f999a44db..b5776ebeb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php @@ -40,7 +40,7 @@ final readonly class ByClosingMotiveAggregator implements AggregatorInterface public function getLabels($key, array $values, mixed $data) { - return function (null|int|string $value): string { + return function (int|string|null $value): string { if ('_header' === $value) { return 'export.aggregator.step_history.by_closing_motive.header'; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php index f71b06351..65752fea2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -27,7 +27,7 @@ class ByStepAggregatorTest extends AbstractAggregatorTest public function getAggregator() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php index a603bd219..2924be7e7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilterTest.php @@ -28,7 +28,7 @@ class ByStepFilterTest extends AbstractFilterTest public function getFilter() { $translator = new class () implements TranslatorInterface { - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return $id; } From f5f6eb78a2a8608109386cc1cd486758aac098f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 16:00:55 +0100 Subject: [PATCH 39/42] fix incorrect merge of messages+intl-icu.fr.yaml --- .../translations/messages+intl-icu.fr.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 52acb0d80..28d3d1274 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -136,6 +136,10 @@ exports: Filtered by person\'s geographical unit (based on address) computed at date, only units: "Filtré par zone géographique sur base de l'adresse, calculé à {datecalc, date, short}, seulement les zones suivantes: {units}" filter: + course: + not_having_address_reference: + describe: >- + Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} work: by_treating_agent: Filtered by treating agent at date: >- @@ -146,9 +150,6 @@ exports: description: >- Changements de statuts filtrés par date: après le { start_date, date, medium } (inclus), avant le { end_date, date, medium } - not_having_address_reference: - describe: >- - Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} 'total persons matching the search pattern': >- { total, plural, From c05451bfe924ff08cbc21fe39f4ed5d814db32e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 16:38:41 +0100 Subject: [PATCH 40/42] Update 'calc_date' field option in HasTemporaryLocationFilter.php This commit makes the 'calc_date' field in HasTemporaryLocationFilter.php required. This field was previously optional; this change ensures that a calculation date is always provided when filtering accompanying courses by temporary location. --- .../AccompanyingCourseFilters/HasTemporaryLocationFilter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 3313cb23f..741a19961 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -70,7 +70,8 @@ class HasTemporaryLocationFilter implements FilterInterface }, ]) ->add('calc_date', PickRollingDateType::class, [ - 'label' => 'export.filter.course.having_temporarily.Calculation date', 'having_temporarily' => true, + 'label' => 'export.filter.course.having_temporarily.Calculation date', + 'required' => true, ]); } From 67c3de733faad7dcc8ce09ff36afe8b9a15da11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 16:40:03 +0100 Subject: [PATCH 41/42] Refactor ActivityReasonAggregator: can be applied also on export for Activities linked with accompanying period This commit renames the ActivityReasonAggregator's namespace from PersonAggregators to Aggregator and modifies its methods. The join method in the query builder has been changed from innerJoin to leftJoin, 'group by' part is simplified, and the applyOn method now returns Declarations::ACTIVITY instead of Declarations::ACTIVITY_PERSON. Further modifications apply to the getFormDefaultData method and the corresponding test. --- .../unreleased/Feature-20240207-164038.yaml | 5 ++++ .../ActivityReasonAggregator.php | 26 +++++++++---------- .../ActivityReasonAggregatorTest.php | 23 +++++++++------- .../config/services/export.yaml | 2 +- 4 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 .changes/unreleased/Feature-20240207-164038.yaml rename src/Bundle/ChillActivityBundle/Export/Aggregator/{PersonAggregators => }/ActivityReasonAggregator.php (86%) rename src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/{PersonAggregators => }/ActivityReasonAggregatorTest.php (69%) diff --git a/.changes/unreleased/Feature-20240207-164038.yaml b/.changes/unreleased/Feature-20240207-164038.yaml new file mode 100644 index 000000000..ff5096036 --- /dev/null +++ b/.changes/unreleased/Feature-20240207-164038.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: Allow to group activities linked with accompanying period by reason +time: 2024-02-07T16:40:38.408575109+01:00 +custom: + Issue: "229" diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php similarity index 86% rename from src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php rename to src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index 569c4ca9a..9945fd80a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); * the LICENSE file that was distributed with this source code. */ -namespace Chill\ActivityBundle\Export\Aggregator\PersonAggregators; +namespace Chill\ActivityBundle\Export\Aggregator; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository; @@ -25,8 +25,11 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper) - { + public function __construct( + protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, + protected ActivityReasonRepository $activityReasonRepository, + protected TranslatableStringHelper $translatableStringHelper + ) { } public function addRole(): ?string @@ -51,7 +54,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali // make a jointure only if needed if (!\in_array('actreasons', $qb->getAllAliases(), true)) { - $qb->innerJoin('activity.reasons', 'actreasons'); + $qb->leftJoin('activity.reasons', 'actreasons'); } // join category if necessary @@ -62,19 +65,12 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali } } - // add the "group by" part - $groupBy = $qb->getDQLPart('groupBy'); - - if (\count($groupBy) > 0) { - $qb->addGroupBy($alias); - } else { - $qb->groupBy($alias); - } + $qb->addGroupBy($alias); } public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) @@ -96,7 +92,9 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali public function getFormDefaultData(): array { - return []; + return [ + 'level' => 'reasons', + ]; } public function getLabels($key, array $values, $data) diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php similarity index 69% rename from src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php rename to src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php index 004de0b99..3e1d473f0 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/ActivityReasonAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); * the LICENSE file that was distributed with this source code. */ -namespace Chill\ActivityBundle\Tests\Export\Aggregator\PersonAggregators; +namespace Chill\ActivityBundle\Tests\Export\Aggregator; use Chill\ActivityBundle\Entity\Activity; -use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator; +use Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; use Prophecy\PhpUnit\ProphecyTrait; @@ -33,14 +33,14 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest self::bootKernel(); $this->aggregator = self::$container->get(ActivityReasonAggregator::class); + /* + $request = $this->prophesize() + ->willExtend(\Symfony\Component\HttpFoundation\Request::class); - $request = $this->prophesize() - ->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); - $request->getLocale()->willReturn('fr'); - - self::$container->get('request_stack') - ->push($request->reveal()); + self::$container->get('request_stack') + ->push($request->reveal());*/ } public function getAggregator() @@ -65,7 +65,12 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest return [ $em->createQueryBuilder() ->select('count(activity.id)') - ->from(Activity::class, 'activity'), + ->from(Activity::class, 'activity') + ->join('activity.person', 'person'), + $em->createQueryBuilder() + ->select('count(activity.id)') + ->from(Activity::class, 'activity') + ->join('activity.accompanyingPeriod', 'accompanyingPeriod'), $em->createQueryBuilder() ->select('count(activity.id)') ->from(Activity::class, 'activity') diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index ef691ba0d..b52911295 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -153,7 +153,7 @@ services: ## Aggregators - Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator: + Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator: tags: - { name: chill.export_aggregator, alias: activity_reason_aggregator } From f1fa4d415e7bf2ad1dda42f3f53763bb263dd98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 7 Feb 2024 21:28:18 +0100 Subject: [PATCH 42/42] Fix messages+intl-icu.fr.yaml file, which was altered during multiple git merge --- .../translations/messages+intl-icu.fr.yaml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 95cfe5b8e..a268ac6c4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -140,23 +140,18 @@ exports: not_having_address_reference: describe: >- Uniquement les parcours qui ne sont pas localisés à une adresse de référence, à la date du {date_calc, date, medium} + by_referrer_between_dates: + description: >- + Filtré par référent du parcours, entre deux dates: depuis le {start_date, date, medium}, jusqu'au {end_date, date, medium}, seulement {agents} work: by_treating_agent: Filtered by treating agent at date: >- Les agents traitant au { agent_at, date, medium }, seulement {agents} - step_history: by_date: description: >- Changements de statuts filtrés par date: après le { start_date, date, medium } (inclus), avant le { end_date, date, medium } - - Les agents traitants au { agent_at, date, medium }, seulement {agents} - - by_referrer_between_dates: - description: >- - Filtré par référent du parcours, entre deux dates: depuis le {start_date, date, medium}, jusqu'au {end_date, date, medium}, seulement {agents} - 'total persons matching the search pattern': >- { total, plural, =0 {Aucun usager ne correspond aux termes de recherche}