From d8870e906f510db451be028b60939cad95e22875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 15 Apr 2023 00:54:21 +0200 Subject: [PATCH 001/750] DX: rector in docs directory --- docs/source/_static/code/exports/CountPerson.php | 15 +++------------ .../widgets/ChillMainConfiguration.php | 9 +-------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/docs/source/_static/code/exports/CountPerson.php b/docs/source/_static/code/exports/CountPerson.php index afe19c73b..a77ff1be5 100644 --- a/docs/source/_static/code/exports/CountPerson.php +++ b/docs/source/_static/code/exports/CountPerson.php @@ -50,18 +50,9 @@ class CountPerson implements ExportInterface public function getLabels($key, array $values, $data) { // the Closure which will be executed by the formatter. - return function ($value) { - switch ($value) { - case '_header': - // we have to process specifically the '_header' string, - // which will be used by the formatter to show a column title - return $this->getTitle(); - - default: - // for all value, we do not process them and return them - // immediatly - return $value; - } + return fn($value) => match ($value) { + '_header' => $this->getTitle(), + default => $value, }; } diff --git a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php index 9eca0ae76..b4567729c 100644 --- a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php +++ b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php @@ -23,19 +23,12 @@ class ChillMainConfiguration implements ConfigurationInterface { use AddWidgetConfigurationTrait; - /** - * @var ContainerBuilder - */ - private $containerBuilder; - public function __construct( array $widgetFactories, - ContainerBuilder $containerBuilder + private ContainerBuilder $containerBuilder ) { // we register here widget factories (see below) $this->setWidgetFactories($widgetFactories); - // we will need the container builder later... - $this->containerBuilder = $containerBuilder; } public function getConfigTreeBuilder() From dde300210021cda4c3748b1a9487681d78ea2328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 15 Apr 2023 01:05:37 +0200 Subject: [PATCH 002/750] DX: apply rector rules up to php8.0 --- .../Controller/ActivityController.php | 68 +----- .../ActivityReasonCategoryController.php | 12 +- .../Controller/ActivityReasonController.php | 17 +- .../DataFixtures/ORM/LoadActivity.php | 5 +- .../Entity/ActivityReason.php | 4 +- .../Entity/ActivityReasonCategory.php | 4 +- .../Entity/ActivityType.php | 4 +- .../EntityListener/ActivityEntityListener.php | 8 +- .../ACPAggregators/ByCreatorAggregator.php | 12 +- .../BySocialActionAggregator.php | 12 +- .../BySocialIssueAggregator.php | 12 +- .../ACPAggregators/ByThirdpartyAggregator.php | 12 +- .../ACPAggregators/CreatorScopeAggregator.php | 12 +- .../ACPAggregators/DateAggregator.php | 22 +- .../ACPAggregators/LocationTypeAggregator.php | 12 +- .../Aggregator/ActivityTypeAggregator.php | 12 +- .../Aggregator/ActivityUserAggregator.php | 12 +- .../Aggregator/ActivityUsersAggregator.php | 8 +- .../Aggregator/ActivityUsersJobAggregator.php | 8 +- .../ActivityUsersScopeAggregator.php | 8 +- .../ActivityReasonAggregator.php | 36 +-- .../Aggregator/SentReceivedAggregator.php | 5 +- .../Export/LinkedToACP/ListActivity.php | 41 +--- .../Export/LinkedToPerson/CountActivity.php | 8 +- .../Export/LinkedToPerson/ListActivity.php | 20 +- .../LinkedToPerson/StatActivityDuration.php | 16 +- .../Export/Export/ListActivityHelper.php | 200 ++++++---------- .../Filter/ACPFilters/ActivityTypeFilter.php | 12 +- .../Filter/ACPFilters/ByCreatorFilter.php | 5 +- .../ACPFilters/BySocialActionFilter.php | 5 +- .../Filter/ACPFilters/BySocialIssueFilter.php | 5 +- .../Filter/ACPFilters/EmergencyFilter.php | 5 +- .../Filter/ACPFilters/LocationTypeFilter.php | 5 +- .../Filter/ACPFilters/SentReceivedFilter.php | 5 +- .../Export/Filter/ACPFilters/UserFilter.php | 5 +- .../Filter/ACPFilters/UserScopeFilter.php | 5 +- .../Export/Filter/ActivityDateFilter.php | 12 +- .../Export/Filter/ActivityTypeFilter.php | 12 +- .../Export/Filter/ActivityUsersFilter.php | 5 +- .../PersonFilters/ActivityReasonFilter.php | 12 +- .../PersonHavingActivityBetweenDateFilter.php | 16 +- .../Export/Filter/UsersJobFilter.php | 5 +- .../Export/Filter/UsersScopeFilter.php | 12 +- .../ChillActivityBundle/Form/ActivityType.php | 30 +-- .../Form/ActivityTypeType.php | 5 +- .../Form/Type/PickActivityReasonType.php | 16 +- ...TranslatableActivityReasonCategoryType.php | 8 +- .../Form/Type/TranslatableActivityType.php | 12 +- .../Menu/AccompanyingCourseMenuBuilder.php | 12 +- .../Menu/AdminMenuBuilder.php | 5 +- .../Menu/PersonMenuBuilder.php | 18 +- .../ActivityNotificationHandler.php | 5 +- .../Repository/ActivityACLAwareRepository.php | 28 +-- .../Repository/ActivityReasonRepository.php | 6 +- .../Security/Authorization/ActivityVoter.php | 5 +- .../Service/DocGenerator/ActivityContext.php | 36 +-- ...tActivitiesByAccompanyingPeriodContext.php | 40 +--- .../Controller/ActivityControllerTest.php | 8 +- .../Type/TranslatableActivityTypeTest.php | 4 +- .../Timeline/TimelineActivityProvider.php | 16 +- .../Controller/AsideActivityController.php | 5 +- .../DataFixtures/ORM/LoadAsideActivity.php | 5 +- .../src/Entity/AsideActivityCategory.php | 4 +- .../Aggregator/ByActivityTypeAggregator.php | 8 +- .../Export/Aggregator/ByUserJobAggregator.php | 8 +- .../Aggregator/ByUserScopeAggregator.php | 8 +- .../Export/AvgAsideActivityDuration.php | 8 +- .../src/Export/Export/CountAsideActivity.php | 8 +- .../src/Export/Export/ListAsideActivity.php | 157 +++++-------- .../Export/SumAsideActivityDuration.php | 8 +- .../Export/Filter/ByActivityTypeFilter.php | 16 +- .../src/Export/Filter/ByDateFilter.php | 12 +- .../src/Export/Filter/ByUserFilter.php | 5 +- .../src/Export/Filter/ByUserJobFilter.php | 5 +- .../src/Export/Filter/ByUserScopeFilter.php | 12 +- .../src/Form/AsideActivityCategoryType.php | 8 +- .../Type/PickAsideActivityCategoryType.php | 8 +- .../src/Menu/AdminMenuBuilder.php | 5 +- .../src/Menu/SectionMenuBuilder.php | 8 +- .../src/Templating/Entity/CategoryRender.php | 8 +- .../Controller/AbstractElementController.php | 34 +-- .../Controller/ElementController.php | 16 +- .../ChillBudgetBundle/Form/ChargeType.php | 16 +- .../ChillBudgetBundle/Form/ResourceType.php | 16 +- .../Menu/AdminMenuBuilder.php | 5 +- .../Menu/HouseholdMenuBuilder.php | 12 +- .../Menu/PersonMenuBuilder.php | 12 +- .../Service/Summary/SummaryBudget.php | 20 +- .../Templating/BudgetElementTypeRender.php | 8 +- .../Service/Summary/SummaryBudgetTest.php | 4 +- .../AzureGrantAdminConsentAndAcquireToken.php | 12 +- .../MapAndSubscribeUserCalendarCommand.php | 26 +-- .../SendShortMessageOnEligibleCalendar.php | 6 +- .../SendTestShortMessageOnCalendarCommand.php | 31 +-- .../Controller/CalendarAPIController.php | 5 +- .../Controller/CalendarController.php | 52 +---- .../Controller/CalendarDocController.php | 28 +-- .../Controller/CalendarRangeAPIController.php | 5 +- .../Controller/InviteApiController.php | 11 +- .../RemoteCalendarConnectAzureController.php | 12 +- .../RemoteCalendarMSGraphSyncController.php | 5 +- .../RemoteCalendarProxyController.php | 11 +- .../DataFixtures/ORM/LoadCalendarRange.php | 8 +- .../ChillCalendarBundle/Entity/Calendar.php | 15 +- .../Entity/CalendarDoc.php | 14 +- .../Event/ListenToActivityCreate.php | 5 +- .../Export/Aggregator/AgentAggregator.php | 12 +- .../Aggregator/CancelReasonAggregator.php | 12 +- .../Export/Aggregator/JobAggregator.php | 12 +- .../Export/Aggregator/LocationAggregator.php | 8 +- .../Aggregator/LocationTypeAggregator.php | 12 +- .../Export/Aggregator/ScopeAggregator.php | 12 +- .../Export/Aggregator/UrgencyAggregator.php | 23 +- .../Export/Export/CountCalendars.php | 5 +- .../Export/Export/StatCalendarAvgDuration.php | 8 +- .../Export/Export/StatCalendarSumDuration.php | 8 +- .../Export/Filter/AgentFilter.php | 5 +- .../Export/Filter/BetweenDatesFilter.php | 5 +- .../Export/Filter/CalendarRangeFilter.php | 5 +- .../Export/Filter/JobFilter.php | 12 +- .../Export/Filter/ScopeFilter.php | 12 +- .../ChillCalendarBundle/Form/CalendarType.php | 28 +-- .../Menu/AccompanyingCourseMenuBuilder.php | 12 +- .../Menu/PersonMenuBuilder.php | 12 +- .../Menu/UserMenuBuilder.php | 12 +- .../Doctrine/CalendarEntityListener.php | 8 +- .../Doctrine/CalendarRangeEntityListener.php | 8 +- .../CalendarRangeRemoveToRemoteHandler.php | 8 +- .../Handler/CalendarRangeToRemoteHandler.php | 16 +- .../Handler/CalendarRemoveHandler.php | 11 +- .../Handler/CalendarToRemoteHandler.php | 28 +-- .../Messenger/Handler/InviteUpdateHandler.php | 11 +- .../MSGraphChangeNotificationHandler.php | 36 +-- .../Messenger/Message/CalendarMessage.php | 5 +- .../Message/CalendarRangeMessage.php | 5 +- .../MSGraphChangeNotificationMessage.php | 8 +- .../Connector/MSGraph/AddressConverter.php | 8 +- .../EventsOnUserSubscriptionCreator.php | 20 +- .../Connector/MSGraph/LocationConverter.php | 5 +- .../MSGraph/MSGraphUserRepository.php | 5 +- .../Connector/MSGraph/MachineHttpClient.php | 5 +- .../Connector/MSGraph/MachineTokenStorage.php | 8 +- .../Connector/MSGraph/MapCalendarToUser.php | 12 +- .../MSGraph/OnBehalfOfUserHttpClient.php | 5 +- .../MSGraph/OnBehalfOfUserTokenStorage.php | 8 +- .../MSGraph/RemoteEventConverter.php | 25 +- .../RemoteToLocalSync/CalendarRangeSyncer.php | 16 +- .../RemoteToLocalSync/CalendarSyncer.php | 65 ++---- .../MSGraphRemoteCalendarConnector.php | 50 +--- .../RemoteCalendar/Model/RemoteEvent.php | 58 ++--- .../Repository/CalendarACLAwareRepository.php | 12 +- .../Repository/CalendarRangeRepository.php | 7 +- .../Security/Voter/CalendarDocVoter.php | 20 +- .../Security/Voter/CalendarVoter.php | 5 +- .../Service/DocGenerator/CalendarContext.php | 36 +-- .../BulkCalendarShortMessageSender.php | 17 +- .../CalendarForShortMessageProvider.php | 16 +- .../DefaultShortMessageForCalendarBuilder.php | 8 +- .../Command/CreateFieldsOnGroupCommand.php | 34 +-- .../Controller/CustomFieldController.php | 18 +- .../CustomFieldsGroupController.php | 30 +-- .../CustomFields/CustomFieldChoice.php | 26 +-- .../CustomFields/CustomFieldDate.php | 16 +- .../CustomFields/CustomFieldLongChoice.php | 18 +- .../CustomFields/CustomFieldNumber.php | 14 +- .../CustomFields/CustomFieldText.php | 24 +- .../CustomFields/CustomFieldTitle.php | 24 +- .../OptionRepository.php | 4 +- .../Form/CustomFieldType.php | 25 +- .../Form/CustomFieldsGroupType.php | 16 +- .../CustomFieldDataTransformer.php | 15 +- .../CustomFieldsGroupToIdTransformer.php | 12 +- .../JsonCustomFieldToArrayTransformer.php | 14 +- .../Form/Type/CustomFieldType.php | 8 +- .../Form/Type/LinkedCustomFieldsType.php | 8 +- .../Service/CustomFieldsHelper.php | 17 +- .../Twig/CustomFieldRenderingTwig.php | 8 +- .../CustomFields/CustomFieldsChoiceTest.php | 6 +- .../CustomFieldsGroupRenderingTwigTest.php | 4 +- .../Context/ContextManager.php | 7 +- .../Exception/UnexpectedTypeException.php | 2 +- .../AdminDocGeneratorTemplateController.php | 5 +- .../DocGeneratorTemplateController.php | 28 +-- .../Form/DocGeneratorTemplateType.php | 5 +- .../Exception/TemplateException.php | 5 +- .../GeneratorDriver/RelatorioDriver.php | 10 +- .../Menu/AdminMenuBuilder.php | 8 +- .../DocGeneratorTemplateRepository.php | 5 +- .../Helper/NormalizeNullValueHelper.php | 39 +--- .../Normalizer/DocGenObjectNormalizer.php | 17 +- .../Service/Context/BaseContextData.php | 5 +- .../Service/Generator/Generator.php | 24 +- .../Service/Generator/GeneratorException.php | 10 +- .../Service/Messenger/OnGenerationFails.php | 43 +--- .../Messenger/RequestGenerationHandler.php | 28 +-- .../Messenger/RequestGenerationMessage.php | 10 +- .../Serializer/Encoder/DocGenEncoderTest.php | 5 +- .../DocumentAccompanyingCourseController.php | 24 +- .../Controller/DocumentCategoryController.php | 15 +- .../Controller/DocumentPersonController.php | 24 +- .../Controller/StoredObjectApiController.php | 5 +- .../Entity/DocumentCategory.php | 40 ++-- .../Entity/StoredObject.php | 15 +- .../Form/DocumentCategoryType.php | 2 +- .../Form/PersonDocumentType.php | 20 +- .../ChillDocStoreBundle/Menu/MenuBuilder.php | 31 +-- .../AccompanyingCourseDocumentRepository.php | 5 +- .../Repository/DocumentCategoryRepository.php | 5 +- .../PersonDocumentACLAwareRepository.php | 14 +- .../AccompanyingCourseDocumentVoter.php | 10 +- .../Authorization/PersonDocumentVoter.php | 10 +- .../Normalizer/StoredObjectDenormalizer.php | 5 +- .../Service/StoredObjectManager.php | 12 +- .../WopiEditTwigExtensionRuntime.php | 8 +- ...ompanyingCourseDocumentWorkflowHandler.php | 5 +- .../Controller/EventController.php | 8 +- .../Controller/EventTypeController.php | 18 +- .../Controller/ParticipationController.php | 24 +- .../Controller/RoleController.php | 18 +- .../Controller/StatusController.php | 18 +- src/Bundle/ChillEventBundle/Entity/Event.php | 4 +- .../ChillEventBundle/Entity/Participation.php | 43 +--- .../Form/Type/PickEventType.php | 5 +- .../ChillEventBundle/Search/EventSearch.php | 32 +-- .../ParticipationControllerTest.php | 4 +- .../Config/ConfigRepository.php | 13 +- .../Controller/FamilyMemberController.php | 15 +- .../Form/FamilyMemberType.php | 18 +- .../Controller/AbstractCRUDController.php | 37 +-- .../CRUD/Controller/ApiController.php | 128 ++++------- .../CRUD/Controller/CRUDController.php | 109 +++------ .../CRUD/Routing/CRUDRoutesLoader.php | 31 +-- .../Command/ChillImportUsersCommand.php | 26 +-- .../ChillUserSendRenewPasswordCodeCommand.php | 4 +- .../Command/ExecuteCronJobCommand.php | 6 +- .../LoadAddressesBEFromBestAddressCommand.php | 10 +- .../LoadAddressesFRFromBANOCommand.php | 5 +- .../Command/LoadAndUpdateLanguagesCommand.php | 11 +- .../Command/LoadCountriesCommand.php | 11 +- .../Command/LoadPostalCodeFR.php | 6 +- .../Command/LoadPostalCodesCommand.php | 8 +- .../Command/SetPasswordCommand.php | 8 +- .../AddressReferenceAPIController.php | 8 +- .../AddressToReferenceMatcherController.php | 16 +- .../Controller/CenterController.php | 12 +- .../Controller/ExportController.php | 90 ++------ ...GeographicalUnitByAddressApiController.php | 26 +-- .../Controller/NotificationApiController.php | 43 +--- .../Controller/NotificationController.php | 42 +--- .../Controller/PasswordController.php | 4 +- .../Controller/PermissionApiController.php | 12 +- .../Controller/PermissionsGroupController.php | 53 +---- .../Controller/PostalCodeAPIController.php | 16 +- .../Controller/SavedExportController.php | 40 +--- .../Controller/ScopeController.php | 12 +- .../Controller/SearchController.php | 22 +- .../Controller/TimelineCenterController.php | 16 +- .../Controller/UserApiController.php | 8 +- .../Controller/UserController.php | 37 +-- .../Controller/WorkflowApiController.php | 77 ++----- .../Controller/WorkflowController.php | 26 +-- .../ChillMainBundle/Cron/CronManager.php | 25 +- .../ChillMainExtension.php | 5 +- .../CompilerPass/ACLFlagsCompilerPass.php | 25 +- .../DependencyInjection/Configuration.php | 5 +- .../Widget/AbstractWidgetsCompilerPass.php | 12 +- .../Doctrine/DQL/OverlapsI.php | 19 +- .../Event/TrackCreateUpdateSubscriber.php | 5 +- .../ChillMainBundle/Doctrine/Model/Point.php | 8 +- .../Doctrine/Type/NativeDateIntervalType.php | 28 +-- .../Doctrine/Type/PointType.php | 4 +- src/Bundle/ChillMainBundle/Entity/Address.php | 5 - src/Bundle/ChillMainBundle/Entity/Center.php | 6 +- .../ChillMainBundle/Entity/Civility.php | 3 - .../Entity/CronJobExecution.php | 15 +- .../SimpleGeographicalUnitDTO.php | 60 +++-- .../Entity/PermissionsGroup.php | 2 +- src/Bundle/ChillMainBundle/Entity/User.php | 8 +- .../Entity/Workflow/EntityWorkflow.php | 6 +- .../Entity/Workflow/EntityWorkflowStep.php | 8 +- .../ChillMainBundle/Export/ExportManager.php | 38 +--- .../Export/Formatter/CSVFormatter.php | 5 +- .../Export/Formatter/SpreadSheetFormatter.php | 30 +-- .../Export/Helper/DateTimeHelper.php | 5 +- .../Export/Helper/ExportAddressHelper.php | 35 +-- .../TranslatableStringExportLabelHelper.php | 5 +- .../Export/Helper/UserHelper.php | 8 +- .../DataMapper/PrivateCommentDataMapper.php | 5 +- .../Form/DataMapper/ScopePickerDataMapper.php | 8 +- .../IdToEntityDataTransformer.php | 8 +- .../Form/Event/CustomizeFormEvent.php | 8 +- .../ChillMainBundle/Form/LocationFormType.php | 5 +- .../Form/Type/ComposedRoleScopeType.php | 8 +- .../AddressToIdDataTransformer.php | 5 +- .../DataTransformer/CenterTransformer.php | 12 +- .../EntityToJsonTransformer.php | 39 +--- .../MultipleObjectsToIdTransformer.php | 8 +- .../DataTransformer/ObjectToIdTransformer.php | 12 +- .../PostalCodeToIdTransformer.php | 5 +- .../Type/DataTransformer/ScopeTransformer.php | 5 +- .../Form/Type/Export/PickCenterType.php | 15 +- .../Form/Type/Listing/FilterOrderType.php | 5 +- .../Form/Type/PickAddressType.php | 12 +- .../Form/Type/PickCenterType.php | 16 +- .../Form/Type/PickCivilityType.php | 5 +- .../Form/Type/PickLocationTypeType.php | 5 +- .../Form/Type/PickPostalCodeType.php | 5 +- .../Form/Type/PickUserDynamicType.php | 11 +- .../Form/Type/PickUserLocationType.php | 8 +- .../Form/Type/PrivateCommentType.php | 5 +- .../Form/Type/ScopePickerType.php | 16 +- .../Form/Type/Select2CountryType.php | 20 +- .../Form/Type/Select2LanguageType.php | 20 +- .../Form/Type/TranslatableStringFormType.php | 5 +- .../Form/Type/UserPickerType.php | 15 +- src/Bundle/ChillMainBundle/Form/UserType.php | 12 +- .../ChillMainBundle/Form/WorkflowStepType.php | 11 +- .../Counter/NotificationByUserCounter.php | 8 +- .../Notification/Email/NotificationMailer.php | 11 +- ...NotificationOnTerminateEventSubscriber.php | 8 +- .../ChillMainBundle/Notification/Mailer.php | 15 +- .../NotificationHandlerManager.php | 12 +- .../Notification/NotificationPresence.php | 8 +- .../NotificationTwigExtensionRuntime.php | 11 +- .../Pagination/ChillPaginationTwig.php | 19 +- .../ChillMainBundle/Pagination/Page.php | 65 ++---- .../Pagination/PageGenerator.php | 5 +- .../ChillMainBundle/Pagination/Paginator.php | 105 +++------ .../Pagination/PaginatorFactory.php | 42 ++-- .../Phonenumber/PhonenumberHelper.php | 26 +-- .../Phonenumber/Templating.php | 5 +- .../Repository/NotificationRepository.php | 7 +- .../Repository/UserACLAwareRepository.php | 8 +- .../Repository/UserRepository.php | 7 +- .../Routing/Loader/ChillRoutesLoader.php | 6 +- .../MenuBuilder/AdminUserMenuBuilder.php | 5 +- .../MenuBuilder/SectionMenuBuilder.php | 11 +- .../Routing/MenuBuilder/UserMenuBuilder.php | 28 +-- .../ChillMainBundle/Routing/MenuComposer.php | 16 +- .../ChillMainBundle/Routing/MenuTwig.php | 8 +- .../ChillMainBundle/Search/AbstractSearch.php | 2 +- .../Search/Entity/SearchUserApiProvider.php | 5 +- .../ChillMainBundle/Search/Model/Result.php | 18 +- .../ChillMainBundle/Search/SearchApi.php | 16 +- .../Search/SearchApiNoQueryException.php | 5 +- .../Search/SearchApiResult.php | 5 +- .../ChillMainBundle/Search/SearchProvider.php | 4 +- .../Search/Utils/SearchExtractionResult.php | 8 +- .../Authorization/AuthorizationHelper.php | 41 +--- .../AuthorizationHelperForCurrentUser.php | 8 +- .../Authorization/DefaultVoterHelper.php | 16 +- .../DefaultVoterHelperFactory.php | 12 +- .../DefaultVoterHelperGenerator.php | 12 +- .../Authorization/EntityWorkflowVoter.php | 8 +- .../Authorization/NotificationVoter.php | 43 ++-- .../Authorization/SavedExportVoter.php | 14 +- .../WorkflowEntityDeletionVoter.php | 10 +- .../Security/ParentRoleHelper.php | 5 +- .../PasswordRecover/PasswordRecoverEvent.php | 19 +- .../PasswordRecover/PasswordRecoverLocker.php | 75 ++---- .../Security/PasswordRecover/TokenManager.php | 7 +- .../Resolver/CenterResolverDispatcher.php | 7 +- .../Resolver/CenterResolverManager.php | 9 +- .../Resolver/ResolverTwigExtension.php | 14 +- .../Resolver/ScopeResolverDispatcher.php | 9 +- .../ChillMainBundle/Security/RoleProvider.php | 2 - .../Security/UserProvider/UserProvider.php | 5 +- .../Serializer/Model/Collection.php | 8 +- .../Serializer/Model/Counter.php | 5 +- .../Normalizer/AddressNormalizer.php | 5 +- .../Normalizer/CenterNormalizer.php | 5 +- .../CommentEmbeddableDocGenNormalizer.php | 5 +- .../Serializer/Normalizer/DateNormalizer.php | 8 +- .../DoctrineExistingEntityNormalizer.php | 8 +- .../Normalizer/EntityWorkflowNormalizer.php | 16 +- .../EntityWorkflowStepNormalizer.php | 5 +- .../Normalizer/NotificationNormalizer.php | 11 +- .../PrivateCommentEmbeddableNormalizer.php | 5 +- .../Serializer/Normalizer/UserNormalizer.php | 5 +- ...eographicalUnitMaterializedViewCronJob.php | 5 +- .../AddressReferenceBEFromBestAddress.php | 16 +- .../Import/AddressReferenceBaseImporter.php | 8 +- .../Import/AddressReferenceFromBano.php | 11 +- .../Import/AddressToReferenceMatcher.php | 8 +- .../Import/GeographicalUnitBaseImporter.php | 8 +- .../Import/PostalCodeBEFromBestAddress.php | 11 +- .../Service/Import/PostalCodeBaseImporter.php | 8 +- .../Import/PostalCodeFRFromOpenData.php | 18 +- .../Service/Mailer/ChillMailer.php | 8 +- .../Service/RollingDate/RollingDate.php | 8 +- .../RollingDate/RollingDateConverter.php | 39 +--- .../Service/ShortMessage/ShortMessage.php | 11 +- .../ShortMessage/ShortMessageHandler.php | 5 +- .../ShortMessage/ShortMessageTransporter.php | 8 +- .../ShortMessageOvh/OvhShortMessageSender.php | 28 +-- .../Templating/ChillTwigHelper.php | 28 +-- .../Templating/Entity/AddressRender.php | 12 +- .../Templating/Entity/CommentRender.php | 14 +- .../Templating/Entity/UserRender.php | 11 +- .../Templating/Listing/FilterOrderHelper.php | 12 +- .../Listing/FilterOrderHelperBuilder.php | 12 +- .../Listing/FilterOrderHelperFactory.php | 12 +- .../Templating/TranslatableStringHelper.php | 8 +- .../Templating/TranslatableStringTwig.php | 8 +- .../Templating/Widget/WidgetRenderingTwig.php | 2 +- .../Test/Export/AbstractExportTest.php | 4 +- .../Test/Export/AbstractFilterTest.php | 2 +- .../Controller/UserApiControllerTest.php | 4 +- .../Tests/Controller/UserControllerTest.php | 4 +- .../Tests/Cron/CronManagerTest.php | 5 +- .../Tests/Export/ExportManagerTest.php | 16 +- .../Tests/Pagination/PageTest.php | 6 +- .../Tests/Pagination/PaginatorTest.php | 9 +- .../ExtractPhonenumberFromPatternTest.php | 8 +- .../Authorization/AuthorizationHelperTest.php | 6 +- .../Normalizer/DateNormalizerTest.php | 8 +- .../DoctrineExistingEntityNormalizerTest.php | 4 +- .../Normalizer/PhonenumberNormalizerTest.php | 6 +- .../ChillMainBundle/Tests/TestHelper.php | 6 +- .../Timeline/TimelineBuilder.php | 12 +- .../Timeline/TimelineSingleQuery.php | 28 +-- .../Util/DateRangeCovering.php | 5 +- .../Validator/RoleScopeScopePresence.php | 25 +- .../Validation/Validator/ValidPhonenumber.php | 12 +- .../Counter/WorkflowByUserCounter.php | 8 +- .../Workflow/EntityWorkflowManager.php | 10 +- ...ntityWorkflowTransitionEventSubscriber.php | 16 +- .../NotificationOnTransition.php | 24 +- .../SendAccessKeyEventSubscriber.php | 17 +- .../Workflow/Helper/MetadataExtractor.php | 8 +- .../WorkflowNotificationHandler.php | 16 +- .../WorkflowTwigExtensionRuntime.php | 24 +- .../EntityWorkflowCreationValidator.php | 8 +- .../Validator/StepDestValidValidator.php | 1 - .../migrations/Version20180703191509.php | 2 +- .../PersonAddressMoveEventSubscriber.php | 20 +- .../Events/UserRefEventSubscriber.php | 14 +- .../ChillPersonBundle/Actions/ActionEvent.php | 49 ++-- .../Controller/EntityPersonCRUDController.php | 66 ++---- .../OneToOneEntityPersonCRUDController.php | 23 +- .../Command/ChillPersonMoveCommand.php | 16 +- .../Command/ImportSocialWorkMetadata.php | 9 +- ...emoveOldDraftAccompanyingPeriodCommand.php | 9 +- .../Config/ConfigPersonAltNamesHelper.php | 15 +- .../AccompanyingCourseApiController.php | 51 +---- .../AccompanyingCourseCommentController.php | 16 +- .../AccompanyingCourseController.php | 28 +-- .../AccompanyingCourseWorkApiController.php | 5 +- .../AccompanyingCourseWorkController.php | 24 +- .../AccompanyingPeriodController.php | 5 +- ...mpanyingPeriodRegulationListController.php | 20 +- ...nyingPeriodWorkEvaluationApiController.php | 24 +- .../Controller/HouseholdApiController.php | 16 +- .../HouseholdCompositionController.php | 45 +--- .../HouseholdCompositionTypeApiController.php | 13 +- .../Controller/HouseholdController.php | 20 +- .../Controller/HouseholdMemberController.php | 20 +- .../Controller/PersonAddressController.php | 2 - .../Controller/PersonApiController.php | 10 +- .../Controller/PersonController.php | 75 ++---- .../Controller/PersonDuplicateController.php | 43 +--- .../Controller/PersonResourceController.php | 20 +- .../ReassignAccompanyingPeriodController.php | 40 +--- .../Controller/RelationshipApiController.php | 8 +- .../ResidentialAddressController.php | 16 +- .../SocialWorkEvaluationApiController.php | 5 +- .../SocialWorkGoalApiController.php | 8 +- .../SocialWorkResultApiController.php | 5 +- .../SocialWorkSocialActionApiController.php | 8 +- .../Controller/TimelinePersonController.php | 16 +- .../UserAccompanyingPeriodController.php | 8 +- .../ORM/LoadAccompanyingPeriodWork.php | 12 +- .../DataFixtures/ORM/LoadCustomFields.php | 18 +- .../DataFixtures/ORM/LoadHousehold.php | 8 +- .../DataFixtures/ORM/LoadPeople.php | 35 +-- .../DataFixtures/ORM/LoadRelationships.php | 5 +- .../ORM/LoadSocialWorkMetadata.php | 5 +- .../ChillPersonExtension.php | 15 +- .../DependencyInjection/Configuration.php | 17 +- .../Entity/AccompanyingPeriod.php | 10 +- .../AccompanyingPeriodWorkEvaluation.php | 4 +- ...companyingPeriodWorkEvaluationDocument.php | 4 +- .../Entity/AccompanyingPeriod/Resource.php | 3 +- .../Entity/AccompanyingPeriod/UserHistory.php | 21 +- .../AccompanyingPeriodParticipation.php | 28 +-- .../Entity/MaritalStatus.php | 4 - .../ChillPersonBundle/Entity/Person.php | 45 ++-- .../Entity/Person/PersonCenterHistory.php | 34 ++- .../Entity/Person/PersonResource.php | 4 +- .../Entity/SocialWork/SocialAction.php | 4 +- .../Entity/SocialWork/SocialIssue.php | 3 +- .../Event/Person/PersonAddressMoveEvent.php | 8 +- .../AccompanyingPeriodWorkEventListener.php | 5 +- .../AdministrativeLocationAggregator.php | 12 +- .../ClosingMotiveAggregator.php | 12 +- .../ConfidentialAggregator.php | 23 +- .../CreatorJobAggregator.php | 12 +- .../DurationAggregator.php | 32 +-- .../EmergencyAggregator.php | 23 +- .../EvaluationAggregator.php | 12 +- .../GeographicalUnitStatAggregator.php | 63 ++---- .../IntensityAggregator.php | 23 +- .../OriginAggregator.php | 5 +- .../ReferrerAggregator.php | 16 +- .../ReferrerScopeAggregator.php | 16 +- .../RequestorAggregator.php | 8 +- .../ScopeAggregator.php | 12 +- .../SocialActionAggregator.php | 12 +- .../SocialIssueAggregator.php | 12 +- .../StepAggregator.php | 12 +- .../UserJobAggregator.php | 12 +- .../ByEndDateAggregator.php | 25 +- .../ByMaxDateAggregator.php | 25 +- .../ByStartDateAggregator.php | 25 +- .../EvaluationTypeAggregator.php | 12 +- .../HavingEndDateAggregator.php | 20 +- .../ChildrenNumberAggregator.php | 12 +- .../CompositionAggregator.php | 16 +- .../PersonAggregators/AgeAggregator.php | 5 +- .../ByHouseholdCompositionAggregator.php | 16 +- .../CountryOfBirthAggregator.php | 16 +- .../PersonAggregators/GenderAggregator.php | 5 +- .../GeographicalUnitAggregator.php | 63 ++---- .../HouseholdPositionAggregator.php | 20 +- .../MaritalStatusAggregator.php | 8 +- .../NationalityAggregator.php | 16 +- .../ActionTypeAggregator.php | 67 ++---- .../CurrentActionAggregator.php | 20 +- .../SocialWorkAggregators/GoalAggregator.php | 8 +- .../GoalResultAggregator.php | 16 +- .../SocialWorkAggregators/JobAggregator.php | 12 +- .../ReferrerAggregator.php | 12 +- .../ResultAggregator.php | 8 +- .../SocialWorkAggregators/ScopeAggregator.php | 12 +- .../Export/CountAccompanyingPeriodWork.php | 8 +- .../Export/Export/CountEvaluation.php | 8 +- .../Export/Export/CountHousehold.php | 27 +-- .../Export/Export/CountPerson.php | 8 +- .../Export/Export/ListAccompanyingPeriod.php | 213 ++++++------------ .../Export/ListAccompanyingPeriodWork.php | 172 ++++---------- .../Export/Export/ListEvaluation.php | 157 ++++--------- .../Export/Export/ListHouseholdInPeriod.php | 53 ++--- .../Export/Export/ListPerson.php | 34 +-- .../Export/Export/ListPersonDuplicate.php | 16 +- .../ListPersonWithAccompanyingPeriod.php | 22 +- .../Export/StatAccompanyingCourseDuration.php | 23 +- .../ActiveOnDateFilter.php | 5 +- .../ActiveOneDayBetweenDatesFilter.php | 5 +- .../AdministrativeLocationFilter.php | 8 +- .../ClosingMotiveFilter.php | 8 +- .../ConfidentialFilter.php | 5 +- .../CreatorJobFilter.php | 12 +- .../EmergencyFilter.php | 5 +- .../EvaluationFilter.php | 12 +- .../GeographicalUnitStatFilter.php | 20 +- .../HasNoReferrerFilter.php | 8 +- .../HasTemporaryLocationFilter.php | 57 ++--- .../IntensityFilter.php | 5 +- .../OpenBetweenDatesFilter.php | 5 +- .../OriginFilter.php | 8 +- .../ReferrerFilter.php | 8 +- .../RequestorFilter.php | 12 +- .../SocialActionFilter.php | 12 +- .../SocialIssueFilter.php | 5 +- .../AccompanyingCourseFilters/StepFilter.php | 15 +- .../UserJobFilter.php | 16 +- .../UserScopeFilter.php | 20 +- .../EvaluationFilters/ByEndDateFilter.php | 5 +- .../EvaluationFilters/ByStartDateFilter.php | 5 +- .../EvaluationTypeFilter.php | 8 +- .../EvaluationFilters/MaxDateFilter.php | 5 +- .../HouseholdFilters/CompositionFilter.php | 12 +- .../PersonFilters/AddressRefStatusFilter.php | 9 +- .../Export/Filter/PersonFilters/AgeFilter.php | 5 +- .../Filter/PersonFilters/BirthdateFilter.php | 5 +- .../ByHouseholdCompositionFilter.php | 16 +- .../PersonFilters/DeadOrAliveFilter.php | 8 +- .../Filter/PersonFilters/DeathdateFilter.php | 8 +- .../PersonFilters/GeographicalUnitFilter.php | 20 +- .../PersonFilters/MaritalStatusFilter.php | 8 +- .../PersonFilters/NationalityFilter.php | 8 +- .../ResidentialAddressAtThirdpartyFilter.php | 12 +- .../ResidentialAddressAtUserFilter.php | 8 +- .../WithoutHouseholdComposition.php | 8 +- .../Filter/SocialWorkFilters/JobFilter.php | 12 +- .../Filter/SocialWorkFilters/ScopeFilter.php | 12 +- .../SocialWorkTypeFilter.php | 16 +- .../Export/Helper/LabelPersonHelper.php | 8 +- .../Export/Helper/ListPersonHelper.php | 42 +--- .../Form/ChoiceLoader/PersonChoiceLoader.php | 6 +- .../Form/CreationPersonType.php | 10 +- .../Form/HouseholdCompositionType.php | 8 +- .../Form/PersonResourceType.php | 14 +- .../ChillPersonBundle/Form/PersonType.php | 10 +- .../Form/SocialWork/SocialIssueType.php | 8 +- .../Form/Type/ClosingMotivePickerType.php | 5 +- .../Form/Type/PersonAltNameType.php | 18 +- .../Form/Type/PersonPhoneType.php | 8 +- .../Form/Type/PickPersonDynamicType.php | 16 +- .../Form/Type/PickSocialActionType.php | 12 +- .../Form/Type/PickSocialIssueType.php | 12 +- .../Form/Type/Select2MaritalStatusType.php | 8 +- .../Household/MembersEditor.php | 11 +- .../Household/MembersEditorFactory.php | 12 +- .../Menu/AccompanyingCourseMenuBuilder.php | 8 +- .../Menu/PersonMenuBuilder.php | 16 +- .../Menu/SectionMenuBuilder.php | 11 +- .../AccompanyingPeriodNotificationHandler.php | 5 +- .../AccompanyingPeriodPrivacyEvent.php | 8 +- .../Privacy/PrivacyEvent.php | 14 +- .../AccompanyingPeriodWorkRepository.php | 7 +- .../ClosingMotiveRepository.php | 5 +- .../AccompanyingPeriodACLAwareRepository.php | 20 +- .../Household/HouseholdACLAwareRepository.php | 11 +- .../Repository/PersonACLAwareRepository.php | 20 +- .../ChillPersonBundle/Search/PersonSearch.php | 26 +-- .../Search/SearchHouseholdApiProvider.php | 28 +-- .../Search/SearchPersonApiProvider.php | 28 +-- .../Search/SimilarPersonMatcher.php | 10 +- .../AccompanyingPeriodCommentVoter.php | 21 +- .../AccompanyingPeriodResourceVoter.php | 25 +- .../Authorization/AccompanyingPeriodVoter.php | 5 +- ...nyingPeriodWorkEvaluationDocumentVoter.php | 24 +- .../AccompanyingPeriodWorkEvaluationVoter.php | 20 +- .../AccompanyingPeriodWorkVoter.php | 45 ++-- .../Security/Authorization/HouseholdVoter.php | 24 +- .../AuthorizedCenterOnPersonCreation.php | 5 +- .../AccompanyingPeriodDocGenNormalizer.php | 24 +- .../AccompanyingPeriodResourceNormalizer.php | 5 +- .../AccompanyingPeriodWorkDenormalizer.php | 12 +- ...PeriodWorkEvaluationDocumentNormalizer.php | 11 +- ...mpanyingPeriodWorkEvaluationNormalizer.php | 11 +- .../AccompanyingPeriodWorkNormalizer.php | 15 +- .../Normalizer/MembersEditorNormalizer.php | 5 +- .../Normalizer/PersonDocGenNormalizer.php | 26 +-- .../Normalizer/PersonJsonNormalizer.php | 26 +-- .../RelationshipDocGenNormalizer.php | 5 +- .../Normalizer/SocialActionNormalizer.php | 5 +- .../Normalizer/SocialIssueNormalizer.php | 5 +- .../Normalizer/WorkflowNormalizer.php | 8 +- .../OldDraftAccompanyingPeriodRemover.php | 8 +- .../AccompanyingPeriodContext.php | 36 +-- .../AccompanyingPeriodWorkContext.php | 12 +- ...ccompanyingPeriodWorkEvaluationContext.php | 24 +- .../Service/DocGenerator/PersonContext.php | 50 +--- .../PersonContextWithThirdParty.php | 16 +- .../Service/Import/SocialWorkMetadata.php | 28 +-- .../Templating/Entity/ClosingMotiveRender.php | 8 +- .../Templating/Entity/PersonRender.php | 15 +- .../Templating/Entity/ResourceKindRender.php | 5 +- .../Templating/Entity/SocialActionRender.php | 16 +- .../Templating/Entity/SocialIssueRender.php | 16 +- ...cialIssueConsistencyEntityListenerTest.php | 8 +- .../AccompanyingCourseApiControllerTest.php | 15 +- .../AccompanyingCourseControllerTest.php | 5 +- .../Controller/HouseholdControllerTest.php | 16 +- .../HouseholdMemberControllerTest.php | 22 +- .../Controller/PersonApiControllerTest.php | 16 +- .../Controller/PersonControllerCreateTest.php | 2 +- .../RelationshipApiControllerTest.php | 11 +- .../EventListener/PersonCreateEventTest.php | 12 +- .../Tests/Search/PersonSearchTest.php | 4 +- .../Normalizer/PersonDocGenNormalizerTest.php | 14 +- .../TimelineAccompanyingPeriodTest.php | 4 +- .../Household/MaxHolderValidatorTest.php | 4 +- .../AbstractTimelineAccompanyingPeriod.php | 15 +- .../AccompanyingPeriodValidityValidator.php | 11 +- .../LocationValidityValidator.php | 5 +- .../ParticipationOverlapValidator.php | 8 +- .../ResourceDuplicateCheckValidator.php | 8 +- ...HouseholdMembershipSequentialValidator.php | 5 +- .../Constraints/Person/BirthdateValidator.php | 7 +- .../Person/PersonHasCenterValidator.php | 5 +- .../RelationshipNoDuplicateValidator.php | 5 +- .../Widget/PersonListWidget.php | 20 +- ...dWorkEvaluationDocumentWorkflowHandler.php | 16 +- ...ingPeriodWorkEvaluationWorkflowHandler.php | 16 +- .../AccompanyingPeriodWorkWorkflowHandler.php | 16 +- .../Controller/ReportController.php | 5 +- .../DataFixtures/ORM/LoadReports.php | 2 +- .../Export/Export/ReportList.php | 71 ++---- .../Export/Filter/ReportDateFilter.php | 8 +- .../ChillReportBundle/Search/ReportSearch.php | 17 +- .../Tests/Search/ReportSearchTest.php | 4 +- .../Timeline/TimelineReportProvider.php | 39 +--- .../Controller/SingleTaskController.php | 73 ++---- .../ChillTaskBundle/Event/UI/UIEvent.php | 16 +- .../Form/SingleTaskListType.php | 3 +- .../ChillTaskBundle/Form/SingleTaskType.php | 16 +- .../ChillTaskBundle/Menu/MenuBuilder.php | 25 +- .../SingleTaskAclAwareRepository.php | 22 +- .../Authorization/AuthorizationEvent.php | 20 +- .../Security/Authorization/TaskVoter.php | 16 +- .../Controller/SingleTaskControllerTest.php | 4 +- .../TaskLifeCycleEventTimelineProvider.php | 39 +--- .../Controller/ThirdPartyController.php | 25 +- .../Entity/ThirdParty.php | 29 +-- .../Export/Helper/LabelThirdPartyHelper.php | 8 +- .../Form/ThirdPartyType.php | 25 +- .../Type/PickThirdPartyTypeCategoryType.php | 20 +- .../Form/Type/PickThirdpartyDynamicType.php | 11 +- .../ThirdPartyACLAwareRepository.php | 11 +- .../Search/ThirdPartyApiSearch.php | 5 +- .../Search/ThirdPartySearch.php | 5 +- .../Normalizer/ThirdPartyNormalizer.php | 12 +- .../Templating/Entity/ThirdPartyRender.php | 11 +- .../src/Controller/Convert.php | 25 +- .../ChillWopiBundle/src/Controller/Editor.php | 44 +--- .../src/Service/Controller/Responder.php | 16 +- .../src/Service/Wopi/AuthorizationManager.php | 8 +- .../Service/Wopi/ChillDocumentLockManager.php | 5 +- .../src/Service/Wopi/ChillDocumentManager.php | 25 +- .../src/Service/Wopi/ChillWopi.php | 8 +- .../src/Service/Wopi/UserManager.php | 5 +- 714 files changed, 2348 insertions(+), 9263 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 97678af50..3ea61c0cf 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -47,76 +47,14 @@ use function array_key_exists; final class ActivityController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private ActivityACLAwareRepositoryInterface $activityACLAwareRepository; - - private ActivityRepository $activityRepository; - - private ActivityTypeCategoryRepository $activityTypeCategoryRepository; - - private ActivityTypeRepositoryInterface $activityTypeRepository; - - private CenterResolverManagerInterface $centerResolver; - - private EntityManagerInterface $entityManager; - - private EventDispatcherInterface $eventDispatcher; - - private LocationRepository $locationRepository; - - private LoggerInterface $logger; - - private PersonRepository $personRepository; - - private SerializerInterface $serializer; - - private ThirdPartyRepository $thirdPartyRepository; - - private TranslatorInterface $translator; - - private UserRepositoryInterface $userRepository; - - public function __construct( - ActivityACLAwareRepositoryInterface $activityACLAwareRepository, - ActivityTypeRepositoryInterface $activityTypeRepository, - ActivityTypeCategoryRepository $activityTypeCategoryRepository, - PersonRepository $personRepository, - ThirdPartyRepository $thirdPartyRepository, - LocationRepository $locationRepository, - ActivityRepository $activityRepository, - AccompanyingPeriodRepository $accompanyingPeriodRepository, - EntityManagerInterface $entityManager, - EventDispatcherInterface $eventDispatcher, - LoggerInterface $logger, - SerializerInterface $serializer, - UserRepositoryInterface $userRepository, - CenterResolverManagerInterface $centerResolver, - TranslatorInterface $translator - ) { - $this->activityACLAwareRepository = $activityACLAwareRepository; - $this->activityTypeRepository = $activityTypeRepository; - $this->activityTypeCategoryRepository = $activityTypeCategoryRepository; - $this->personRepository = $personRepository; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->locationRepository = $locationRepository; - $this->activityRepository = $activityRepository; - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->entityManager = $entityManager; - $this->eventDispatcher = $eventDispatcher; - $this->logger = $logger; - $this->serializer = $serializer; - $this->userRepository = $userRepository; - $this->centerResolver = $centerResolver; - $this->translator = $translator; + public function __construct(private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private ActivityTypeCategoryRepository $activityTypeCategoryRepository, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private LocationRepository $locationRepository, private ActivityRepository $activityRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private EntityManagerInterface $entityManager, private EventDispatcherInterface $eventDispatcher, private LoggerInterface $logger, private SerializerInterface $serializer, private UserRepositoryInterface $userRepository, private CenterResolverManagerInterface $centerResolver, private TranslatorInterface $translator) + { } /** * Deletes a Activity entity. - * - * @param mixed $id */ - public function deleteAction(Request $request, $id) + public function deleteAction(Request $request, mixed $id) { $view = null; diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 32cec74a5..bff55a006 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -47,10 +47,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Displays a form to edit an existing ActivityReasonCategory entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -98,10 +96,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Finds and displays a ActivityReasonCategory entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -118,10 +114,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Edits an existing ActivityReasonCategory entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 95a49d0ba..60a7636e4 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -24,11 +24,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class ActivityReasonController extends AbstractController { - private ActivityReasonRepository $activityReasonRepository; - - public function __construct(ActivityReasonRepository $activityReasonRepository) + public function __construct(private ActivityReasonRepository $activityReasonRepository) { - $this->activityReasonRepository = $activityReasonRepository; } /** @@ -56,10 +53,8 @@ class ActivityReasonController extends AbstractController /** * Displays a form to edit an existing ActivityReason entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -107,10 +102,8 @@ class ActivityReasonController extends AbstractController /** * Finds and displays a ActivityReason entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -127,10 +120,8 @@ class ActivityReasonController extends AbstractController /** * Edits an existing ActivityReason entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index 82949d635..74eb4f8d3 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -25,17 +25,14 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface { use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - private EntityManagerInterface $em; - /** * @var \Faker\Generator */ private $faker; - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { $this->faker = FakerFactory::create('fr_FR'); - $this->em = $em; } public function getOrder() diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index e6da6b7e0..9d1e88409 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -83,10 +83,8 @@ class ActivityReason * Get name. * * @param mixed|null $locale - * - * @return array | string */ - public function getName($locale = null) + public function getName($locale = null): array|string { if ($locale) { if (isset($this->name[$locale])) { diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index e8c2e245d..ab63232a5 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -21,7 +21,7 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Table(name="activityreasoncategory") * @ORM\HasLifecycleCallbacks */ -class ActivityReasonCategory +class ActivityReasonCategory implements \Stringable { /** * @var bool @@ -65,7 +65,7 @@ class ActivityReasonCategory /** * @return string */ - public function __toString() + public function __toString(): string { return 'ActivityReasonCategory(' . $this->getName('x') . ')'; } diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index ed8260a4d..f49297f02 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -275,10 +275,8 @@ class ActivityType /** * @Assert\Callback - * - * @param mixed $payload */ - public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) + public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { diff --git a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php index 76fb440e7..fb2fb8a1c 100644 --- a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php +++ b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php @@ -22,14 +22,8 @@ use function in_array; class ActivityEntityListener { - private EntityManagerInterface $em; - - private AccompanyingPeriodWorkRepository $workRepository; - - public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository) + public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository) { - $this->em = $em; - $this->workRepository = $workRepository; } public function persistActionToCourse(Activity $activity) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php index 69149737b..60cff42f8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php @@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorAggregator implements AggregatorInterface { - private UserRender $userRender; - - private UserRepositoryInterface $userRepository; - - public function __construct( - UserRepositoryInterface $userRepository, - UserRender $userRender - ) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; + public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 89732412d..a09c254eb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -21,16 +21,8 @@ use function in_array; class BySocialActionAggregator implements AggregatorInterface { - private SocialActionRender $actionRender; - - private SocialActionRepository $actionRepository; - - public function __construct( - SocialActionRender $actionRender, - SocialActionRepository $actionRepository - ) { - $this->actionRender = $actionRender; - $this->actionRepository = $actionRepository; + public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 158e87664..111bdcf4b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -21,16 +21,8 @@ use function in_array; class BySocialIssueAggregator implements AggregatorInterface { - private SocialIssueRender $issueRender; - - private SocialIssueRepository $issueRepository; - - public function __construct( - SocialIssueRepository $issueRepository, - SocialIssueRender $issueRender - ) { - $this->issueRepository = $issueRepository; - $this->issueRender = $issueRender; + public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index c3ca6d59c..83c4a5d2a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -21,16 +21,8 @@ use function in_array; class ByThirdpartyAggregator implements AggregatorInterface { - private ThirdPartyRender $thirdPartyRender; - - private ThirdPartyRepository $thirdPartyRepository; - - public function __construct( - ThirdPartyRepository $thirdPartyRepository, - ThirdPartyRender $thirdPartyRender - ) { - $this->thirdPartyRepository = $thirdPartyRepository; - $this->thirdPartyRender = $thirdPartyRender; + public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php index 2c7ec1483..3014352ad 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php @@ -21,16 +21,8 @@ use function in_array; class CreatorScopeAggregator implements AggregatorInterface { - private ScopeRepository $scopeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ScopeRepository $scopeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index b4b23dc0b..a4f93e3b3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -29,12 +29,8 @@ class DateAggregator implements AggregatorInterface private const DEFAULT_CHOICE = 'year'; - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string @@ -99,17 +95,9 @@ class DateAggregator implements AggregatorInterface return ''; } - switch ($data['frequency']) { - case 'month': - case 'week': - //return $this->translator->trans('for week') .' '. $value ; - - case 'year': - //return $this->translator->trans('in year') .' '. $value ; - - default: - return $value; - } + return match ($data['frequency']) { + default => $value, + }; }; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index ec4ce6315..fa2c7f7c2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -21,16 +21,8 @@ use function in_array; class LocationTypeAggregator implements AggregatorInterface { - private LocationTypeRepository $locationTypeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - LocationTypeRepository $locationTypeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->locationTypeRepository = $locationTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 7cd16718e..272727d55 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -24,16 +24,8 @@ class ActivityTypeAggregator implements AggregatorInterface { public const KEY = 'activity_type_aggregator'; - protected ActivityTypeRepositoryInterface $activityTypeRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ActivityTypeRepositoryInterface $activityTypeRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->activityTypeRepository = $activityTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 9bde692c6..228ab8500 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -23,16 +23,8 @@ class ActivityUserAggregator implements AggregatorInterface { public const KEY = 'activity_user_id'; - private UserRender $userRender; - - private UserRepository $userRepository; - - public function __construct( - UserRepository $userRepository, - UserRender $userRender - ) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; + public function __construct(private UserRepository $userRepository, private UserRender $userRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php index 139f2743e..c1b2ff845 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php @@ -21,14 +21,8 @@ use function in_array; class ActivityUsersAggregator implements AggregatorInterface { - private UserRender $userRender; - - private UserRepositoryInterface $userRepository; - - public function __construct(UserRepositoryInterface $userRepository, UserRender $userRender) + public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php index 5741a0e58..1b8cb7e1c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php @@ -20,14 +20,8 @@ use function in_array; class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface { - private TranslatableStringHelperInterface $translatableStringHelper; - - private UserJobRepositoryInterface $userJobRepository; - - public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->userJobRepository = $userJobRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php index 15da300be..1f39ccf82 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php @@ -20,14 +20,8 @@ use function in_array; class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface { - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php index eaccf95cb..afdc0bacf 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php @@ -30,20 +30,8 @@ use function in_array; class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface { - protected ActivityReasonCategoryRepository $activityReasonCategoryRepository; - - protected ActivityReasonRepository $activityReasonRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ActivityReasonCategoryRepository $activityReasonCategoryRepository, - ActivityReasonRepository $activityReasonRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->activityReasonCategoryRepository = $activityReasonCategoryRepository; - $this->activityReasonRepository = $activityReasonRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string @@ -113,21 +101,11 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali public function getLabels($key, array $values, $data) { - // for performance reason, we load data from db only once - switch ($data['level']) { - case 'reasons': - $this->activityReasonRepository->findBy(['id' => $values]); - - break; - - case 'categories': - $this->activityReasonCategoryRepository->findBy(['id' => $values]); - - break; - - default: - throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])); - } + match ($data['level']) { + 'reasons' => $this->activityReasonRepository->findBy(['id' => $values]), + 'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]), + default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])), + }; return function ($value) use ($data) { if ('_header' === $value) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php index 5f772e156..7ff94aaca 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php @@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SentReceivedAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index 026e16f90..6e98565c6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -24,20 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ListActivity implements ListInterface, GroupedExportInterface { - private EntityManagerInterface $entityManager; - - private ListActivityHelper $helper; - - private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper; - - public function __construct( - ListActivityHelper $helper, - EntityManagerInterface $entityManager, - TranslatableStringExportLabelHelper $translatableStringExportLabelHelper - ) { - $this->helper = $helper; - $this->entityManager = $entityManager; - $this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper; + public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper) + { } public function buildForm(FormBuilderInterface $builder) @@ -62,22 +50,17 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'acpId': - return static function ($value) { - if ('_header' === $value) { - return ListActivityHelper::MSG_KEY . 'accompanying course id'; - } + return match ($key) { + 'acpId' => static function ($value) { + if ('_header' === $value) { + return ListActivityHelper::MSG_KEY . 'accompanying course id'; + } - return $value ?? ''; - }; - - case 'scopesNames': - return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'); - - default: - return $this->helper->getLabels($key, $values, $data); - } + return $value ?? ''; + }, + 'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'), + default => $this->helper->getLabels($key, $values, $data), + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 4246df173..171d8f829 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class CountActivity implements ExportInterface, GroupedExportInterface { - protected ActivityRepository $activityRepository; - - public function __construct( - ActivityRepository $activityRepository - ) { - $this->activityRepository = $activityRepository; + public function __construct(protected ActivityRepository $activityRepository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 60110c9a8..ff4d4fa47 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -36,8 +36,6 @@ use function in_array; class ListActivity implements ListInterface, GroupedExportInterface { - protected EntityManagerInterface $entityManager; - protected array $fields = [ 'id', 'date', @@ -52,22 +50,8 @@ class ListActivity implements ListInterface, GroupedExportInterface 'person_id', ]; - protected TranslatableStringHelperInterface $translatableStringHelper; - - protected TranslatorInterface $translator; - - private ActivityRepository $activityRepository; - - public function __construct( - EntityManagerInterface $em, - TranslatorInterface $translator, - TranslatableStringHelperInterface $translatableStringHelper, - ActivityRepository $activityRepository - ) { - $this->entityManager = $em; - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; - $this->activityRepository = $activityRepository; + public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 050034954..bb8be00ff 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -32,22 +32,16 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface { public const SUM = 'sum'; - /** - * The action for this report. - */ - protected string $action; - - private ActivityRepository $activityRepository; - /** * @param string $action the stat to perform */ public function __construct( - ActivityRepository $activityRepository, - string $action = 'sum' + private ActivityRepository $activityRepository, + /** + * The action for this report. + */ + protected string $action = 'sum' ) { - $this->action = $action; - $this->activityRepository = $activityRepository; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index fae6ea6a6..5af351b28 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -32,44 +32,8 @@ class ListActivityHelper { public const MSG_KEY = 'export.list.activity.'; - private ActivityPresenceRepositoryInterface $activityPresenceRepository; - - private ActivityTypeRepositoryInterface $activityTypeRepository; - - private DateTimeHelper $dateTimeHelper; - - private LabelPersonHelper $labelPersonHelper; - - private LabelThirdPartyHelper $labelThirdPartyHelper; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatableStringExportLabelHelper $translatableStringLabelHelper; - - private TranslatorInterface $translator; - - private UserHelper $userHelper; - - public function __construct( - ActivityPresenceRepositoryInterface $activityPresenceRepository, - ActivityTypeRepositoryInterface $activityTypeRepository, - DateTimeHelper $dateTimeHelper, - LabelPersonHelper $labelPersonHelper, - LabelThirdPartyHelper $labelThirdPartyHelper, - TranslatorInterface $translator, - TranslatableStringHelperInterface $translatableStringHelper, - TranslatableStringExportLabelHelper $translatableStringLabelHelper, - UserHelper $userHelper - ) { - $this->activityPresenceRepository = $activityPresenceRepository; - $this->activityTypeRepository = $activityTypeRepository; - $this->dateTimeHelper = $dateTimeHelper; - $this->labelPersonHelper = $labelPersonHelper; - $this->labelThirdPartyHelper = $labelThirdPartyHelper; - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; - $this->translatableStringLabelHelper = $translatableStringLabelHelper; - $this->userHelper = $userHelper; + public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private DateTimeHelper $dateTimeHelper, private LabelPersonHelper $labelPersonHelper, private LabelThirdPartyHelper $labelThirdPartyHelper, private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringExportLabelHelper $translatableStringLabelHelper, private UserHelper $userHelper) + { } public function addSelect(QueryBuilder $qb): void @@ -115,113 +79,79 @@ class ListActivityHelper public function getLabels($key, array $values, $data) { - switch ($key) { - case 'createdAt': - case 'updatedAt': - return $this->dateTimeHelper->getLabel($key); + return match ($key) { + 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key), + 'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key), + 'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key), + 'attendeeName' => function ($value) { + if ('_header' === $value) { + return 'Attendee'; + } - case 'createdBy': - case 'updatedBy': - return $this->userHelper->getLabel($key, $values, $key); + if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) { + return ''; + } - case 'date': - return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key); + return $this->translatableStringHelper->localize($presence->getName()); + }, + 'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'), + 'typeName' => function ($value) { + if ('_header' === $value) { + return 'Activity type'; + } - case 'attendeeName': - return function ($value) { - if ('_header' === $value) { - return 'Attendee'; - } + if (null === $value || null === $type = $this->activityTypeRepository->find($value)) { + return ''; + } - if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) { - return ''; - } + return $this->translatableStringHelper->localize($type->getName()); + }, + 'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'), + 'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) { + if ('_header' === $value) { + return match ($key) { + 'usersIds' => self::MSG_KEY . 'users ids', + 'thirdPartiesIds' => self::MSG_KEY . 'third parties ids', + 'personsIds' => self::MSG_KEY . 'persons ids', + default => throw new LogicException('key not supported'), + }; + } - return $this->translatableStringHelper->localize($presence->getName()); - }; + $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); - case 'listReasons': - return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'); + return implode( + '|', + array_unique( + array_filter($decoded, static fn (?int $id) => null !== $id), + SORT_NUMERIC + ) + ); + }, + 'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'), + 'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'), + 'sentReceived' => function ($value) { + if ('_header' === $value) { + return self::MSG_KEY . 'sent received'; + } - case 'typeName': - return function ($value) { - if ('_header' === $value) { - return 'Activity type'; - } + if (null === $value) { + return ''; + } - if (null === $value || null === $type = $this->activityTypeRepository->find($value)) { - return ''; - } + return $this->translator->trans($value); + }, + default => function ($value) use ($key) { + if ('_header' === $value) { + return self::MSG_KEY . $key; + } - return $this->translatableStringHelper->localize($type->getName()); - }; + if (null === $value) { + return ''; + } - case 'usersNames': - return $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'); - - case 'usersIds': - case 'thirdPartiesIds': - case 'personsIds': - return static function ($value) use ($key) { - if ('_header' === $value) { - switch ($key) { - case 'usersIds': - return self::MSG_KEY . 'users ids'; - - case 'thirdPartiesIds': - return self::MSG_KEY . 'third parties ids'; - - case 'personsIds': - return self::MSG_KEY . 'persons ids'; - - default: - throw new LogicException('key not supported'); - } - } - - $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); - - return implode( - '|', - array_unique( - array_filter($decoded, static fn (?int $id) => null !== $id), - SORT_NUMERIC - ) - ); - }; - - case 'personsNames': - return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'); - - case 'thirdPartiesNames': - return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'); - - case 'sentReceived': - return function ($value) { - if ('_header' === $value) { - return self::MSG_KEY . 'sent received'; - } - - if (null === $value) { - return ''; - } - - return $this->translator->trans($value); - }; - - default: - return function ($value) use ($key) { - if ('_header' === $value) { - return self::MSG_KEY . $key; - } - - if (null === $value) { - return ''; - } - - return $this->translator->trans($value); - }; - } + return $this->translator->trans($value); + }, + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php index c6616a4c6..a1f2bc786 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php @@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityTypeFilter implements FilterInterface { - private ActivityTypeRepositoryInterface $activityTypeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ActivityTypeRepositoryInterface $activityTypeRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->activityTypeRepository = $activityTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php index 322393f32..28264c919 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php @@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorFilter implements FilterInterface { - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index d0c1b0fc7..89330728f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -22,11 +22,8 @@ use function in_array; class BySocialActionFilter implements FilterInterface { - private SocialActionRender $actionRender; - - public function __construct(SocialActionRender $actionRender) + public function __construct(private SocialActionRender $actionRender) { - $this->actionRender = $actionRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index bbb882a65..d78efbde0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -22,11 +22,8 @@ use function in_array; class BySocialIssueFilter implements FilterInterface { - private SocialIssueRender $issueRender; - - public function __construct(SocialIssueRender $issueRender) + public function __construct(private SocialIssueRender $issueRender) { - $this->issueRender = $issueRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php index b79c2ca10..aff224bf3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = false; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index 5fe928b6c..800381416 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -22,11 +22,8 @@ use function in_array; class LocationTypeFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php index 8daa7a781..b901ebde7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php @@ -29,11 +29,8 @@ class SentReceivedFilter implements FilterInterface private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index 6350f3ace..1a5d28059 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface; class UserFilter implements FilterInterface { - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index 4319c100a..47445a012 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -23,11 +23,8 @@ use function in_array; class UserScopeFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index f2216c929..1ea273c64 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -27,16 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ActivityDateFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - TranslatorInterface $translator, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->translator = $translator; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index b9d39c3ce..ac2f421b1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -26,16 +26,8 @@ use function count; class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface { - protected ActivityTypeRepositoryInterface $activityTypeRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - TranslatableStringHelperInterface $translatableStringHelper, - ActivityTypeRepositoryInterface $activityTypeRepository - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->activityTypeRepository = $activityTypeRepository; + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php index 2f6cd8462..735b66a31 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php @@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersFilter implements FilterInterface { - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index c55d579e4..1b599f403 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -29,16 +29,8 @@ use function in_array; class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface { - protected ActivityReasonRepository $activityReasonRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $helper, - ActivityReasonRepository $activityReasonRepository - ) { - $this->translatableStringHelper = $helper; - $this->activityReasonRepository = $activityReasonRepository; + public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index e3c85fe9c..043d87c3b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -37,20 +37,8 @@ use function count; class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface { - protected ActivityReasonRepository $activityReasonRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - protected TranslatorInterface $translator; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - ActivityReasonRepository $activityReasonRepository, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->activityReasonRepository = $activityReasonRepository; - $this->translator = $translator; + public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository, protected TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index b52ef441c..c9e942816 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class UsersJobFilter implements FilterInterface { - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php index 61b12264e..f93f982aa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php @@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class UsersScopeFilter implements FilterInterface { - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ScopeRepositoryInterface $scopeRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index a74178afd..780e87db9 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -58,40 +58,22 @@ use function in_array; class ActivityType extends AbstractType { - protected AuthorizationHelper $authorizationHelper; - - protected ObjectManager $om; - - protected SocialActionRender $socialActionRender; - - protected SocialIssueRender $socialIssueRender; - - protected array $timeChoices; - - protected TranslatableStringHelper $translatableStringHelper; - protected User $user; public function __construct( TokenStorageInterface $tokenStorage, - AuthorizationHelper $authorizationHelper, - ObjectManager $om, - TranslatableStringHelper $translatableStringHelper, - array $timeChoices, - SocialIssueRender $socialIssueRender, - SocialActionRender $socialActionRender + protected AuthorizationHelper $authorizationHelper, + protected ObjectManager $om, + protected TranslatableStringHelper $translatableStringHelper, + protected array $timeChoices, + protected SocialIssueRender $socialIssueRender, + protected SocialActionRender $socialActionRender ) { if (!$tokenStorage->getToken()->getUser() instanceof User) { throw new RuntimeException('you should have a valid user'); } $this->user = $tokenStorage->getToken()->getUser(); - $this->authorizationHelper = $authorizationHelper; - $this->om = $om; - $this->translatableStringHelper = $translatableStringHelper; - $this->timeChoices = $timeChoices; - $this->socialIssueRender = $socialIssueRender; - $this->socialActionRender = $socialActionRender; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 073b8099f..6288486f7 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -25,11 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ActivityTypeType extends AbstractType { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php index 35da7e02f..4709b3010 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php @@ -24,20 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class PickActivityReasonType extends AbstractType { - private ActivityReasonRepository $activityReasonRepository; - - private ActivityReasonRender $reasonRender; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ActivityReasonRepository $activityReasonRepository, - ActivityReasonRender $reasonRender, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->activityReasonRepository = $activityReasonRepository; - $this->reasonRender = $reasonRender; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php index 4aa259097..8ccdf42c8 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php @@ -23,14 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class TranslatableActivityReasonCategoryType extends AbstractType { - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper, TranslatorInterface $translator) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) { - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php index d4807b82d..e2233f3b1 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php @@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class TranslatableActivityType extends AbstractType { - protected ActivityTypeRepositoryInterface $activityTypeRepository; - - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - TranslatableStringHelperInterface $helper, - ActivityTypeRepositoryInterface $activityTypeRepository - ) { - $this->translatableStringHelper = $helper; - $this->activityTypeRepository = $activityTypeRepository; + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php index 9884450ec..bae2b0577 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -23,16 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - protected Security $security; - - protected TranslatorInterface $translator; - - public function __construct( - Security $security, - TranslatorInterface $translator - ) { - $this->security = $security; - $this->translator = $translator; + public function __construct(protected Security $security, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 4b2d348d7..bdffafcb2 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -20,11 +20,8 @@ use Symfony\Component\Security\Core\Security; */ final class AdminMenuBuilder implements LocalMenuBuilderInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php index 03a1b09ab..1ad7f9042 100644 --- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php @@ -23,22 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class PersonMenuBuilder implements LocalMenuBuilderInterface { - /** - * @var AuthorizationCheckerInterface - */ - protected $authorizationChecker; - - /** - * @var TranslatorInterface - */ - protected $translator; - - public function __construct( - AuthorizationCheckerInterface $authorizationChecker, - TranslatorInterface $translator - ) { - $this->translator = $translator; - $this->authorizationChecker = $authorizationChecker; + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php index ab26da81d..4b8566484 100644 --- a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php +++ b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php @@ -18,11 +18,8 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface; final class ActivityNotificationHandler implements NotificationHandlerInterface { - private ActivityRepository $activityRepository; - - public function __construct(ActivityRepository $activityRepository) + public function __construct(private ActivityRepository $activityRepository) { - $this->activityRepository = $activityRepository; } public function getTemplate(Notification $notification, array $options = []): string diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 1f2039a2c..c4eae39f0 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -35,32 +35,8 @@ use function in_array; final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface { - private AuthorizationHelper $authorizationHelper; - - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private EntityManagerInterface $em; - - private ActivityRepository $repository; - - private Security $security; - - private TokenStorageInterface $tokenStorage; - - public function __construct( - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher, - TokenStorageInterface $tokenStorage, - ActivityRepository $repository, - EntityManagerInterface $em, - Security $security - ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->tokenStorage = $tokenStorage; - $this->repository = $repository; - $this->em = $em; - $this->security = $security; + public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private TokenStorageInterface $tokenStorage, private ActivityRepository $repository, private EntityManagerInterface $em, private Security $security) + { } public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php index c6b69319e..33c36693e 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php @@ -23,15 +23,11 @@ use Symfony\Component\HttpFoundation\RequestStack; */ class ActivityReasonRepository extends ServiceEntityRepository { - private RequestStack $requestStack; - public function __construct( ManagerRegistry $registry, - RequestStack $requestStack + private RequestStack $requestStack ) { parent::__construct($registry, ActivityReason::class); - - $this->requestStack = $requestStack; } /** diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php index 15d2441d5..a036c9784 100644 --- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php +++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php @@ -74,15 +74,12 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn self::FULL, ]; - protected Security $security; - protected VoterHelperInterface $voterHelper; public function __construct( - Security $security, + protected Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->security = $security; $this->voterHelper = $voterHelperFactory->generate(self::class) ->addCheckFor(Person::class, [self::SEE, self::CREATE]) ->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE]) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 624859eda..95a5a4b10 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -39,40 +39,8 @@ class ActivityContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - private BaseContextData $baseContextData; - - private DocumentCategoryRepository $documentCategoryRepository; - - private EntityManagerInterface $em; - - private NormalizerInterface $normalizer; - - private PersonRenderInterface $personRender; - - private PersonRepository $personRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - DocumentCategoryRepository $documentCategoryRepository, - NormalizerInterface $normalizer, - TranslatableStringHelperInterface $translatableStringHelper, - EntityManagerInterface $em, - PersonRenderInterface $personRender, - PersonRepository $personRepository, - TranslatorInterface $translator, - BaseContextData $baseContextData - ) { - $this->documentCategoryRepository = $documentCategoryRepository; - $this->normalizer = $normalizer; - $this->translatableStringHelper = $translatableStringHelper; - $this->em = $em; - $this->personRender = $personRender; - $this->personRepository = $personRepository; - $this->translator = $translator; - $this->baseContextData = $baseContextData; + public function __construct(private DocumentCategoryRepository $documentCategoryRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper, private EntityManagerInterface $em, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private TranslatorInterface $translator, private BaseContextData $baseContextData) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index 3da451f2e..dc895782a 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -48,44 +48,8 @@ class ListActivitiesByAccompanyingPeriodContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - private AccompanyingPeriodContext $accompanyingPeriodContext; - - private ActivityACLAwareRepositoryInterface $activityACLAwareRepository; - - private NormalizerInterface $normalizer; - - private PersonRepository $personRepository; - - private SocialActionRepository $socialActionRepository; - - private SocialIssueRepository $socialIssueRepository; - - private ThirdPartyRepository $thirdPartyRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private UserRepository $userRepository; - - public function __construct( - AccompanyingPeriodContext $accompanyingPeriodContext, - ActivityACLAwareRepositoryInterface $activityACLAwareRepository, - NormalizerInterface $normalizer, - PersonRepository $personRepository, - SocialActionRepository $socialActionRepository, - SocialIssueRepository $socialIssueRepository, - ThirdPartyRepository $thirdPartyRepository, - TranslatableStringHelperInterface $translatableStringHelper, - UserRepository $userRepository, - ) { - $this->accompanyingPeriodContext = $accompanyingPeriodContext; - $this->activityACLAwareRepository = $activityACLAwareRepository; - $this->normalizer = $normalizer; - $this->personRepository = $personRepository; - $this->socialActionRepository = $socialActionRepository; - $this->socialIssueRepository = $socialIssueRepository; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->userRepository = $userRepository; + public function __construct(private AccompanyingPeriodContext $accompanyingPeriodContext, private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private NormalizerInterface $normalizer, private PersonRepository $personRepository, private SocialActionRepository $socialActionRepository, private SocialIssueRepository $socialIssueRepository, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper, private UserRepository $userRepository) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php index 04301afae..b90a5018e 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php @@ -76,10 +76,8 @@ final class ActivityControllerTest extends WebTestCase /** * @dataProvider getSecuredPagesUnauthenticated - * - * @param mixed $url */ - public function testAccessIsDeniedForUnauthenticated($url) + public function testAccessIsDeniedForUnauthenticated(mixed $url) { $client = $this->createClient(); @@ -262,11 +260,9 @@ final class ActivityControllerTest extends WebTestCase } /** - * @param mixed $username - * * @return \Symfony\Component\BrowserKit\Client */ - private function getAuthenticatedClient($username = 'center a_social') + private function getAuthenticatedClient(mixed $username = 'center a_social') { return self::createClient([], [ 'PHP_AUTH_USER' => $username, diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php index 770b88cf4..c87a04f9a 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php @@ -89,11 +89,9 @@ final class TranslatableActivityTypeTest extends KernelTestCase } /** - * @param mixed $active - * * @return \Chill\ActivityBundle\Entity\ActivityType */ - protected function getRandomType($active = true) + protected function getRandomType(mixed $active = true) { $types = $this->container->get('doctrine.orm.entity_manager') ->getRepository(ActivityType::class) diff --git a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php index dad597676..208b28496 100644 --- a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php +++ b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php @@ -33,24 +33,14 @@ class TimelineActivityProvider implements TimelineProviderInterface { private const SUPPORTED_CONTEXTS = ['center', 'person']; - protected ActivityACLAwareRepository $aclAwareRepository; - - protected EntityManagerInterface $em; - - protected AuthorizationHelperInterface $helper; - protected UserInterface $user; public function __construct( - EntityManagerInterface $em, - AuthorizationHelperInterface $helper, + protected EntityManagerInterface $em, + protected AuthorizationHelperInterface $helper, TokenStorageInterface $storage, - ActivityACLAwareRepository $aclAwareRepository + protected ActivityACLAwareRepository $aclAwareRepository ) { - $this->em = $em; - $this->helper = $helper; - $this->aclAwareRepository = $aclAwareRepository; - if (!$storage->getToken()->getUser() instanceof User) { throw new RuntimeException('A user should be authenticated !'); } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 8481f24eb..281585bb9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Request; final class AsideActivityController extends CRUDController { - private AsideActivityCategoryRepository $categoryRepository; - - public function __construct(AsideActivityCategoryRepository $categoryRepository) + public function __construct(private AsideActivityCategoryRepository $categoryRepository) { - $this->categoryRepository = $categoryRepository; } public function createEntity(string $action, Request $request): object diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php index 6f6a11390..e39813009 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php @@ -24,11 +24,8 @@ use function random_int; class LoadAsideActivity extends Fixture implements DependentFixtureInterface { - private UserRepository $userRepository; - - public function __construct(UserRepository $userRepository) + public function __construct(private UserRepository $userRepository) { - $this->userRepository = $userRepository; } public function getDependencies(): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 6c12e5828..2ccab56d0 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -114,10 +114,8 @@ class AsideActivityCategory /** * @Assert\Callback - * - * @param mixed $payload */ - public function preventRecursiveParent(ExecutionContextInterface $context, $payload) + public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload) { if (!$this->hasParent()) { return; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php index 32418e3c3..86a1360dc 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php @@ -20,14 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByActivityTypeAggregator implements AggregatorInterface { - private AsideActivityCategoryRepository $asideActivityCategoryRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper) + public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper) { - $this->asideActivityCategoryRepository = $asideActivityCategoryRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php index d2fe7c2f2..a911ad163 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php @@ -22,14 +22,8 @@ use function in_array; class ByUserJobAggregator implements AggregatorInterface { - private TranslatableStringHelperInterface $translatableStringHelper; - - private UserJobRepositoryInterface $userJobRepository; - - public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->userJobRepository = $userJobRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php index 6c06ee756..553e2f77b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php @@ -22,14 +22,8 @@ use function in_array; class ByUserScopeAggregator implements AggregatorInterface { - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php index f3db629cb..75d221b70 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php @@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface { - private AsideActivityRepository $repository; - - public function __construct( - AsideActivityRepository $repository - ) { - $this->repository = $repository; + public function __construct(private AsideActivityRepository $repository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php index 9204fad4b..e9c4932f3 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php @@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class CountAsideActivity implements ExportInterface, GroupedExportInterface { - private AsideActivityRepository $repository; - - public function __construct( - AsideActivityRepository $repository - ) { - $this->repository = $repository; + public function __construct(private AsideActivityRepository $repository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index aee168174..a59962829 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -34,40 +34,8 @@ use Symfony\Component\Form\FormBuilderInterface; final class ListAsideActivity implements ListInterface, GroupedExportInterface { - private AsideActivityCategoryRepository $asideActivityCategoryRepository; - - private CategoryRender $categoryRender; - - private CenterRepositoryInterface $centerRepository; - - private DateTimeHelper $dateTimeHelper; - - private EntityManagerInterface $em; - - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private UserHelper $userHelper; - - public function __construct( - EntityManagerInterface $em, - DateTimeHelper $dateTimeHelper, - UserHelper $userHelper, - ScopeRepositoryInterface $scopeRepository, - CenterRepositoryInterface $centerRepository, - AsideActivityCategoryRepository $asideActivityCategoryRepository, - CategoryRender $categoryRender, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->em = $em; - $this->dateTimeHelper = $dateTimeHelper; - $this->userHelper = $userHelper; - $this->scopeRepository = $scopeRepository; - $this->centerRepository = $centerRepository; - $this->asideActivityCategoryRepository = $asideActivityCategoryRepository; - $this->categoryRender = $categoryRender; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder) @@ -91,86 +59,67 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'id': - case 'note': - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.aside_activity.' . $key; - } + return match ($key) { + 'id', 'note' => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.aside_activity.' . $key; + } - return $value ?? ''; - }; + return $value ?? ''; + }, + 'duration' => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.aside_activity.' . $key; + } - case 'duration': - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.aside_activity.' . $key; - } + if (null === $value) { + return ''; + } - if (null === $value) { - return ''; - } + if ($value instanceof DateTimeInterface) { + return $value->format('H:i:s'); + } - if ($value instanceof DateTimeInterface) { - return $value->format('H:i:s'); - } + return $value; + }, + 'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key), + 'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key), + 'aside_activity_type' => function ($value) { + if ('_header' === $value) { + return 'export.aside_activity.aside_activity_type'; + } - return $value; - }; + if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) { + return ''; + } - case 'createdAt': - case 'updatedAt': - case 'date': - return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key); + return $this->categoryRender->renderString($c, []); + }, + 'main_scope' => function ($value) { + if ('_header' === $value) { + return 'export.aside_activity.main_scope'; + } - case 'agent_id': - case 'creator_id': - return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key); + if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) { + return ''; + } - case 'aside_activity_type': - return function ($value) { - if ('_header' === $value) { - return 'export.aside_activity.aside_activity_type'; - } + return $this->translatableStringHelper->localize($c->getName()); + }, + 'main_center' => function ($value) { + if ('_header' === $value) { + return 'export.aside_activity.main_center'; + } - if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) { - return ''; - } + if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) { + /** @var Center $c */ + return ''; + } - return $this->categoryRender->renderString($c, []); - }; - - case 'main_scope': - return function ($value) { - if ('_header' === $value) { - return 'export.aside_activity.main_scope'; - } - - if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) { - return ''; - } - - return $this->translatableStringHelper->localize($c->getName()); - }; - - case 'main_center': - return function ($value) { - if ('_header' === $value) { - return 'export.aside_activity.main_center'; - } - - if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) { - /** @var Center $c */ - return ''; - } - - return $c->getName(); - }; - - default: - throw new LogicException('this key is not supported : ' . $key); - } + return $c->getName(); + }, + default => throw new LogicException('this key is not supported : ' . $key), + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php index af17a2591..278fd7b91 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php @@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface { - private AsideActivityRepository $repository; - - public function __construct( - AsideActivityRepository $repository - ) { - $this->repository = $repository; + public function __construct(private AsideActivityRepository $repository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php index 3ad8e0e93..535ee04bb 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php @@ -23,20 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByActivityTypeFilter implements FilterInterface { - private AsideActivityCategoryRepository $asideActivityTypeRepository; - - private CategoryRender $categoryRender; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - CategoryRender $categoryRender, - TranslatableStringHelperInterface $translatableStringHelper, - AsideActivityCategoryRepository $asideActivityTypeRepository - ) { - $this->categoryRender = $categoryRender; - $this->asideActivityTypeRepository = $asideActivityTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php index 7a1b6f4dc..05bf46889 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php @@ -26,16 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ByDateFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter, - TranslatorInterface $translator - ) { - $this->translator = $translator; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index 795c813cd..809ec1250 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserFilter implements FilterInterface { - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php index 86194b123..8b7b1c662 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php @@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserJobFilter implements FilterInterface { - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php index 4342e11eb..b7b7edfe4 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php @@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserScopeFilter implements FilterInterface { - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ScopeRepositoryInterface $scopeRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index c183fcea6..584c528e4 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { - private CategoryRender $categoryRender; - - public function __construct( - CategoryRender $categoryRender - ) { - $this->categoryRender = $categoryRender; + public function __construct(private CategoryRender $categoryRender) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php index 3ee392517..63f6372d8 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php @@ -20,12 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class PickAsideActivityCategoryType extends AbstractType { - private CategoryRender $categoryRender; - - public function __construct( - CategoryRender $categoryRender - ) { - $this->categoryRender = $categoryRender; + public function __construct(private CategoryRender $categoryRender) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php index 8cc076a6e..dcf5c6720 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -16,11 +16,8 @@ use Symfony\Component\Security\Core\Security; final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index f23fcdc8a..15547c665 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php @@ -21,14 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SectionMenuBuilder implements LocalMenuBuilderInterface { - public AuthorizationCheckerInterface $authorizationChecker; - - protected TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker) + public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker) { - $this->translator = $translator; - $this->authorizationChecker = $authorizationChecker; } /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index 066a0ca52..f4a7c4977 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -27,14 +27,8 @@ final class CategoryRender implements ChillEntityRenderInterface public const SEPERATOR_KEY = 'default.separator'; - private EngineInterface $engine; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine) { - $this->translatableStringHelper = $translatableStringHelper; - $this->engine = $engine; } public function buildParents(AsideActivityCategory $asideActivityCategory) diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php index 125c72ce4..3192cc14a 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php @@ -27,20 +27,8 @@ use function get_class; abstract class AbstractElementController extends AbstractController { - protected LoggerInterface $chillMainLogger; - - protected EntityManagerInterface $em; - - protected TranslatorInterface $translator; - - public function __construct( - EntityManagerInterface $em, - TranslatorInterface $translator, - LoggerInterface $chillMainLogger - ) { - $this->em = $em; - $this->translator = $translator; - $this->chillMainLogger = $chillMainLogger; + public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger) + { } /** @@ -48,11 +36,8 @@ abstract class AbstractElementController extends AbstractController * "{_locale}/family-members/family-members/{id}/delete", * name="chill_family_members_family_members_delete" * ). - * - * @param mixed $template - * @param mixed $flashMessage */ - protected function _delete(AbstractElement $element, Request $request, $template, $flashMessage): Response + protected function _delete(AbstractElement $element, Request $request, mixed $template, mixed $flashMessage): Response { $this->denyAccessUnlessGranted(BudgetElementVoter::DELETE, $element, 'You are not ' . 'allowed to delete this item'); @@ -72,7 +57,7 @@ abstract class AbstractElementController extends AbstractController if ($form->isValid()) { $this->chillMainLogger->notice('A budget element has been removed', [ - 'family_element' => get_class($element), + 'family_element' => $element::class, 'by_user' => $this->getUser()->getUsername(), 'family_member_id' => $element->getId(), 'amount' => $element->getAmount(), @@ -141,12 +126,7 @@ abstract class AbstractElementController extends AbstractController ]); } - /** - * @param mixed $template - * @param mixed $flashMessageOnSuccess - * @param mixed $entity - */ - protected function _new($entity, Request $request, $template, $flashMessageOnSuccess) + protected function _new(mixed $entity, Request $request, mixed $template, mixed $flashMessageOnSuccess) { /** @var AbstractElement $element */ $element = $this->createNewElement(); @@ -196,10 +176,8 @@ abstract class AbstractElementController extends AbstractController * "{_locale}/family-members/family-members/{id}/view", * name="chill_family_members_family_members_view" * ). - * - * @param mixed $template */ - protected function _view(AbstractElement $element, $template) + protected function _view(AbstractElement $element, mixed $template) { $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $element); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index b5db3cd30..20f05a8ca 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -31,20 +31,8 @@ use function count; class ElementController extends AbstractController { - private CalculatorManager $calculator; - - private ResourceRepository $resourceRepository; - - private ChargeRepository $chargeRepository; - - public function __construct( - CalculatorManager $calculator, - ResourceRepository $resourceRepository, - ChargeRepository $chargeRepository, - ) { - $this->calculator = $calculator; - $this->resourceRepository = $resourceRepository; - $this->chargeRepository = $chargeRepository; + public function __construct(private CalculatorManager $calculator, private ResourceRepository $resourceRepository, private ChargeRepository $chargeRepository) + { } /** diff --git a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php index 72863163f..778866cb3 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php @@ -27,20 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ChargeType extends AbstractType { - protected TranslatableStringHelperInterface $translatableStringHelper; - - private ChargeKindRepository $repository; - - private TranslatorInterface $translator; - - public function __construct( - TranslatableStringHelperInterface $translatableStringHelper, - ChargeKindRepository $repository, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->repository = $repository; - $this->translator = $translator; + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ChargeKindRepository $repository, private TranslatorInterface $translator) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php index 09dfd16f3..c98301597 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php @@ -26,20 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ResourceType extends AbstractType { - protected TranslatableStringHelperInterface $translatableStringHelper; - - private ResourceKindRepository $repository; - - private TranslatorInterface $translator; - - public function __construct( - TranslatableStringHelperInterface $translatableStringHelper, - ResourceKindRepository $repository, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->repository = $repository; - $this->translator = $translator; + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepository $repository, private TranslatorInterface $translator) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php index 894230ad9..787980862 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php @@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security; final class AdminMenuBuilder implements LocalMenuBuilderInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php index 1224c0bfe..c5d19262d 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php @@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMenuBuilder implements LocalMenuBuilderInterface { - protected AuthorizationCheckerInterface $authorizationChecker; - - protected TranslatorInterface $translator; - - public function __construct( - AuthorizationCheckerInterface $authorizationChecker, - TranslatorInterface $translator - ) { - $this->authorizationChecker = $authorizationChecker; - $this->translator = $translator; + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php index 7322af849..97b10c72b 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php @@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - protected AuthorizationCheckerInterface $authorizationChecker; - - protected TranslatorInterface $translator; - - public function __construct( - AuthorizationCheckerInterface $authorizationChecker, - TranslatorInterface $translator - ) { - $this->authorizationChecker = $authorizationChecker; - $this->translator = $translator; + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php index 1c66d4c1c..17e80bd63 100644 --- a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php +++ b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php @@ -37,24 +37,8 @@ final class SummaryBudget implements SummaryBudgetInterface private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id'; - private ChargeKindRepositoryInterface $chargeKindRepository; - - private EntityManagerInterface $em; - - private ResourceKindRepositoryInterface $resourceKindRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - EntityManagerInterface $em, - TranslatableStringHelperInterface $translatableStringHelper, - ResourceKindRepositoryInterface $resourceKindRepository, - ChargeKindRepositoryInterface $chargeKindRepository - ) { - $this->em = $em; - $this->translatableStringHelper = $translatableStringHelper; - $this->resourceKindRepository = $resourceKindRepository; - $this->chargeKindRepository = $chargeKindRepository; + public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository) + { } public function getSummaryForHousehold(?Household $household): array diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index 842e6be4e..336d69c66 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -22,14 +22,8 @@ use Symfony\Component\Templating\EngineInterface; */ final class BudgetElementTypeRender implements ChillEntityRenderInterface { - private EngineInterface $engine; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper, EngineInterface $engine) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine) { - $this->translatableStringHelper = $translatableStringHelper; - $this->engine = $engine; } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php index 77017abc5..4190341d0 100644 --- a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php +++ b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php @@ -66,11 +66,11 @@ final class SummaryBudgetTest extends TestCase $em = $this->prophesize(EntityManagerInterface::class); $em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class)) ->will(static function ($args) use ($queryResources, $queryCharges) { - if (false !== strpos($args[0], 'chill_budget.resource')) { + if (str_contains($args[0], 'chill_budget.resource')) { return $queryResources->reveal(); } - if (false !== strpos($args[0], 'chill_budget.charge')) { + if (str_contains($args[0], 'chill_budget.charge')) { return $queryCharges->reveal(); } diff --git a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php index 400619990..d71439314 100644 --- a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php +++ b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php @@ -29,19 +29,9 @@ use TheNetworg\OAuth2\Client\Provider\Azure; class AzureGrantAdminConsentAndAcquireToken extends Command { - private Azure $azure; - - private ClientRegistry $clientRegistry; - - private MachineTokenStorage $machineTokenStorage; - - public function __construct(Azure $azure, ClientRegistry $clientRegistry, MachineTokenStorage $machineTokenStorage) + public function __construct(private Azure $azure, private ClientRegistry $clientRegistry, private MachineTokenStorage $machineTokenStorage) { parent::__construct('chill:calendar:msgraph-grant-admin-consent'); - - $this->azure = $azure; - $this->clientRegistry = $clientRegistry; - $this->machineTokenStorage = $machineTokenStorage; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index b90fb83d4..48b9242fd 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -32,30 +32,14 @@ use Symfony\Component\Console\Output\OutputInterface; class MapAndSubscribeUserCalendarCommand extends Command { - private EntityManagerInterface $em; - - private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator; - - private LoggerInterface $logger; - - private MapCalendarToUser $mapCalendarToUser; - - private MSGraphUserRepository $userRepository; - public function __construct( - EntityManagerInterface $em, - EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, - LoggerInterface $logger, - MapCalendarToUser $mapCalendarToUser, - MSGraphUserRepository $userRepository + private EntityManagerInterface $em, + private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, + private LoggerInterface $logger, + private MapCalendarToUser $mapCalendarToUser, + private MSGraphUserRepository $userRepository ) { parent::__construct('chill:calendar:msgraph-user-map-subscribe'); - - $this->em = $em; - $this->eventsOnUserSubscriptionCreator = $eventsOnUserSubscriptionCreator; - $this->logger = $logger; - $this->mapCalendarToUser = $mapCalendarToUser; - $this->userRepository = $userRepository; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index 6625a7adb..de5f43102 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -25,13 +25,9 @@ use Symfony\Component\Console\Output\OutputInterface; class SendShortMessageOnEligibleCalendar extends Command { - private BulkCalendarShortMessageSender $messageSender; - - public function __construct(BulkCalendarShortMessageSender $messageSender) + public function __construct(private BulkCalendarShortMessageSender $messageSender) { parent::__construct(); - - $this->messageSender = $messageSender; } public function getName() diff --git a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php index 5891a7be8..882277c91 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php @@ -43,34 +43,15 @@ use function count; class SendTestShortMessageOnCalendarCommand extends Command { - private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder; - - private PersonRepository $personRepository; - - private PhoneNumberHelperInterface $phoneNumberHelper; - - private PhoneNumberUtil $phoneNumberUtil; - - private ShortMessageTransporterInterface $transporter; - - private UserRepositoryInterface $userRepository; - public function __construct( - PersonRepository $personRepository, - PhoneNumberUtil $phoneNumberUtil, - PhoneNumberHelperInterface $phoneNumberHelper, - ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder, - ShortMessageTransporterInterface $transporter, - UserRepositoryInterface $userRepository + private PersonRepository $personRepository, + private PhoneNumberUtil $phoneNumberUtil, + private PhoneNumberHelperInterface $phoneNumberHelper, + private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder, + private ShortMessageTransporterInterface $transporter, + private UserRepositoryInterface $userRepository ) { parent::__construct(); - - $this->personRepository = $personRepository; - $this->phoneNumberUtil = $phoneNumberUtil; - $this->phoneNumberHelper = $phoneNumberHelper; - $this->messageForCalendarBuilder = $messageForCalendarBuilder; - $this->transporter = $transporter; - $this->userRepository = $userRepository; } public function getName() diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index 8e0e8099c..b426dabd8 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -24,11 +24,8 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarAPIController extends ApiController { - private CalendarRepository $calendarRepository; - - public function __construct(CalendarRepository $calendarRepository) + public function __construct(private CalendarRepository $calendarRepository) { - $this->calendarRepository = $calendarRepository; } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index eed693451..34481facb 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -49,56 +49,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CalendarController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository; - - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private FilterOrderHelperFactoryInterface $filterOrderHelperFactory; - - private LoggerInterface $logger; - - private PaginatorFactory $paginator; - - private PersonRepository $personRepository; - - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - private SerializerInterface $serializer; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - private UserRepositoryInterface $userRepository; - - public function __construct( - CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - FilterOrderHelperFactoryInterface $filterOrderHelperFactory, - LoggerInterface $logger, - PaginatorFactory $paginator, - RemoteCalendarConnectorInterface $remoteCalendarConnector, - SerializerInterface $serializer, - TranslatableStringHelperInterface $translatableStringHelper, - PersonRepository $personRepository, - AccompanyingPeriodRepository $accompanyingPeriodRepository, - UserRepositoryInterface $userRepository, - TranslatorInterface $translator - ) { - $this->calendarACLAwareRepository = $calendarACLAwareRepository; - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->filterOrderHelperFactory = $filterOrderHelperFactory; - $this->logger = $logger; - $this->paginator = $paginator; - $this->remoteCalendarConnector = $remoteCalendarConnector; - $this->serializer = $serializer; - $this->translatableStringHelper = $translatableStringHelper; - $this->personRepository = $personRepository; - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->userRepository = $userRepository; - $this->translator = $translator; + public function __construct(private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private LoggerInterface $logger, private PaginatorFactory $paginator, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer, private TranslatableStringHelperInterface $translatableStringHelper, private PersonRepository $personRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private UserRepositoryInterface $userRepository, private TranslatorInterface $translator) + { } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index d02e55f32..16d1c942c 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -33,34 +33,10 @@ use UnexpectedValueException; class CalendarDocController { - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private EngineInterface $engine; - - private EntityManagerInterface $entityManager; - - private FormFactoryInterface $formFactory; - - private Security $security; - private SerializerInterface $serializer; - private UrlGeneratorInterface $urlGenerator; - - public function __construct( - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - EngineInterface $engine, - EntityManagerInterface $entityManager, - FormFactoryInterface $formFactory, - Security $security, - UrlGeneratorInterface $urlGenerator - ) { - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->engine = $engine; - $this->entityManager = $entityManager; - $this->formFactory = $formFactory; - $this->security = $security; - $this->urlGenerator = $urlGenerator; + public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EngineInterface $engine, private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator) + { } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 383e24efc..1b967a9ee 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -25,11 +25,8 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarRangeAPIController extends ApiController { - private CalendarRangeRepository $calendarRangeRepository; - - public function __construct(CalendarRangeRepository $calendarRangeRepository) + public function __construct(private CalendarRangeRepository $calendarRangeRepository) { - $this->calendarRangeRepository = $calendarRangeRepository; } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 3016e1660..6e4930cdb 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -35,17 +35,8 @@ use function in_array; class InviteApiController { - private EntityManagerInterface $entityManager; - - private MessageBusInterface $messageBus; - - private Security $security; - - public function __construct(EntityManagerInterface $entityManager, MessageBusInterface $messageBus, Security $security) + public function __construct(private EntityManagerInterface $entityManager, private MessageBusInterface $messageBus, private Security $security) { - $this->entityManager = $entityManager; - $this->messageBus = $messageBus; - $this->security = $security; } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index 9352e42fa..d10b5d41a 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -30,16 +30,8 @@ use TheNetworg\OAuth2\Client\Token\AccessToken; class RemoteCalendarConnectAzureController { - private ClientRegistry $clientRegistry; - - private OnBehalfOfUserTokenStorage $MSGraphTokenStorage; - - public function __construct( - ClientRegistry $clientRegistry, - OnBehalfOfUserTokenStorage $MSGraphTokenStorage - ) { - $this->clientRegistry = $clientRegistry; - $this->MSGraphTokenStorage = $MSGraphTokenStorage; + public function __construct(private ClientRegistry $clientRegistry, private OnBehalfOfUserTokenStorage $MSGraphTokenStorage) + { } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index 535dda2f5..33e549b37 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -29,11 +29,8 @@ use const JSON_THROW_ON_ERROR; class RemoteCalendarMSGraphSyncController { - private MessageBusInterface $messageBus; - - public function __construct(MessageBusInterface $messageBus) + public function __construct(private MessageBusInterface $messageBus) { - $this->messageBus = $messageBus; } /** diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index a95aa1a3f..a2143922f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -36,17 +36,8 @@ use function count; */ class RemoteCalendarProxyController { - private PaginatorFactory $paginatorFactory; - - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - private SerializerInterface $serializer; - - public function __construct(PaginatorFactory $paginatorFactory, RemoteCalendarConnectorInterface $remoteCalendarConnector, SerializerInterface $serializer) + public function __construct(private PaginatorFactory $paginatorFactory, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer) { - $this->paginatorFactory = $paginatorFactory; - $this->remoteCalendarConnector = $remoteCalendarConnector; - $this->serializer = $serializer; } /** diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php index 805386669..493a97dec 100644 --- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php @@ -29,12 +29,8 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere { public static array $references = []; - private UserRepository $userRepository; - - public function __construct( - UserRepository $userRepository - ) { - $this->userRepository = $userRepository; + public function __construct(private UserRepository $userRepository) + { } public static function getGroups(): array diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 79219a6e0..dc98c47d9 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -317,16 +317,11 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente public function getCenters(): ?iterable { - switch ($this->getContext()) { - case 'person': - return [$this->getPerson()->getCenter()]; - - case 'accompanying_period': - return $this->getAccompanyingPeriod()->getCenters(); - - default: - throw new LogicException('context not supported: ' . $this->getContext()); - } + return match ($this->getContext()) { + 'person' => [$this->getPerson()->getCenter()], + 'accompanying_period' => $this->getAccompanyingPeriod()->getCenters(), + default => throw new LogicException('context not supported: ' . $this->getContext()), + }; } public function getComment(): CommentEmbeddable diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php index 7012b64e0..763488560 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc.php @@ -50,22 +50,18 @@ class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface */ private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}) - * @ORM\JoinColumn(nullable=false) - */ - private ?StoredObject $storedObject; - /** * @ORM\Column(type="boolean", nullable=false, options={"default": false}) */ private bool $trackDateTimeVersion = false; - public function __construct(Calendar $calendar, ?StoredObject $storedObject) + public function __construct(Calendar $calendar, /** + * @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"}) + * @ORM\JoinColumn(nullable=false) + */ + private ?\Chill\DocStoreBundle\Entity\StoredObject $storedObject) { $this->setCalendar($calendar); - - $this->storedObject = $storedObject; $this->datetimeVersion = $calendar->getDateTimeVersion(); } diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index 298a1ef9a..b781615ef 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -19,11 +19,8 @@ use function array_key_exists; class ListenToActivityCreate { - private RequestStack $requestStack; - - public function __construct(RequestStack $requestStack) + public function __construct(private RequestStack $requestStack) { - $this->requestStack = $requestStack; } public function postPersist(Activity $activity, LifecycleEventArgs $event): void diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index e1de9f399..bc76dc021 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -22,16 +22,8 @@ use function in_array; final class AgentAggregator implements AggregatorInterface { - private UserRender $userRender; - - private UserRepository $userRepository; - - public function __construct( - UserRepository $userRepository, - UserRender $userRender - ) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; + public function __construct(private UserRepository $userRepository, private UserRender $userRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 611cb6d79..051150378 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -22,16 +22,8 @@ use function in_array; class CancelReasonAggregator implements AggregatorInterface { - private CancelReasonRepository $cancelReasonRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - CancelReasonRepository $cancelReasonRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->cancelReasonRepository = $cancelReasonRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private CancelReasonRepository $cancelReasonRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index 23292a5b0..dbda0ad61 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -22,16 +22,8 @@ use function in_array; final class JobAggregator implements AggregatorInterface { - private UserJobRepository $jobRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - UserJobRepository $jobRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->jobRepository = $jobRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index 940000f47..954175935 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -21,12 +21,8 @@ use function in_array; final class LocationAggregator implements AggregatorInterface { - private LocationRepository $locationRepository; - - public function __construct( - LocationRepository $locationRepository - ) { - $this->locationRepository = $locationRepository; + public function __construct(private LocationRepository $locationRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 6574e3934..489bda8cb 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -22,16 +22,8 @@ use function in_array; final class LocationTypeAggregator implements AggregatorInterface { - private LocationTypeRepository $locationTypeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - LocationTypeRepository $locationTypeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->locationTypeRepository = $locationTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 3aff3e0d8..6f72648e0 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -22,16 +22,8 @@ use function in_array; final class ScopeAggregator implements AggregatorInterface { - private ScopeRepository $scopeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ScopeRepository $scopeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index ad5910461..c7b03a146 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -28,12 +28,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UrgencyAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string @@ -64,16 +60,11 @@ class UrgencyAggregator implements AggregatorInterface return 'Urgency'; } - switch ($value) { - case true: - return $this->translator->trans('is urgent'); - - case false: - return $this->translator->trans('is not urgent'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + true => $this->translator->trans('is urgent'), + false => $this->translator->trans('is not urgent'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index 9d3f00f99..50367ece7 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -25,11 +25,8 @@ use Symfony\Component\Validator\Exception\LogicException; class CountCalendars implements ExportInterface, GroupedExportInterface { - private CalendarRepository $calendarRepository; - - public function __construct(CalendarRepository $calendarRepository) + public function __construct(private CalendarRepository $calendarRepository) { - $this->calendarRepository = $calendarRepository; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php index 14dd42d6b..68ab4fdd3 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php @@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { - private CalendarRepository $calendarRepository; - - public function __construct( - CalendarRepository $calendarRepository - ) { - $this->calendarRepository = $calendarRepository; + public function __construct(private CalendarRepository $calendarRepository) + { } public function buildForm(FormBuilderInterface $builder): void diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php index 1d31bfa26..fe94cc4e0 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php @@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { - private CalendarRepository $calendarRepository; - - public function __construct( - CalendarRepository $calendarRepository - ) { - $this->calendarRepository = $calendarRepository; + public function __construct(private CalendarRepository $calendarRepository) + { } public function buildForm(FormBuilderInterface $builder): void diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index b58cee594..6ae9d8236 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class AgentFilter implements FilterInterface { - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index 59019ac03..9a316208c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface; class BetweenDatesFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index d6c38e163..6795457d9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -35,11 +35,8 @@ class CalendarRangeFilter implements FilterInterface private const DEFAULT_CHOICE = false; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 69fb24447..47482c732 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -24,16 +24,8 @@ use function in_array; class JobFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper - ) { - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 08d9ae023..80cbdec37 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -24,16 +24,8 @@ use function in_array; class ScopeFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper - ) { - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index a2d15484f..e54517ef3 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -32,32 +32,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CalendarType extends AbstractType { - private IdToCalendarRangeDataTransformer $calendarRangeDataTransformer; - - private IdToLocationDataTransformer $idToLocationDataTransformer; - - private IdToUserDataTransformer $idToUserDataTransformer; - - private IdToUsersDataTransformer $idToUsersDataTransformer; - - private ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer; - - private PersonsToIdDataTransformer $personsToIdDataTransformer; - - public function __construct( - PersonsToIdDataTransformer $personsToIdDataTransformer, - IdToUserDataTransformer $idToUserDataTransformer, - IdToUsersDataTransformer $idToUsersDataTransformer, - IdToLocationDataTransformer $idToLocationDataTransformer, - ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, - IdToCalendarRangeDataTransformer $idToCalendarRangeDataTransformer - ) { - $this->personsToIdDataTransformer = $personsToIdDataTransformer; - $this->idToUserDataTransformer = $idToUserDataTransformer; - $this->idToUsersDataTransformer = $idToUsersDataTransformer; - $this->idToLocationDataTransformer = $idToLocationDataTransformer; - $this->partiesToIdDataTransformer = $partiesToIdDataTransformer; - $this->calendarRangeDataTransformer = $idToCalendarRangeDataTransformer; + public function __construct(private PersonsToIdDataTransformer $personsToIdDataTransformer, private IdToUserDataTransformer $idToUserDataTransformer, private IdToUsersDataTransformer $idToUsersDataTransformer, private IdToLocationDataTransformer $idToLocationDataTransformer, private ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private IdToCalendarRangeDataTransformer $calendarRangeDataTransformer) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php index 4b9dca19f..a81fbdedd 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -19,16 +19,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - protected TranslatorInterface $translator; - - private Security $security; - - public function __construct( - Security $security, - TranslatorInterface $translator - ) { - $this->security = $security; - $this->translator = $translator; + public function __construct(private Security $security, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php index eccbe1ffb..fb1a60a7b 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php @@ -19,16 +19,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - protected TranslatorInterface $translator; - - private Security $security; - - public function __construct( - Security $security, - TranslatorInterface $translator - ) { - $this->security = $security; - $this->translator = $translator; + public function __construct(private Security $security, protected TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php index 525039910..f8c804519 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php @@ -18,16 +18,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public TranslatorInterface $translator; - - private Security $security; - - public function __construct( - Security $security, - TranslatorInterface $translator - ) { - $this->security = $security; - $this->translator = $translator; + public function __construct(private Security $security, public TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php index f97cbc7b2..d940cbeca 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php @@ -30,14 +30,8 @@ use Symfony\Component\Security\Core\Security; class CalendarEntityListener { - private MessageBusInterface $messageBus; - - private Security $security; - - public function __construct(MessageBusInterface $messageBus, Security $security) + public function __construct(private MessageBusInterface $messageBus, private Security $security) { - $this->messageBus = $messageBus; - $this->security = $security; } public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php index 4df548277..cb3d9a763 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php @@ -30,14 +30,8 @@ use Symfony\Component\Security\Core\Security; class CalendarRangeEntityListener { - private MessageBusInterface $messageBus; - - private Security $security; - - public function __construct(MessageBusInterface $messageBus, Security $security) + public function __construct(private MessageBusInterface $messageBus, private Security $security) { - $this->messageBus = $messageBus; - $this->security = $security; } public function postPersist(CalendarRange $calendarRange, PostPersistEventArgs $eventArgs): void diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php index 4e3ae5891..b814d4cb8 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php @@ -31,14 +31,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface { - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - private UserRepository $userRepository; - - public function __construct(RemoteCalendarConnectorInterface $remoteCalendarConnector, UserRepository $userRepository) + public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private UserRepository $userRepository) { - $this->remoteCalendarConnector = $remoteCalendarConnector; - $this->userRepository = $userRepository; } public function __invoke(CalendarRangeRemovedMessage $calendarRangeRemovedMessage) diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php index 79bcd24ee..b94ab6d9d 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php @@ -32,20 +32,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeToRemoteHandler implements MessageHandlerInterface { - private CalendarRangeRepository $calendarRangeRepository; - - private EntityManagerInterface $entityManager; - - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - public function __construct( - CalendarRangeRepository $calendarRangeRepository, - RemoteCalendarConnectorInterface $remoteCalendarConnector, - EntityManagerInterface $entityManager - ) { - $this->calendarRangeRepository = $calendarRangeRepository; - $this->remoteCalendarConnector = $remoteCalendarConnector; - $this->entityManager = $entityManager; + public function __construct(private CalendarRangeRepository $calendarRangeRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private EntityManagerInterface $entityManager) + { } public function __invoke(CalendarRangeMessage $calendarRangeMessage): void diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php index f087766ec..ccc8d0a06 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php @@ -31,17 +31,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRemoveHandler implements MessageHandlerInterface { - private CalendarRangeRepository $calendarRangeRepository; - - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - private UserRepositoryInterface $userRepository; - - public function __construct(RemoteCalendarConnectorInterface $remoteCalendarConnector, CalendarRangeRepository $calendarRangeRepository, UserRepositoryInterface $userRepository) + public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private CalendarRangeRepository $calendarRangeRepository, private UserRepositoryInterface $userRepository) { - $this->remoteCalendarConnector = $remoteCalendarConnector; - $this->calendarRangeRepository = $calendarRangeRepository; - $this->userRepository = $userRepository; } public function __invoke(CalendarRemovedMessage $message) diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php index eabdf9063..2698921fc 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php @@ -37,32 +37,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarToRemoteHandler implements MessageHandlerInterface { - private RemoteCalendarConnectorInterface $calendarConnector; - - private CalendarRangeRepository $calendarRangeRepository; - - private CalendarRepository $calendarRepository; - - private EntityManagerInterface $entityManager; - - private InviteRepository $inviteRepository; - - private UserRepository $userRepository; - - public function __construct( - CalendarRangeRepository $calendarRangeRepository, - CalendarRepository $calendarRepository, - EntityManagerInterface $entityManager, - InviteRepository $inviteRepository, - RemoteCalendarConnectorInterface $calendarConnector, - UserRepository $userRepository - ) { - $this->calendarConnector = $calendarConnector; - $this->calendarRepository = $calendarRepository; - $this->calendarRangeRepository = $calendarRangeRepository; - $this->entityManager = $entityManager; - $this->userRepository = $userRepository; - $this->inviteRepository = $inviteRepository; + public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRepository $calendarRepository, private EntityManagerInterface $entityManager, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $calendarConnector, private UserRepository $userRepository) + { } public function __invoke(CalendarMessage $calendarMessage) diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php index e1df3ac3d..b917a13ae 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php @@ -31,17 +31,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class InviteUpdateHandler implements MessageHandlerInterface { - private EntityManagerInterface $em; - - private InviteRepository $inviteRepository; - - private RemoteCalendarConnectorInterface $remoteCalendarConnector; - - public function __construct(EntityManagerInterface $em, InviteRepository $inviteRepository, RemoteCalendarConnectorInterface $remoteCalendarConnector) + public function __construct(private EntityManagerInterface $em, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector) { - $this->em = $em; - $this->inviteRepository = $inviteRepository; - $this->remoteCalendarConnector = $remoteCalendarConnector; } public function __invoke(InviteUpdateMessage $inviteUpdateMessage): void diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php index a09c70c1e..f6debd2d5 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php @@ -36,40 +36,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class MSGraphChangeNotificationHandler implements MessageHandlerInterface { - private CalendarRangeRepository $calendarRangeRepository; - - private CalendarRangeSyncer $calendarRangeSyncer; - - private CalendarRepository $calendarRepository; - - private CalendarSyncer $calendarSyncer; - - private EntityManagerInterface $em; - - private LoggerInterface $logger; - - private MapCalendarToUser $mapCalendarToUser; - - private UserRepository $userRepository; - - public function __construct( - CalendarRangeRepository $calendarRangeRepository, - CalendarRangeSyncer $calendarRangeSyncer, - CalendarRepository $calendarRepository, - CalendarSyncer $calendarSyncer, - EntityManagerInterface $em, - LoggerInterface $logger, - MapCalendarToUser $mapCalendarToUser, - UserRepository $userRepository - ) { - $this->calendarRangeRepository = $calendarRangeRepository; - $this->calendarRangeSyncer = $calendarRangeSyncer; - $this->calendarRepository = $calendarRepository; - $this->calendarSyncer = $calendarSyncer; - $this->em = $em; - $this->logger = $logger; - $this->mapCalendarToUser = $mapCalendarToUser; - $this->userRepository = $userRepository; + public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRangeSyncer $calendarRangeSyncer, private CalendarRepository $calendarRepository, private CalendarSyncer $calendarSyncer, private EntityManagerInterface $em, private LoggerInterface $logger, private MapCalendarToUser $mapCalendarToUser, private UserRepository $userRepository) + { } public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php index c8a8f8aeb..53b20e49e 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php @@ -28,8 +28,6 @@ class CalendarMessage public const CALENDAR_UPDATE = 'CHILL_CALENDAR_CALENDAR_UPDATE'; - private string $action; - private int $byUserId; private int $calendarId; @@ -47,12 +45,11 @@ class CalendarMessage public function __construct( Calendar $calendar, - string $action, + private string $action, User $byUser ) { $this->calendarId = $calendar->getId(); $this->byUserId = $byUser->getId(); - $this->action = $action; $this->previousCalendarRangeId = null !== $calendar->previousCalendarRange ? $calendar->previousCalendarRange->getId() : null; $this->previousMainUserId = null !== $calendar->previousMainUser ? diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php index 526826ff8..61d006a79 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php @@ -27,15 +27,12 @@ class CalendarRangeMessage public const CALENDAR_RANGE_UPDATE = 'CHILL_CALENDAR_CALENDAR_RANGE_UPDATE'; - private string $action; - private ?int $byUserId = null; private int $calendarRangeId; - public function __construct(CalendarRange $calendarRange, string $action, ?User $byUser) + public function __construct(CalendarRange $calendarRange, private string $action, ?User $byUser) { - $this->action = $action; $this->calendarRangeId = $calendarRange->getId(); if (null !== $byUser) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php index f1d3b6b04..8288787cb 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php @@ -20,14 +20,8 @@ namespace Chill\CalendarBundle\Messenger\Message; class MSGraphChangeNotificationMessage { - private array $content; - - private int $userId; - - public function __construct(array $content, int $userId) + public function __construct(private array $content, private int $userId) { - $this->content = $content; - $this->userId = $userId; } public function getContent(): array diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php index 8b86ba0ec..05f116c6b 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php @@ -24,14 +24,8 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; class AddressConverter { - private AddressRender $addressRender; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(AddressRender $addressRender, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private AddressRender $addressRender, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->addressRender = $addressRender; - $this->translatableStringHelper = $translatableStringHelper; } public function addressToRemote(Address $address): array diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php index c400b6694..3bbe22161 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php @@ -30,24 +30,8 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; */ class EventsOnUserSubscriptionCreator { - private LoggerInterface $logger; - - private MachineHttpClient $machineHttpClient; - - private MapCalendarToUser $mapCalendarToUser; - - private UrlGeneratorInterface $urlGenerator; - - public function __construct( - LoggerInterface $logger, - MachineHttpClient $machineHttpClient, - MapCalendarToUser $mapCalendarToUser, - UrlGeneratorInterface $urlGenerator - ) { - $this->logger = $logger; - $this->machineHttpClient = $machineHttpClient; - $this->mapCalendarToUser = $mapCalendarToUser; - $this->urlGenerator = $urlGenerator; + public function __construct(private LoggerInterface $logger, private MachineHttpClient $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private UrlGeneratorInterface $urlGenerator) + { } /** diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php index 396dfd931..5de500b52 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php @@ -22,11 +22,8 @@ use Chill\MainBundle\Entity\Location; class LocationConverter { - private AddressConverter $addressConverter; - - public function __construct(AddressConverter $addressConverter) + public function __construct(private AddressConverter $addressConverter) { - $this->addressConverter = $addressConverter; } public function locationToRemote(Location $location): array diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php index c523a1e92..39fbf6c15 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php @@ -42,11 +42,8 @@ class MSGraphUserRepository ; SQL; - private EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; } public function countByMostOldSubscriptionOrWithoutSubscriptionOrData(DateInterval $interval): int diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php index cc1692fb7..8a3f37678 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php @@ -30,15 +30,12 @@ class MachineHttpClient implements HttpClientInterface private HttpClientInterface $decoratedClient; - private MachineTokenStorage $machineTokenStorage; - /** * @param HttpClientInterface $decoratedClient */ - public function __construct(MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null) + public function __construct(private MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); - $this->machineTokenStorage = $machineTokenStorage; } /** diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php index ac62d44ac..ad7060c1a 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php @@ -29,14 +29,8 @@ class MachineTokenStorage private ?AccessTokenInterface $accessToken = null; - private Azure $azure; - - private ChillRedis $chillRedis; - - public function __construct(Azure $azure, ChillRedis $chillRedis) + public function __construct(private Azure $azure, private ChillRedis $chillRedis) { - $this->azure = $azure; - $this->chillRedis = $chillRedis; } public function getToken(): AccessTokenInterface diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index 563bd3a38..6fcc9d20f 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -39,16 +39,8 @@ class MapCalendarToUser public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret'; - private LoggerInterface $logger; - - private HttpClientInterface $machineHttpClient; - - public function __construct( - HttpClientInterface $machineHttpClient, - LoggerInterface $logger - ) { - $this->machineHttpClient = $machineHttpClient; - $this->logger = $logger; + public function __construct(private HttpClientInterface $machineHttpClient, private LoggerInterface $logger) + { } public function getActiveSubscriptionId(User $user): string diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php index 9777bf4c0..70a7f1ca0 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php @@ -30,15 +30,12 @@ class OnBehalfOfUserHttpClient private HttpClientInterface $decoratedClient; - private OnBehalfOfUserTokenStorage $tokenStorage; - /** * @param HttpClientInterface $decoratedClient */ - public function __construct(OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null) + public function __construct(private OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); - $this->tokenStorage = $tokenStorage; } public function request(string $method, string $url, array $options = []): ResponseInterface diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php index 28f68e0e9..6bb171248 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php @@ -30,14 +30,8 @@ class OnBehalfOfUserTokenStorage { public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token'; - private Azure $azure; - - private SessionInterface $session; - - public function __construct(Azure $azure, SessionInterface $session) + public function __construct(private Azure $azure, private SessionInterface $session) { - $this->azure = $azure; - $this->session = $session; } public function getToken(): AccessToken diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php index 176dbe0b0..9d96357cd 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php @@ -54,30 +54,15 @@ class RemoteEventConverter private DateTimeZone $defaultDateTimeZone; - private EngineInterface $engine; - - private LocationConverter $locationConverter; - - private LoggerInterface $logger; - - private PersonRenderInterface $personRender; - private DateTimeZone $remoteDateTimeZone; - private TranslatorInterface $translator; - public function __construct( - EngineInterface $engine, - LocationConverter $locationConverter, - LoggerInterface $logger, - PersonRenderInterface $personRender, - TranslatorInterface $translator + private EngineInterface $engine, + private LocationConverter $locationConverter, + private LoggerInterface $logger, + private PersonRenderInterface $personRender, + private TranslatorInterface $translator ) { - $this->engine = $engine; - $this->locationConverter = $locationConverter; - $this->logger = $logger; - $this->translator = $translator; - $this->personRender = $personRender; $this->defaultDateTimeZone = (new DateTimeImmutable())->getTimezone(); $this->remoteDateTimeZone = self::getRemoteTimeZone(); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php index d05adfed7..add82d5d9 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php @@ -30,23 +30,11 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class CalendarRangeSyncer { - private EntityManagerInterface $em; - - private LoggerInterface $logger; - - private HttpClientInterface $machineHttpClient; - /** * @param MachineHttpClient $machineHttpClient */ - public function __construct( - EntityManagerInterface $em, - LoggerInterface $logger, - HttpClientInterface $machineHttpClient - ) { - $this->em = $em; - $this->logger = $logger; - $this->machineHttpClient = $machineHttpClient; + public function __construct(private EntityManagerInterface $em, private LoggerInterface $logger, private HttpClientInterface $machineHttpClient) + { } public function handleCalendarRangeSync(CalendarRange $calendarRange, array $notification, User $user): void diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php index b3febf4d4..7767c0a8b 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php @@ -32,35 +32,17 @@ use function in_array; class CalendarSyncer { - private LoggerInterface $logger; - - private HttpClientInterface $machineHttpClient; - - private UserRepositoryInterface $userRepository; - - public function __construct(LoggerInterface $logger, HttpClientInterface $machineHttpClient, UserRepositoryInterface $userRepository) + public function __construct(private LoggerInterface $logger, private HttpClientInterface $machineHttpClient, private UserRepositoryInterface $userRepository) { - $this->logger = $logger; - $this->machineHttpClient = $machineHttpClient; - $this->userRepository = $userRepository; } public function handleCalendarSync(Calendar $calendar, array $notification, User $user): void { - switch ($notification['changeType']) { - case 'deleted': - $this->handleDeleteCalendar($calendar, $notification, $user); - - break; - - case 'updated': - $this->handleUpdateCalendar($calendar, $notification, $user); - - break; - - default: - throw new RuntimeException('this change type is not supported: ' . $notification['changeType']); - } + match ($notification['changeType']) { + 'deleted' => $this->handleDeleteCalendar($calendar, $notification, $user), + 'updated' => $this->handleUpdateCalendar($calendar, $notification, $user), + default => throw new RuntimeException('this change type is not supported: ' . $notification['changeType']), + }; } private function handleDeleteCalendar(Calendar $calendar, array $notification, User $user): void @@ -150,34 +132,13 @@ class CalendarSyncer $invite = $calendar->getInviteForUser($user); - switch ($status) { - // possible cases: none, organizer, tentativelyAccepted, accepted, declined, notResponded. - case 'none': - case 'notResponded': - $invite->setStatus(Invite::PENDING); - - break; - - case 'tentativelyAccepted': - $invite->setStatus(Invite::TENTATIVELY_ACCEPTED); - - break; - - case 'accepted': - $invite->setStatus(Invite::ACCEPTED); - - break; - - case 'declined': - $invite->setStatus(Invite::DECLINED); - - break; - - default: - throw new LogicException('should not happens, not implemented: ' . $status); - - break; - } + match ($status) { + 'none', 'notResponded' => $invite->setStatus(Invite::PENDING), + 'tentativelyAccepted' => $invite->setStatus(Invite::TENTATIVELY_ACCEPTED), + 'accepted' => $invite->setStatus(Invite::ACCEPTED), + 'declined' => $invite->setStatus(Invite::DECLINED), + default => throw new LogicException('should not happens, not implemented: ' . $status), + }; } foreach ($calendar->getUsers() as $user) { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 0e3beff5f..9d6dcd65c 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -45,52 +45,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface { private array $cacheScheduleTimeForUser = []; - private CalendarRangeRepository $calendarRangeRepository; - - private CalendarRepository $calendarRepository; - - private LoggerInterface $logger; - - private HttpClientInterface $machineHttpClient; - - private MapCalendarToUser $mapCalendarToUser; - - private RemoteEventConverter $remoteEventConverter; - - private OnBehalfOfUserTokenStorage $tokenStorage; - - private TranslatorInterface $translator; - - private UrlGeneratorInterface $urlGenerator; - - private OnBehalfOfUserHttpClient $userHttpClient; - - private Security $security; - - public function __construct( - CalendarRepository $calendarRepository, - CalendarRangeRepository $calendarRangeRepository, - HttpClientInterface $machineHttpClient, - MapCalendarToUser $mapCalendarToUser, - LoggerInterface $logger, - OnBehalfOfUserTokenStorage $tokenStorage, - OnBehalfOfUserHttpClient $userHttpClient, - RemoteEventConverter $remoteEventConverter, - TranslatorInterface $translator, - UrlGeneratorInterface $urlGenerator, - Security $security - ) { - $this->calendarRepository = $calendarRepository; - $this->calendarRangeRepository = $calendarRangeRepository; - $this->machineHttpClient = $machineHttpClient; - $this->mapCalendarToUser = $mapCalendarToUser; - $this->logger = $logger; - $this->remoteEventConverter = $remoteEventConverter; - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; - $this->urlGenerator = $urlGenerator; - $this->userHttpClient = $userHttpClient; - $this->security = $security; + public function __construct(private CalendarRepository $calendarRepository, private CalendarRangeRepository $calendarRangeRepository, private HttpClientInterface $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private LoggerInterface $logger, private OnBehalfOfUserTokenStorage $tokenStorage, private OnBehalfOfUserHttpClient $userHttpClient, private RemoteEventConverter $remoteEventConverter, private TranslatorInterface $translator, private UrlGeneratorInterface $urlGenerator, private Security $security) + { } public function countEventsForUser(User $user, DateTimeImmutable $startDate, DateTimeImmutable $endDate): int @@ -685,7 +641,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface 'DELETE', 'users/' . $userId . '/calendar/events/' . $remoteId ); - } catch (ClientExceptionInterface $e) { + } catch (ClientExceptionInterface) { $this->logger->warning('could not remove event from calendar', [ 'event_remote_id' => $remoteId, 'user_id' => $user->getId(), diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php index 13c4a1c6a..fb914d693 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php @@ -23,40 +23,28 @@ use Symfony\Component\Serializer\Annotation as Serializer; class RemoteEvent { - public string $description; - - /** - * @Serializer\Groups({"read"}) - */ - public DateTimeImmutable $endDate; - - /** - * @Serializer\Groups({"read"}) - */ - public string $id; - - /** - * @Serializer\Groups({"read"}) - */ - public bool $isAllDay; - - /** - * @Serializer\Groups({"read"}) - */ - public DateTimeImmutable $startDate; - - /** - * @Serializer\Groups({"read"}) - */ - public string $title; - - public function __construct(string $id, string $title, string $description, DateTimeImmutable $startDate, DateTimeImmutable $endDate, bool $isAllDay = false) - { - $this->id = $id; - $this->title = $title; - $this->description = $description; - $this->startDate = $startDate; - $this->endDate = $endDate; - $this->isAllDay = $isAllDay; + public function __construct( + /** + * @Serializer\Groups({"read"}) + */ + public string $id, + /** + * @Serializer\Groups({"read"}) + */ + public string $title, + public string $description, + /** + * @Serializer\Groups({"read"}) + */ + public DateTimeImmutable $startDate, + /** + * @Serializer\Groups({"read"}) + */ + public DateTimeImmutable $endDate, + /** + * @Serializer\Groups({"read"}) + */ + public bool $isAllDay = false + ) { } } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php index 7c6ef4e13..1fc5dd351 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php @@ -29,16 +29,8 @@ use Doctrine\ORM\QueryBuilder; class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface { - private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository; - - private EntityManagerInterface $em; - - public function __construct( - AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, - EntityManagerInterface $em - ) { - $this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository; - $this->em = $em; + public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EntityManagerInterface $em) + { } public function buildQueryByAccompanyingPeriod(AccompanyingPeriod $period, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate): QueryBuilder diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php index dc3405b7e..69a077e47 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php @@ -24,14 +24,11 @@ use function count; class CalendarRangeRepository implements ObjectRepository { - private EntityManagerInterface $em; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $em) { - $this->em = $entityManager; - $this->repository = $entityManager->getRepository(CalendarRange::class); + $this->repository = $em->getRepository(CalendarRange::class); } public function countByAvailableRangesForUser(User $user, DateTimeImmutable $from, DateTimeImmutable $to): int diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php index 452286e85..7cd815961 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php @@ -29,11 +29,8 @@ class CalendarDocVoter extends Voter 'CHILL_CALENDAR_DOC_SEE', ]; - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } protected function supports($attribute, $subject): bool @@ -47,15 +44,10 @@ class CalendarDocVoter extends Voter */ protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { - switch ($attribute) { - case self::EDIT: - return $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar()); - - case self::SEE: - return $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar()); - - default: - throw new UnexpectedValueException('Attribute not supported: ' . $attribute); - } + return match ($attribute) { + self::EDIT => $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar()), + self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar()), + default => throw new UnexpectedValueException('Attribute not supported: ' . $attribute), + }; } } diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php index 0e2be1d0f..faf6fb5c8 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php @@ -46,15 +46,12 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn private CenterResolverManagerInterface $centerResolverManager; - private Security $security; - private VoterHelperInterface $voterHelper; public function __construct( - Security $security, + private Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->security = $security; $this->voterHelper = $voterHelperFactory ->generate(self::class) ->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE]) diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index cabb7dcce..cb8bb5f7a 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -33,40 +33,8 @@ use function count; final class CalendarContext implements CalendarContextInterface { - private BaseContextData $baseContextData; - - private EntityManagerInterface $entityManager; - - private NormalizerInterface $normalizer; - - private PersonRender $personRender; - - private PersonRepository $personRepository; - - private ThirdPartyRepository $thirdPartyRepository; - - private ThirdPartyRender $thirdPartyRender; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - BaseContextData $baseContextData, - EntityManagerInterface $entityManager, - NormalizerInterface $normalizer, - PersonRender $personRender, - PersonRepository $personRepository, - ThirdPartyRender $thirdPartyRender, - ThirdPartyRepository $thirdPartyRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->baseContextData = $baseContextData; - $this->entityManager = $entityManager; - $this->normalizer = $normalizer; - $this->personRender = $personRender; - $this->personRepository = $personRepository; - $this->thirdPartyRender = $thirdPartyRender; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private BaseContextData $baseContextData, private EntityManagerInterface $entityManager, private NormalizerInterface $normalizer, private PersonRender $personRender, private PersonRepository $personRepository, private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php index 83826bbcf..f5fc86373 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php @@ -26,23 +26,8 @@ use Symfony\Component\Messenger\MessageBusInterface; class BulkCalendarShortMessageSender { - private EntityManagerInterface $em; - - private LoggerInterface $logger; - - private MessageBusInterface $messageBus; - - private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder; - - private CalendarForShortMessageProvider $provider; - - public function __construct(CalendarForShortMessageProvider $provider, EntityManagerInterface $em, LoggerInterface $logger, MessageBusInterface $messageBus, ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) + public function __construct(private CalendarForShortMessageProvider $provider, private EntityManagerInterface $em, private LoggerInterface $logger, private MessageBusInterface $messageBus, private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) { - $this->provider = $provider; - $this->em = $em; - $this->logger = $logger; - $this->messageBus = $messageBus; - $this->messageForCalendarBuilder = $messageForCalendarBuilder; } public function sendBulkMessageToEligibleCalendars() diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php index 2316a5408..a6a8134ae 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php @@ -26,20 +26,8 @@ use function count; class CalendarForShortMessageProvider { - private CalendarRepository $calendarRepository; - - private EntityManagerInterface $em; - - private RangeGeneratorInterface $rangeGenerator; - - public function __construct( - CalendarRepository $calendarRepository, - EntityManagerInterface $em, - RangeGeneratorInterface $rangeGenerator - ) { - $this->calendarRepository = $calendarRepository; - $this->em = $em; - $this->rangeGenerator = $rangeGenerator; + public function __construct(private CalendarRepository $calendarRepository, private EntityManagerInterface $em, private RangeGeneratorInterface $rangeGenerator) + { } /** diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php index cd61a8624..66de8781c 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php @@ -24,12 +24,8 @@ use Symfony\Component\Templating\EngineInterface; class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface { - private EngineInterface $engine; - - public function __construct( - EngineInterface $engine - ) { - $this->engine = $engine; + public function __construct(private EngineInterface $engine) + { } public function buildMessageForCalendar(Calendar $calendar): array diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index 2a03e90bb..739cc6c6e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -38,25 +38,6 @@ class CreateFieldsOnGroupCommand extends Command public const ARG_PATH = 'path'; - private $availableLanguages; - - /** - * @var CustomFieldProvider - */ - private $customFieldProvider; - - private $customizablesEntities; - - /** - * @var EntityManager - */ - private $entityManager; - - /** - * @var ValidatorInterface - */ - private $validator; - /** * CreateFieldsOnGroupCommand constructor. * @@ -64,17 +45,12 @@ class CreateFieldsOnGroupCommand extends Command * @param $customizablesEntities */ public function __construct( - CustomFieldProvider $customFieldProvider, - EntityManager $entityManager, - ValidatorInterface $validator, - $availableLanguages, - $customizablesEntities + private CustomFieldProvider $customFieldProvider, + private EntityManager $entityManager, + private ValidatorInterface $validator, + private $availableLanguages, + private $customizablesEntities ) { - $this->customFieldProvider = $customFieldProvider; - $this->entityManager = $entityManager; - $this->validator = $validator; - $this->availableLanguages = $availableLanguages; - $this->customizablesEntities = $customizablesEntities; parent::__construct(); } diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index 25e4d2359..bc7bcfd65 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -57,10 +57,8 @@ class CustomFieldController extends AbstractController /** * Displays a form to edit an existing CustomField entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -112,10 +110,8 @@ class CustomFieldController extends AbstractController * Finds and displays a CustomField entity. * * @deprecated is not used since there is no link to show action - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -131,10 +127,8 @@ class CustomFieldController extends AbstractController /** * Edits an existing CustomField entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -170,11 +164,10 @@ class CustomFieldController extends AbstractController * * @param CustomField $entity The entity * @param string - * @param mixed $type * * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(CustomField $entity, $type) + private function createCreateForm(CustomField $entity, mixed $type) { $form = $this->createForm(CustomFieldType::class, $entity, [ 'action' => $this->generateUrl( @@ -195,11 +188,10 @@ class CustomFieldController extends AbstractController * Creates a form to edit a CustomField entity. * * @param CustomField $entity The entity - * @param mixed $type * * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(CustomField $entity, $type) + private function createEditForm(CustomField $entity, mixed $type) { $form = $this->createForm(CustomFieldType::class, $entity, [ 'action' => $this->generateUrl('customfield_update', ['id' => $entity->getId()]), diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 4f180549a..68ccb9904 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -33,25 +33,11 @@ use function in_array; */ class CustomFieldsGroupController extends AbstractController { - /** - * @var CustomFieldProvider - */ - private $customfieldProvider; - - /** - * @var TranslatorInterface - */ - private $translator; - /** * CustomFieldsGroupController constructor. */ - public function __construct( - CustomFieldProvider $customFieldProvider, - TranslatorInterface $translator - ) { - $this->customfieldProvider = $customFieldProvider; - $this->translator = $translator; + public function __construct(private CustomFieldProvider $customfieldProvider, private TranslatorInterface $translator) + { } /** @@ -85,10 +71,8 @@ class CustomFieldsGroupController extends AbstractController /** * Displays a form to edit an existing CustomFieldsGroup entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -241,10 +225,8 @@ class CustomFieldsGroupController extends AbstractController /** * Finds and displays a CustomFieldsGroup entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -265,10 +247,8 @@ class CustomFieldsGroupController extends AbstractController /** * Edits an existing CustomFieldsGroup entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 781b2b233..88ef15e3e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -44,27 +44,18 @@ class CustomFieldChoice extends AbstractCustomField private $defaultLocales; - /** - * @var TwigEngine - */ - private $templating; - - /** - * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation - */ - private $translatableStringHelper; - /** * CustomFieldChoice constructor. */ public function __construct( TranslatorInterface $translator, - TwigEngine $templating, - TranslatableStringHelper $translatableStringHelper + private TwigEngine $templating, + /** + * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation + */ + private TranslatableStringHelper $translatableStringHelper ) { $this->defaultLocales = $translator->getFallbackLocales(); - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; } public function allowOtherChoice(CustomField $cf) @@ -228,7 +219,7 @@ class CustomFieldChoice extends AbstractCustomField * * @return bool */ - public function isChecked(CustomField $cf, $choiceSlug, $data) + public function isChecked(CustomField $cf, $choiceSlug, array|string $data) { if (null === $data) { return false; @@ -330,10 +321,9 @@ class CustomFieldChoice extends AbstractCustomField * deserialized the data from the database to a multiple * field. * - * @param mixed $serialized * @param bool $allowOther */ - private function deserializeToMultiple($serialized, $allowOther) + private function deserializeToMultiple(mixed $serialized, $allowOther) { $value = $this->guessValue($serialized); @@ -387,7 +377,7 @@ class CustomFieldChoice extends AbstractCustomField * * @return mixed */ - private function guessValue($value) + private function guessValue(array|string $value) { if (null === $value) { return null; diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php index 218bd5415..b8688efb1 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php @@ -44,20 +44,8 @@ class CustomFieldDate extends AbstractCustomField */ public const MIN = 'min'; - /** - * @var TwigEngine - */ - private $templating; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct(TwigEngine $templating, TranslatableStringHelper $translatableStringHelper) + public function __construct(private TwigEngine $templating, private TranslatableStringHelper $translatableStringHelper) { - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, CustomField $customField) @@ -82,7 +70,7 @@ class CustomFieldDate extends AbstractCustomField $validatorFunction = static function ($value, ExecutionContextInterface $context) { try { $date = new DateTime($value); - } catch (Exception $e) { + } catch (Exception) { $context->buildViolation('The expression "%expression%" is invalid', [ '%expression%' => $value, ]) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 75dc7792f..23f7b36bb 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -30,20 +30,8 @@ class CustomFieldLongChoice extends AbstractCustomField { public const KEY = 'key'; - private OptionRepository $optionRepository; - - private TwigEngine $templating; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - OptionRepository $optionRepository, - TranslatableStringHelper $translatableStringHelper, - TwigEngine $twigEngine - ) { - $this->optionRepository = $optionRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->templating = $twigEngine; + public function __construct(private OptionRepository $optionRepository, private TranslatableStringHelper $translatableStringHelper, private TwigEngine $templating) + { } public function buildForm(FormBuilderInterface $builder, CustomField $customField) @@ -130,7 +118,7 @@ class CustomFieldLongChoice extends AbstractCustomField if (!$value instanceof Option) { throw new LogicException('the value should be an instance of ' . 'Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option, ' - . is_object($value) ? get_class($value) : gettype($value) . ' given'); + . is_object($value) ? $value::class : gettype($value) . ' given'); } // we place the id in array, to allow in the future multiple select diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php index 82b35f9f5..7c0e17931 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php @@ -39,20 +39,8 @@ class CustomFieldNumber extends AbstractCustomField public const SCALE = 'scale'; - /** - * @var TwigEngine - */ - private $templating; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct(TwigEngine $templating, TranslatableStringHelper $translatableStringHelper) + public function __construct(private TwigEngine $templating, private TranslatableStringHelper $translatableStringHelper) { - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, CustomField $customField) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index 0a6efc2bc..389303906 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -29,26 +29,14 @@ class CustomFieldText extends AbstractCustomField public const MULTIPLE_CF_INLINE = 'multipleCFInline'; - private $requestStack; - - /** - * @var TwigEngine - */ - private $templating; - - /** - * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation - */ - private $translatableStringHelper; - public function __construct( - RequestStack $requestStack, - TwigEngine $templating, - TranslatableStringHelper $translatableStringHelper + private RequestStack $requestStack, + private TwigEngine $templating, + /** + * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation + */ + private TranslatableStringHelper $translatableStringHelper ) { - $this->requestStack = $requestStack; - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; } /** diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php index b22b84029..59114a4a5 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php @@ -27,26 +27,14 @@ class CustomFieldTitle extends AbstractCustomField public const TYPE_TITLE = 'title'; - private $requestStack; - - /** - * @var TwigEngine - */ - private $templating; - - /** - * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation - */ - private $translatableStringHelper; - public function __construct( - RequestStack $requestStack, - TwigEngine $templating, - TranslatableStringHelper $translatableStringHelper + private RequestStack $requestStack, + private TwigEngine $templating, + /** + * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation + */ + private TranslatableStringHelper $translatableStringHelper ) { - $this->requestStack = $requestStack; - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, CustomField $customField) diff --git a/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php b/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php index 4ef6e046d..e57473746 100644 --- a/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php +++ b/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php @@ -18,12 +18,10 @@ class OptionRepository extends EntityRepository { /** * @param string $key - * @param mixed $includeParents - * @param mixed $active * * @return Option[] */ - public function findFilteredByKey($key, $includeParents = true, $active = true) + public function findFilteredByKey($key, mixed $includeParents = true, mixed $active = true) { $qb = $this->createQueryBuilder('option'); $qb->where('option.key = :key'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php index 0630bccf5..df4e82d5b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php @@ -30,29 +30,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CustomFieldType extends AbstractType { - /** - * @var CustomFieldProvider - */ - private $customFieldProvider; - - /** - * @var ObjectManager - */ - private $om; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct( - CustomFieldProvider $compiler, - ObjectManager $om, - TranslatableStringHelper $translatableStringHelper - ) { - $this->customFieldProvider = $compiler; - $this->om = $om; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private CustomFieldProvider $customFieldProvider, private ObjectManager $om, private TranslatableStringHelper $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php index 8eda50464..e62e85c04 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php @@ -25,17 +25,11 @@ use function count; class CustomFieldsGroupType extends AbstractType { - private $customizableEntities; //TODO : add comment about this variable - - /** - * @var \Symfony\Component\Translation\TranslatorInterface - */ - private $translator; - - public function __construct(array $customizableEntities, TranslatorInterface $translator) - { - $this->customizableEntities = $customizableEntities; - $this->translator = $translator; + public function __construct( + private array $customizableEntities, + //TODO : add comment about this variable + private TranslatorInterface $translator + ) { } //TODO : details about the function diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php index cb626c214..f1df42ff7 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php @@ -17,19 +17,8 @@ use Symfony\Component\Form\DataTransformerInterface; class CustomFieldDataTransformer implements DataTransformerInterface { - /** - * @var \Chill\CustomFieldsBundle\Entity\CustomField - */ - private $customField; - - private $customFieldDefinition; - - public function __construct( - CustomFieldInterface $customFieldDefinition, - CustomField $customField - ) { - $this->customFieldDefinition = $customFieldDefinition; - $this->customField = $customField; + public function __construct(private CustomFieldInterface $customFieldDefinition, private CustomField $customField) + { } public function reverseTransform($value) diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index 8e41e0537..5cba21068 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -20,14 +20,8 @@ use function gettype; class CustomFieldsGroupToIdTransformer implements DataTransformerInterface { - /** - * @var ObjectManager - */ - private $om; - - public function __construct(ObjectManager $om) + public function __construct(private ObjectManager $om) { - $this->om = $om; } /** @@ -36,10 +30,8 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface * @param string $id * * @throws TransformationFailedException if object (report) is not found. - * - * @return CustomFieldsGroup|null */ - public function reverseTransform($id) + public function reverseTransform($id): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup { if (!$id) { return null; diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php index 2b34b498a..1ac3ace19 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php @@ -26,12 +26,8 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface { private array $customField; - private ObjectManager $om; - - public function __construct(ObjectManager $om) + public function __construct(private ObjectManager $om) { - $this->om = $om; - $customFields = $this->om ->getRepository(CustomField::class) ->findAll(); @@ -72,13 +68,13 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface if (array_key_exists($key, $this->customField)) { $type = $this->customField[$key]->getType(); - if (strpos($type, 'ManyToOne') === 0) { + if (str_starts_with($type, 'ManyToOne')) { // pour le manytoone() faire // un update du form en js ? : http://symfony.com/fr/doc/current/cookbook/form/form_collections.html // //$entityClass = substr($type, 10, -1); //echo $entityClasss; - if (strpos($type, 'ManyToOnePersist') === 0) { + if (str_starts_with($type, 'ManyToOnePersist')) { // PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien... // // @@ -127,8 +123,8 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface if (array_key_exists($key, $this->customField)) { $type = $this->customField[$key]->getType(); - if (strpos($type, 'ManyToOne') === 0) { - if (strpos($type, 'ManyToOnePersist') === 0) { + if (str_starts_with($type, 'ManyToOne')) { + if (str_starts_with($type, 'ManyToOnePersist')) { $entityClass = substr($type, 17, -1); } else { $entityClass = substr($type, 10, -1); diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php index 67ea171e6..93e969e1f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php @@ -24,14 +24,8 @@ class CustomFieldType extends AbstractType */ private $customFieldCompiler; - /** - * @var ObjectManager - */ - private $om; - - public function __construct(ObjectManager $om, CustomFieldProvider $compiler) + public function __construct(private ObjectManager $om, CustomFieldProvider $compiler) { - $this->om = $om; $this->customFieldCompiler = $compiler; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php index c8bf19481..5f87bbab0 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php @@ -46,14 +46,8 @@ class LinkedCustomFieldsType extends AbstractType */ private $options = []; - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct(TranslatableStringHelper $helper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $helper; } /** diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php index 9ffd836e6..be26cd6f3 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php +++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php @@ -22,15 +22,6 @@ use Doctrine\ORM\EntityManagerInterface; */ class CustomFieldsHelper { - /** - * @var EntityManagerInterface The entity manager - */ - private $em; - - /** @var CustomFieldProvider Provider of all the declared custom - * fields */ - private $provider; - /** * Constructor. * @@ -38,12 +29,8 @@ class CustomFieldsHelper * @param CustomFieldProvider $provider The customfield provider that * contains all the declared custom fields */ - public function __construct( - EntityManagerInterface $em, - CustomFieldProvider $provider - ) { - $this->em = $em; - $this->provider = $provider; + public function __construct(private EntityManagerInterface $em, private CustomFieldProvider $provider) + { } public function isEmptyValue(array $fields, CustomField $customField) diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php index ead01ee8f..021999b1d 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php @@ -31,11 +31,6 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa */ private $container; - /** - * @var CustomFieldsHelper - */ - private $customFieldsHelper; - /** * @var array The default parameters */ @@ -43,9 +38,8 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa 'label_layout' => 'ChillCustomFieldsBundle:CustomField:render_label.html.twig', ]; - public function __construct(CustomFieldsHelper $customFieldsHelper) + public function __construct(private CustomFieldsHelper $customFieldsHelper) { - $this->customFieldsHelper = $customFieldsHelper; } /** diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php index 5b905cb4d..68c41aded 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php @@ -400,7 +400,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase * * @param mixed $data deserialized data */ - public function testIsEmptyValueEmpty($data) + public function testIsEmptyValueEmpty(mixed $data) { $customField = $this->generateCustomField([ CustomFieldChoice::ALLOW_OTHER => false, @@ -417,14 +417,12 @@ final class CustomFieldsChoiceTest extends KernelTestCase // test function isEmptyValue // //////////////////////////////////////// - /** * test the not empty with the not-empty data provider. * - * @param mixed $data * @dataProvider serializedRepresentationDataProvider */ - public function testIsEmptyValueNotEmpty($data) + public function testIsEmptyValueNotEmpty(mixed $data) { $customField = $this->generateCustomField([ CustomFieldChoice::ALLOW_OTHER => false, diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php index f3b93c390..e9c461e06 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php @@ -99,12 +99,10 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase } /** - * @param mixed $slug - * @param mixed $name * * @return CustomField */ - private function getSimpleCustomFieldText($slug, $name) + private function getSimpleCustomFieldText(mixed $slug, mixed $name) { return (new CustomField()) ->setSlug($slug) diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php index 11fb58028..2e2c9a9fd 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php @@ -17,13 +17,10 @@ use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; final class ContextManager implements ContextManagerInterface { /** - * @var DocGeneratorContextInterface[]|iterable + * @param \Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface[] $contexts */ - private iterable $contexts; - - public function __construct(iterable $contexts) + public function __construct(private iterable $contexts) { - $this->contexts = $contexts; } public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/Exception/UnexpectedTypeException.php b/src/Bundle/ChillDocGeneratorBundle/Context/Exception/UnexpectedTypeException.php index 53d498eb9..8a6b000b3 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/Exception/UnexpectedTypeException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/Exception/UnexpectedTypeException.php @@ -21,6 +21,6 @@ class UnexpectedTypeException extends LogicException { public function __construct($value, string $expectedType) { - parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); + parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, get_debug_type($value))); } } diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index c365b5e06..58c2b4e57 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -22,11 +22,8 @@ use Symfony\Component\Routing\Annotation\Route; class AdminDocGeneratorTemplateController extends CRUDController { - private ContextManager $contextManager; - - public function __construct(ContextManager $contextManager) + public function __construct(private ContextManager $contextManager) { - $this->contextManager = $contextManager; } public function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []) diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index ef2d2d585..7ad660260 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -43,32 +43,8 @@ use const JSON_PRETTY_PRINT; final class DocGeneratorTemplateController extends AbstractController { - private ContextManager $contextManager; - - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private EntityManagerInterface $entityManager; - - private GeneratorInterface $generator; - - private MessageBusInterface $messageBus; - - private PaginatorFactory $paginatorFactory; - - public function __construct( - ContextManager $contextManager, - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - GeneratorInterface $generator, - MessageBusInterface $messageBus, - PaginatorFactory $paginatorFactory, - EntityManagerInterface $entityManager - ) { - $this->contextManager = $contextManager; - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->generator = $generator; - $this->messageBus = $messageBus; - $this->paginatorFactory = $paginatorFactory; - $this->entityManager = $entityManager; + public function __construct(private ContextManager $contextManager, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private GeneratorInterface $generator, private MessageBusInterface $messageBus, private PaginatorFactory $paginatorFactory, private EntityManagerInterface $entityManager) + { } /** diff --git a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php index 5b4a8be30..a92dc67f2 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php +++ b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php @@ -24,11 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class DocGeneratorTemplateType extends AbstractType { - private ContextManager $contextManager; - - public function __construct(ContextManager $contextManager) + public function __construct(private ContextManager $contextManager) { - $this->contextManager = $contextManager; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php index b6a70372b..90de02914 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php @@ -20,12 +20,9 @@ use Throwable; */ class TemplateException extends RuntimeException { - private array $errors; - - public function __construct(array $errors, $code = 0, ?Throwable $previous = null) + public function __construct(private array $errors, $code = 0, ?Throwable $previous = null) { parent::__construct('Error while generating document from template', $code, $previous); - $this->errors = $errors; } public function getErrors(): array diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php index c14b67df7..2166032e1 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php @@ -24,19 +24,13 @@ use Throwable; final class RelatorioDriver implements DriverInterface { - private HttpClientInterface $client; - - private LoggerInterface $logger; - private string $url; public function __construct( - HttpClientInterface $client, + private HttpClientInterface $client, ParameterBagInterface $parameterBag, - LoggerInterface $logger + private LoggerInterface $logger ) { - $this->client = $client; - $this->logger = $logger; $this->url = $parameterBag->get('chill_doc_generator')['driver']['relatorio']['url']; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php index b325e6e12..6f048ae66 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php @@ -18,14 +18,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AdminMenuBuilder implements LocalMenuBuilderInterface { - private Security $security; - - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator, Security $security) + public function __construct(private TranslatorInterface $translator, private Security $security) { - $this->translator = $translator; - $this->security = $security; } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php index c00dc7474..850f9a862 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php +++ b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php @@ -21,12 +21,9 @@ final class DocGeneratorTemplateRepository implements ObjectRepository { private EntityRepository $repository; - private RequestStack $requestStack; - - public function __construct(EntityManagerInterface $entityManager, RequestStack $requestStack) + public function __construct(EntityManagerInterface $entityManager, private RequestStack $requestStack) { $this->repository = $entityManager->getRepository(DocGeneratorTemplate::class); - $this->requestStack = $requestStack; } public function countByEntity(string $entity): int diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php index 49e0d4c3f..f35736635 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php @@ -19,17 +19,8 @@ use function is_array; class NormalizeNullValueHelper { - private ?string $discriminatorType = null; - - private ?string $discriminatorValue = null; - - private NormalizerInterface $normalizer; - - public function __construct(NormalizerInterface $normalizer, $discriminatorType = null, $discriminatorValue = null) + public function __construct(private NormalizerInterface $normalizer, private ?string $discriminatorType = null, private ?string $discriminatorValue = null) { - $this->normalizer = $normalizer; - $this->discriminatorType = $discriminatorType; - $this->discriminatorValue = $discriminatorValue; } public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ?ClassMetadata $classMetadata = null) @@ -45,27 +36,13 @@ class NormalizeNullValueHelper if (is_numeric($key)) { $data[$class] = ''; } else { - switch ($class) { - case 'array': - case 'bool': - case 'double': - case 'float': - case 'int': - case 'resource': - case 'string': - case 'null': - $data[$key] = ''; - - break; - - default: - $data[$key] = $this->normalizer->normalize(null, $format, array_merge( - $this->getContextForAttribute($key, $context, $classMetadata), - ['docgen:expects' => $class] - )); - - break; - } + $data[$key] = match ($class) { + 'array', 'bool', 'double', 'float', 'int', 'resource', 'string', 'null' => '', + default => $this->normalizer->normalize(null, $format, array_merge( + $this->getContextForAttribute($key, $context, $classMetadata), + ['docgen:expects' => $class] + )), + }; } } diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php index 3807ee9ee..bda1fda5c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php @@ -40,19 +40,13 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - private ClassMetadataFactoryInterface $classMetadataFactory; - private PropertyAccessor $propertyAccess; - private TranslatableStringHelperInterface $translatableStringHelper; - public function __construct( - ClassMetadataFactoryInterface $classMetadataFactory, - TranslatableStringHelperInterface $translatableStringHelper + private ClassMetadataFactoryInterface $classMetadataFactory, + private TranslatableStringHelperInterface $translatableStringHelper ) { - $this->classMetadataFactory = $classMetadataFactory; $this->propertyAccess = PropertyAccess::createPropertyAccessor(); - $this->translatableStringHelper = $translatableStringHelper; } public function normalize($object, $format = null, array $context = []) @@ -66,7 +60,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte if (!$this->classMetadataFactory->hasMetadataFor($classMetadataKey)) { throw new LogicException(sprintf( 'This object does not have metadata: %s. Add groups on this entity to allow to serialize with the format %s and groups %s', - is_object($object) ? get_class($object) : '(todo' /*$context['docgen:expects'],*/ , + is_object($object) ? $object::class : '(todo' /*$context['docgen:expects'],*/ , $format, implode(', ', ($context['groups'] ?? [])) )); @@ -199,10 +193,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte return $normalizer->normalize($keys, $format, $context, $metadata); } - /** - * @param mixed $format - */ - private function normalizeNullOutputValue($format, array $context, AttributeMetadata $attribute, ReflectionClass $reflection) + private function normalizeNullOutputValue(mixed $format, array $context, AttributeMetadata $attribute, ReflectionClass $reflection) { $type = $this->getExpectedType($attribute, $reflection); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index 5aed8554b..ad546a97f 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BaseContextData { - private NormalizerInterface $normalizer; - - public function __construct(NormalizerInterface $normalizer) + public function __construct(private NormalizerInterface $normalizer) { - $this->normalizer = $normalizer; } public function getData(?User $user = null): array diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index e2e09f349..66136639f 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -25,30 +25,10 @@ use Symfony\Component\HttpFoundation\File\File; class Generator implements GeneratorInterface { - private ContextManagerInterface $contextManager; - - private DriverInterface $driver; - - private EntityManagerInterface $entityManager; - - private LoggerInterface $logger; - - private StoredObjectManagerInterface $storedObjectManager; - private const LOG_PREFIX = '[docgen generator] '; - public function __construct( - ContextManagerInterface $contextManager, - DriverInterface $driver, - EntityManagerInterface $entityManager, - LoggerInterface $logger, - StoredObjectManagerInterface $storedObjectManager - ) { - $this->contextManager = $contextManager; - $this->driver = $driver; - $this->entityManager = $entityManager; - $this->logger = $logger; - $this->storedObjectManager = $storedObjectManager; + public function __construct(private ContextManagerInterface $contextManager, private DriverInterface $driver, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private StoredObjectManagerInterface $storedObjectManager) + { } /** diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php index 4360413b4..9024db235 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php @@ -17,13 +17,10 @@ use Throwable; class GeneratorException extends RuntimeException { /** - * @var list + * @param string[] $errors */ - private array $errors; - - public function __construct(array $errors = [], ?Throwable $previous = null) + public function __construct(private array $errors = [], ?Throwable $previous = null) { - $this->errors = $errors; parent::__construct( 'Could not generate the document', 15252, @@ -31,9 +28,6 @@ class GeneratorException extends RuntimeException ); } - /** - * @return array - */ public function getErrors(): array { return $this->errors; diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php index 5f20a3e69..7ea3a1dc7 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php @@ -26,47 +26,10 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class OnGenerationFails implements EventSubscriberInterface { - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private EntityManagerInterface $entityManager; - - private LoggerInterface $logger; - - private MailerInterface $mailer; - - private StoredObjectRepository $storedObjectRepository; - - private TranslatorInterface $translator; - - private UserRepositoryInterface $userRepository; - public const LOG_PREFIX = '[docgen failed] '; - /** - * @param DocGeneratorTemplateRepository $docGeneratorTemplateRepository - * @param EntityManagerInterface $entityManager - * @param LoggerInterface $logger - * @param MailerInterface $mailer - * @param StoredObjectRepository $storedObjectRepository - * @param TranslatorInterface $translator - * @param UserRepositoryInterface $userRepository - */ - public function __construct( - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - EntityManagerInterface $entityManager, - LoggerInterface $logger, - MailerInterface $mailer, - StoredObjectRepository $storedObjectRepository, - TranslatorInterface $translator, - UserRepositoryInterface $userRepository - ) { - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->entityManager = $entityManager; - $this->logger = $logger; - $this->mailer = $mailer; - $this->storedObjectRepository = $storedObjectRepository; - $this->translator = $translator; - $this->userRepository = $userRepository; + public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private MailerInterface $mailer, private StoredObjectRepository $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) + { } @@ -95,7 +58,7 @@ final class OnGenerationFails implements EventSubscriberInterface 'entity_id' => $message->getEntityId(), 'template_id' => $message->getTemplateId(), 'creator_id' => $message->getCreatorId(), - 'throwable_class' => get_class($event->getThrowable()), + 'throwable_class' => $event->getThrowable()::class, ]); $this->markObjectAsFailed($message); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index 49c3430ad..99f0854cd 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -26,36 +26,12 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class RequestGenerationHandler implements MessageHandlerInterface { - private StoredObjectRepository $storedObjectRepository; - - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private EntityManagerInterface $entityManager; - - private Generator $generator; - - private LoggerInterface $logger; - - private UserRepositoryInterface $userRepository; - public const AUTHORIZED_TRIALS = 5; private const LOG_PREFIX = '[docgen message handler] '; - public function __construct( - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - EntityManagerInterface $entityManager, - Generator $generator, - LoggerInterface $logger, - StoredObjectRepository $storedObjectRepository, - UserRepositoryInterface $userRepository - ) { - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->entityManager = $entityManager; - $this->generator = $generator; - $this->logger = $logger; - $this->storedObjectRepository = $storedObjectRepository; - $this->userRepository = $userRepository; + public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private Generator $generator, private LoggerInterface $logger, private StoredObjectRepository $storedObjectRepository, private UserRepositoryInterface $userRepository) + { } public function __invoke(RequestGenerationMessage $message) diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php index e8734e62b..0bc0ec850 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php @@ -21,26 +21,20 @@ class RequestGenerationMessage private int $templateId; - private int $entityId; - private int $destinationStoredObjectId; - private array $contextGenerationData; - private \DateTimeImmutable $createdAt; public function __construct( User $creator, DocGeneratorTemplate $template, - int $entityId, + private int $entityId, StoredObject $destinationStoredObject, - array $contextGenerationData + private array $contextGenerationData ) { $this->creatorId = $creator->getId(); $this->templateId = $template->getId(); - $this->entityId = $entityId; $this->destinationStoredObjectId = $destinationStoredObject->getId(); - $this->contextGenerationData = $contextGenerationData; $this->createdAt = new \DateTimeImmutable('now'); } diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php index 58208b045..ad0c35ab1 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php @@ -116,11 +116,8 @@ final class DocGenEncoderTest extends TestCase /** * @dataProvider generateEncodeData - * - * @param mixed $expected - * @param mixed $data */ - public function testEncode($expected, $data, string $msg) + public function testEncode(mixed $expected, mixed $data, string $msg) { $generated = $this->encoder->encode($data, 'docgen'); $this->assertEquals($expected, $generated, $msg); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index 1bc3db221..2c70454b0 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -33,31 +33,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class DocumentAccompanyingCourseController extends AbstractController { - protected AuthorizationHelper $authorizationHelper; - - protected EventDispatcherInterface $eventDispatcher; - - protected TranslatorInterface $translator; - - private AccompanyingCourseDocumentRepository $courseRepository; - - private PaginatorFactory $paginatorFactory; - /** * DocumentAccompanyingCourseController constructor. */ - public function __construct( - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher, - AuthorizationHelper $authorizationHelper, - PaginatorFactory $paginatorFactory, - AccompanyingCourseDocumentRepository $courseRepository - ) { - $this->translator = $translator; - $this->eventDispatcher = $eventDispatcher; - $this->authorizationHelper = $authorizationHelper; - $this->paginatorFactory = $paginatorFactory; - $this->courseRepository = $courseRepository; + public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private PaginatorFactory $paginatorFactory, private AccompanyingCourseDocumentRepository $courseRepository) + { } /** diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php index ef6bb0c0c..69c146fb0 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php @@ -27,11 +27,8 @@ class DocumentCategoryController extends AbstractController { /** * @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE") - * - * @param mixed $bundleId - * @param mixed $idInsideBundle */ - public function delete(Request $request, $bundleId, $idInsideBundle): Response + public function delete(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->getDoctrine()->getManager(); $documentCategory = $em @@ -50,11 +47,8 @@ class DocumentCategoryController extends AbstractController /** * @Route("/{bundleId}/{idInsideBundle}/edit", name="document_category_edit", methods="GET|POST") - * - * @param mixed $bundleId - * @param mixed $idInsideBundle */ - public function edit(Request $request, $bundleId, $idInsideBundle): Response + public function edit(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->getDoctrine()->getManager(); $documentCategory = $em @@ -136,11 +130,8 @@ class DocumentCategoryController extends AbstractController /** * @Route("/{bundleId}/{idInsideBundle}", name="document_category_show", methods="GET") - * - * @param mixed $bundleId - * @param mixed $idInsideBundle */ - public function show($bundleId, $idInsideBundle): Response + public function show(mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->getDoctrine()->getManager(); $documentCategory = $em diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 6fcb6a8e5..79fb401ea 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -39,31 +39,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class DocumentPersonController extends AbstractController { - protected AuthorizationHelper $authorizationHelper; - - protected EventDispatcherInterface $eventDispatcher; - - protected TranslatorInterface $translator; - - private PaginatorFactory $paginatorFactory; - - private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository; - /** * DocumentPersonController constructor. */ - public function __construct( - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher, - AuthorizationHelper $authorizationHelper, - PaginatorFactory $paginatorFactory, - PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository - ) { - $this->translator = $translator; - $this->eventDispatcher = $eventDispatcher; - $this->authorizationHelper = $authorizationHelper; - $this->paginatorFactory = $paginatorFactory; - $this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository; + public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private PaginatorFactory $paginatorFactory, private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository) + { } /** diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index a11556e42..b675d6246 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -20,11 +20,8 @@ use Symfony\Component\Security\Core\Security; class StoredObjectApiController { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } /** diff --git a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php index 3d9cc3220..b4cd54e1b 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php @@ -19,14 +19,6 @@ use Doctrine\ORM\Mapping as ORM; */ class DocumentCategory { - /** - * @ORM\Id - * @ORM\Column(type="string", name="bundle_id") - * - * @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....) - */ - private $bundleId; - /** * @ORM\Column(type="string", name="document_class") * @@ -34,23 +26,31 @@ class DocumentCategory */ private $documentClass; - /** - * @ORM\Id - * @ORM\Column(type="integer", name="id_inside_bundle") - * - * @var int The id which is unique inside the bundle - */ - private $idInsideBundle; - /** * @ORM\Column(type="json") */ private $name; - public function __construct($bundleId, $idInsideBundle) - { - $this->bundleId = $bundleId; - $this->idInsideBundle = $idInsideBundle; + /** + * @param string $bundleId + * @param int $idInsideBundle + */ + public function __construct( + /** + * @ORM\Id + * @ORM\Column(type="string", name="bundle_id") + * + * @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....) + */ + private $bundleId, + /** + * @ORM\Id + * @ORM\Column(type="integer", name="id_inside_bundle") + * + * @var int The id which is unique inside the bundle + */ + private $idInsideBundle + ) { } public function getBundleId() // ::class BundleClass (FQDN) diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index 0583e26b2..fbfd4ef54 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -96,12 +96,6 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa */ private ?DocGeneratorTemplate $template = null; - /** - * @ORM\Column(type="text", options={"default": "ready"}) - * @Serializer\Groups({"read"}) - */ - private string $status; - /** * Store the number of times a generation has been tryied for this StoredObject. * @@ -115,10 +109,13 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa /** * @param StoredObject::STATUS_* $status */ - public function __construct(string $status = "ready") - { + public function __construct(/** + * @ORM\Column(type="text", options={"default": "ready"}) + * @Serializer\Groups({"read"}) + */ + private string $status = "ready" + ) { $this->uuid = Uuid::uuid4(); - $this->status = $status; } public function addGenerationTrial(): self diff --git a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php index d42bb90d5..8ae67be51 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php @@ -26,7 +26,7 @@ class DocumentCategoryType extends AbstractType { // TODO faire un service dans CHillMain foreach ($kernelBundles as $key => $value) { - if (substr($key, 0, 5) === 'Chill') { + if (str_starts_with($key, 'Chill')) { $this->chillBundlesFlipped[$value] = $key; } } diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php index 11f73e862..cfe5d5156 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php @@ -30,24 +30,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonDocumentType extends AbstractType { - private CenterResolverDispatcher $centerResolverDispatcher; - - private ParameterBagInterface $parameterBag; - - private ScopeResolverDispatcher $scopeResolverDispatcher; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - TranslatableStringHelperInterface $translatableStringHelper, - ScopeResolverDispatcher $scopeResolverDispatcher, - ParameterBagInterface $parameterBag, - CenterResolverDispatcher $centerResolverDispatcher - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->scopeResolverDispatcher = $scopeResolverDispatcher; - $this->parameterBag = $parameterBag; - $this->centerResolverDispatcher = $centerResolverDispatcher; + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private ScopeResolverDispatcher $scopeResolverDispatcher, private ParameterBagInterface $parameterBag, private CenterResolverDispatcher $centerResolverDispatcher) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php index 41d31ced3..49f7723ce 100644 --- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php @@ -21,34 +21,17 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class MenuBuilder implements LocalMenuBuilderInterface { - private Security $security; - - private TranslatorInterface $translator; - - public function __construct( - Security $security, - TranslatorInterface $translator - ) { - $this->security = $security; - $this->translator = $translator; + public function __construct(private Security $security, private TranslatorInterface $translator) + { } public function buildMenu($menuId, MenuItem $menu, array $parameters) { - switch ($menuId) { - case 'accompanyingCourse': - $this->buildMenuAccompanyingCourse($menu, $parameters); - - break; - - case 'person': - $this->buildMenuPerson($menu, $parameters); - - break; - - default: - throw new LogicException("this menuid {$menuId} is not implemented"); - } + match ($menuId) { + 'accompanyingCourse' => $this->buildMenuAccompanyingCourse($menu, $parameters), + 'person' => $this->buildMenuPerson($menu, $parameters), + default => throw new LogicException("this menuid {$menuId} is not implemented"), + }; } public static function getMenuIds(): array diff --git a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php index de1958f36..3231bfd79 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php @@ -20,13 +20,10 @@ use Doctrine\Persistence\ObjectRepository; class AccompanyingCourseDocumentRepository implements ObjectRepository { - private EntityManagerInterface $em; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { - $this->em = $em; $this->repository = $em->getRepository(AccompanyingCourseDocument::class); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php index 40d134200..9025afd09 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php @@ -21,13 +21,10 @@ use Doctrine\Persistence\ObjectRepository; */ class DocumentCategoryRepository implements ObjectRepository { - private EntityManagerInterface $em; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { - $this->em = $em; $this->repository = $em->getRepository(DocumentCategory::class); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index 23dcc4e0b..da1809dbb 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -22,20 +22,8 @@ use Symfony\Component\Security\Core\Security; class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private CenterResolverDispatcher $centerResolverDispatcher; - - private EntityManagerInterface $em; - - private Security $security; - - public function __construct(EntityManagerInterface $em, AuthorizationHelperInterface $authorizationHelper, CenterResolverDispatcher $centerResolverDispatcher, Security $security) + public function __construct(private EntityManagerInterface $em, private AuthorizationHelperInterface $authorizationHelper, private CenterResolverDispatcher $centerResolverDispatcher, private Security $security) { - $this->em = $em; - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->security = $security; } public function buildQueryByPerson(Person $person): QueryBuilder diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php index 0ef1d4d49..60bc7060c 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php @@ -37,19 +37,13 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov public const UPDATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE'; - protected LoggerInterface $logger; - - protected Security $security; - protected VoterHelperInterface $voterHelper; public function __construct( - LoggerInterface $logger, - Security $security, + protected LoggerInterface $logger, + protected Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->logger = $logger; - $this->security = $security; $this->voterHelper = $voterHelperFactory ->generate(self::class) ->addCheckFor(AccompanyingCourseDocument::class, $this->getRoles()) diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php index 059a2c7d9..b4a5de4c5 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php @@ -35,19 +35,13 @@ class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHiera public const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE'; - protected LoggerInterface $logger; - - protected Security $security; - protected VoterHelperInterface $voterHelper; public function __construct( - LoggerInterface $logger, - Security $security, + protected LoggerInterface $logger, + protected Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->logger = $logger; - $this->security = $security; $this->voterHelper = $voterHelperFactory ->generate(self::class) ->addCheckFor(PersonDocument::class, $this->getRoles()) diff --git a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php index c9829d3ee..d277c7ec9 100644 --- a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php +++ b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php @@ -22,11 +22,8 @@ class StoredObjectDenormalizer implements DenormalizerInterface { use ObjectToPopulateTrait; - private StoredObjectRepository $storedObjectRepository; - - public function __construct(StoredObjectRepository $storedObjectRepository) + public function __construct(private StoredObjectRepository $storedObjectRepository) { - $this->storedObjectRepository = $storedObjectRepository; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php index a1ef42ff1..5e7a54410 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php @@ -33,18 +33,10 @@ final class StoredObjectManager implements StoredObjectManagerInterface { private const ALGORITHM = 'AES-256-CBC'; - private HttpClientInterface $client; - private array $inMemory = []; - private TempUrlGeneratorInterface $tempUrlGenerator; - - public function __construct( - HttpClientInterface $client, - TempUrlGeneratorInterface $tempUrlGenerator - ) { - $this->client = $client; - $this->tempUrlGenerator = $tempUrlGenerator; + public function __construct(private HttpClientInterface $client, private TempUrlGeneratorInterface $tempUrlGenerator) + { } public function getLastModified(StoredObject $document): DateTimeInterface diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index ec1df1465..89655fc35 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -122,14 +122,8 @@ final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface private const TEMPLATE_BUTTON_GROUP = '@ChillDocStore/Button/button_group.html.twig'; - private DiscoveryInterface $discovery; - - private NormalizerInterface $normalizer; - - public function __construct(DiscoveryInterface $discovery, NormalizerInterface $normalizer) + public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) { - $this->discovery = $discovery; - $this->normalizer = $normalizer; } /** diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index c3285507e..5a7ce406c 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -24,17 +24,14 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler { private EntityRepository $repository; - private TranslatorInterface $translator; - /** * TODO: injecter le repository directement. */ public function __construct( EntityManagerInterface $em, - TranslatorInterface $translator + private TranslatorInterface $translator ) { $this->repository = $em->getRepository(AccompanyingCourseDocument::class); - $this->translator = $translator; } public function getDeletionRoles(): array diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 93ce62f43..f84eeddfb 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -91,10 +91,8 @@ class EventController extends AbstractController /** * @param $event_id - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response */ - public function deleteAction($event_id, Request $request) + public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->getDoctrine()->getManager(); $event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->findOneBy([ @@ -345,10 +343,8 @@ class EventController extends AbstractController * Edits an existing Event entity. * * @param $event_id - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response */ - public function updateAction(Request $request, $event_id) + public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index 2e9a45f6f..486b0f7f9 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -50,10 +50,8 @@ class EventTypeController extends AbstractController /** * Deletes a EventType entity. - * - * @param mixed $id */ - public function deleteAction(Request $request, $id) + public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); @@ -75,10 +73,8 @@ class EventTypeController extends AbstractController /** * Displays a form to edit an existing EventType entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -128,10 +124,8 @@ class EventTypeController extends AbstractController /** * Finds and displays a EventType entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -151,10 +145,8 @@ class EventTypeController extends AbstractController /** * Edits an existing EventType entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -210,7 +202,7 @@ class EventTypeController extends AbstractController * * @return \Symfony\Component\Form\Form The form */ - private function createDeleteForm($id) + private function createDeleteForm(mixed $id) { return $this->createFormBuilder() ->setAction($this->generateUrl( diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 1929beac1..9cd807479 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -33,23 +33,17 @@ use function count; */ class ParticipationController extends AbstractController { - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - /** * ParticipationController constructor. */ - public function __construct(LoggerInterface $logger) + public function __construct(private LoggerInterface $logger) { - $this->logger = $logger; } /** * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function createAction(Request $request) + public function createAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct try { @@ -167,7 +161,7 @@ class ParticipationController extends AbstractController /** * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function createMultiple(Request $request) + public function createMultiple(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { $participations = $this->handleRequest($request, new Participation(), true); @@ -210,7 +204,7 @@ class ParticipationController extends AbstractController /** * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function createSingle(Request $request) + public function createSingle(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { $participation = $this->handleRequest($request, new Participation(), false); @@ -253,7 +247,7 @@ class ParticipationController extends AbstractController * * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function deleteAction($participation_id, Request $request) + public function deleteAction($participation_id, Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { $em = $this->getDoctrine()->getManager(); $participation = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findOneBy([ @@ -332,7 +326,7 @@ class ParticipationController extends AbstractController * * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function editMultipleAction($event_id) + public function editMultipleAction($event_id): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { $event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class) ->find($event_id); @@ -389,7 +383,7 @@ class ParticipationController extends AbstractController * * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function newAction(Request $request) + public function newAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct try { @@ -555,7 +549,7 @@ class ParticipationController extends AbstractController Request $request, Participation $participation, bool $multiple = false - ) { + ): \Chill\EventBundle\Entity\Participation|array { $em = $this->getDoctrine()->getManager(); if ($em->contains($participation)) { @@ -632,7 +626,7 @@ class ParticipationController extends AbstractController * * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - protected function newMultiple(Request $request) + protected function newMultiple(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { $participations = $this->handleRequest($request, new Participation(), true); $ignoredParticipations = $newParticipations = []; diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 9ffe0d2d0..f5cc100bf 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -50,10 +50,8 @@ class RoleController extends AbstractController /** * Deletes a Role entity. - * - * @param mixed $id */ - public function deleteAction(Request $request, $id) + public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); @@ -75,10 +73,8 @@ class RoleController extends AbstractController /** * Displays a form to edit an existing Role entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -128,10 +124,8 @@ class RoleController extends AbstractController /** * Finds and displays a Role entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -151,10 +145,8 @@ class RoleController extends AbstractController /** * Edits an existing Role entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -210,7 +202,7 @@ class RoleController extends AbstractController * * @return \Symfony\Component\Form\Form The form */ - private function createDeleteForm($id) + private function createDeleteForm(mixed $id) { return $this->createFormBuilder() ->setAction($this->generateUrl('chill_event_admin_role_delete', ['id' => $id])) diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 2b8d97ee6..9e7a7e0a5 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -47,10 +47,8 @@ class StatusController extends AbstractController /** * Deletes a Status entity. - * - * @param mixed $id */ - public function deleteAction(Request $request, $id) + public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); @@ -72,10 +70,8 @@ class StatusController extends AbstractController /** * Displays a form to edit an existing Status entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -125,10 +121,8 @@ class StatusController extends AbstractController /** * Finds and displays a Status entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -148,10 +142,8 @@ class StatusController extends AbstractController /** * Edits an existing Status entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -204,7 +196,7 @@ class StatusController extends AbstractController * * @return \Symfony\Component\Form\Form The form */ - private function createDeleteForm($id) + private function createDeleteForm(mixed $id) { return $this->createFormBuilder() ->setAction($this->generateUrl('chill_event_admin_status_delete', ['id' => $id])) diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index d55a7b8a8..ca1379657 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -162,7 +162,7 @@ class Event implements HasCenterInterface, HasScopeInterface /** * @return ArrayIterator|Collection|Traversable */ - public function getParticipations() + public function getParticipations(): \ArrayIterator|\Doctrine\Common\Collections\Collection|\Traversable { return $this->getParticipationsOrdered(); } @@ -172,7 +172,7 @@ class Event implements HasCenterInterface, HasScopeInterface * * @return ArrayIterator|Traversable */ - public function getParticipationsOrdered() + public function getParticipationsOrdered(): \ArrayIterator|\Traversable { $iterator = $this->participations->getIterator(); diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 38c849535..cb63327a6 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -192,12 +192,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac } } - /** - * @param mixed $offset - * - * @return bool - */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return in_array($offset, [ 'person', 'role', 'status', 'event', @@ -205,33 +200,20 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac } /** - * @param mixed $offset - * * @return Event|Person|Role|Status */ - public function offsetGet($offset): mixed + public function offsetGet(mixed $offset): mixed { - switch ($offset) { - case 'person': - return $this->getPerson(); - case 'role': - return $this->getRole(); - case 'status': - return $this->getStatus(); - case 'event': - return $this->getEvent(); - default: - throw new \LogicException("this offset does not exists : " . $offset); - } + return match ($offset) { + 'person' => $this->getPerson(), + 'role' => $this->getRole(), + 'status' => $this->getStatus(), + 'event' => $this->getEvent(), + default => throw new \LogicException("this offset does not exists : " . $offset), + }; } - /** - * @param mixed $offset - * @param mixed $value - * - * @return void - */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { switch ($offset) { case 'person': @@ -256,10 +238,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac } } - /** - * @param mixed $offset - */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { $this->offsetSet($offset, null); } diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php index 05436b3e8..2bad90153 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php @@ -123,10 +123,7 @@ class PickEventType extends AbstractType ]); } - /** - * @return string|null - */ - public function getParent() + public function getParent(): ?string { return EntityType::class; } diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index a7ac22592..8a396e5cb 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -40,26 +40,6 @@ class EventSearch extends AbstractSearch { public const NAME = 'event_regular'; - /** - * @var EntityRepository - */ - private $er; - - /** - * @var AuthorizationHelper - */ - private $helper; - - /** - * @var PaginatorFactory - */ - private $paginationFactory; - - /** - * @var TemplatingEngine - */ - private $templating; - /** * @var \Chill\MainBundle\Entity\User */ @@ -67,16 +47,12 @@ class EventSearch extends AbstractSearch public function __construct( TokenStorageInterface $tokenStorage, - EntityRepository $eventRepository, - AuthorizationHelper $authorizationHelper, - TemplatingEngine $templating, - PaginatorFactory $paginatorFactory + private EntityRepository $er, + private AuthorizationHelper $helper, + private TemplatingEngine $templating, + private PaginatorFactory $paginationFactory ) { $this->user = $tokenStorage->getToken()->getUser(); - $this->er = $eventRepository; - $this->helper = $authorizationHelper; - $this->templating = $templating; - $this->paginationFactory = $paginatorFactory; } public function getOrder() diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php index d61c1f385..d8766a9ee 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php @@ -446,12 +446,10 @@ final class ParticipationControllerTest extends WebTestCase } /** - * @param mixed $centerName - * @param mixed $circleName * * @return \Chill\EventBundle\Entity\Event */ - protected function getRandomEvent($centerName = 'Center A', $circleName = 'social') + protected function getRandomEvent(mixed $centerName = 'Center A', mixed $circleName = 'social') { $center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class) ->findByName($centerName); diff --git a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php index 1d6ecae67..c361984f0 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php +++ b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php @@ -20,19 +20,18 @@ class ConfigRepository */ protected $familialSituations; - /** - * @var array - */ - protected $links; - /** * @var array */ protected $professionalSituations; - public function __construct($links, $professionnalSituations, $familialSituations) + /** + * @param mixed[] $links + * @param mixed $professionnalSituations + * @param mixed $familialSituations + */ + public function __construct(protected $links, $professionnalSituations, $familialSituations) { - $this->links = $links; $this->professionalSituations = $professionnalSituations ?? []; $this->familialSituations = $familialSituations ?? []; } diff --git a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php index a6358a23d..5892ddbc4 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php +++ b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php @@ -28,23 +28,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; class FamilyMemberController extends AbstractController { - protected LoggerInterface $chillMainLogger; - - protected TranslatorInterface $translator; - - private EntityManagerInterface $em; - private FamilyMemberRepository $familyMemberRepository; public function __construct( - EntityManagerInterface $entityManager, - TranslatorInterface $translator, - LoggerInterface $chillMainLogger, + private EntityManagerInterface $em, + protected TranslatorInterface $translator, + protected LoggerInterface $chillMainLogger, FamilyMemberRepository $familyMemberRepository ) { - $this->em = $entityManager; - $this->translator = $translator; - $this->chillMainLogger = $chillMainLogger; $this->familyMemberRepository = $familyMemberRepository; } diff --git a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php index e082ef9c9..4c45691e5 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php +++ b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php @@ -25,22 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class FamilyMemberType extends AbstractType { - /** - * @var ConfigRepository - */ - private $configRepository; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct( - ConfigRepository $configRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->configRepository = $configRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ConfigRepository $configRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 4bc9b4d79..56d62bb8a 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -36,11 +36,8 @@ abstract class AbstractCRUDController extends AbstractController /** * get the role given from the config. - * - * @param mixed $entity - * @param mixed $_format */ - protected function getRoleFor(string $action, Request $request, $entity, $_format): string + protected function getRoleFor(string $action, Request $request, mixed $entity, mixed $_format): string { $actionConfig = $this->getActionConfig($action); @@ -135,7 +132,7 @@ abstract class AbstractCRUDController extends AbstractController * * @param mixed $_format */ - protected function countEntities(string $action, Request $request, $_format): int + protected function countEntities(string $action, Request $request, mixed $_format): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -171,10 +168,8 @@ abstract class AbstractCRUDController extends AbstractController * get the instance of the entity with the given id. * * @throw Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the object is not found - * - * @param mixed $action */ - protected function getEntity($action, string $id, Request $request): object + protected function getEntity(mixed $action, string $id, Request $request): object { $e = $this ->getDoctrine() @@ -205,10 +200,8 @@ abstract class AbstractCRUDController extends AbstractController /** * Get the result of the query. - * - * @param mixed $query */ - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, mixed $query) { return $query->getQuery()->getResult(); } @@ -220,41 +213,32 @@ abstract class AbstractCRUDController extends AbstractController /** * Called on post check ACL. - * - * @param mixed $entity */ - protected function onPostCheckACL(string $action, Request $request, string $_format, $entity): ?Response + protected function onPostCheckACL(string $action, Request $request, string $_format, mixed $entity): ?Response { return null; } /** * Called on post fetch entity. - * - * @param mixed $entity - * @param mixed $_format */ - protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response + protected function onPostFetchEntity(string $action, Request $request, mixed $entity, mixed $_format): ?Response { return null; } /** * Method used by indexAction. - * - * @param mixed $query */ - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, mixed $query): ?Response { return null; } /** * Method used by indexAction. - * - * @param mixed $entities */ - protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $entities): ?Response + protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, mixed $entities): ?Response { return null; } @@ -274,11 +258,8 @@ abstract class AbstractCRUDController extends AbstractController /** * Add ordering fields in the query build by self::queryEntities. - * - * @param mixed $query - * @param mixed $_format */ - protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) + protected function orderQuery(string $action, mixed $query, Request $request, PaginatorInterface $paginator, mixed $_format) { return $query; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index 645f7525c..c18dfd542 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -32,31 +32,18 @@ class ApiController extends AbstractCRUDController /** * Base method for handling api action. * - * @param mixed $id * @param string $_format - * * @return void */ - public function entityApi(Request $request, $id, ?string $_format = 'json'): Response + public function entityApi(Request $request, mixed $id, ?string $_format = 'json'): Response { - switch ($request->getMethod()) { - case Request::METHOD_GET: - case Request::METHOD_HEAD: - return $this->entityGet('_entity', $request, $id, $_format); - - case Request::METHOD_PUT: - case Request::METHOD_PATCH: - return $this->entityPut('_entity', $request, $id, $_format); - - case Request::METHOD_POST: - return $this->entityPostAction('_entity', $request, $id); - - case Request::METHOD_DELETE: - return $this->entityDelete('_entity', $request, $id, $_format); - - default: - throw new BadRequestHttpException('This method is not implemented'); - } + return match ($request->getMethod()) { + Request::METHOD_GET, Request::METHOD_HEAD => $this->entityGet('_entity', $request, $id, $_format), + Request::METHOD_PUT, Request::METHOD_PATCH => $this->entityPut('_entity', $request, $id, $_format), + Request::METHOD_POST => $this->entityPostAction('_entity', $request, $id), + Request::METHOD_DELETE => $this->entityDelete('_entity', $request, $id, $_format), + default => throw new BadRequestHttpException('This method is not implemented'), + }; } public function entityDelete($action, Request $request, $id, string $_format): Response @@ -115,13 +102,10 @@ class ApiController extends AbstractCRUDController public function entityPost(Request $request, $_format): Response { - switch ($request->getMethod()) { - case Request::METHOD_POST: - return $this->entityPostAction('_entity', $request, $_format); - - default: - throw new BadRequestHttpException('This method is not implemented'); - } + return match ($request->getMethod()) { + Request::METHOD_POST => $this->entityPostAction('_entity', $request, $_format), + default => throw new BadRequestHttpException('This method is not implemented'), + }; } public function entityPut($action, Request $request, $id, string $_format): Response @@ -199,14 +183,10 @@ class ApiController extends AbstractCRUDController */ public function indexApi(Request $request, string $_format) { - switch ($request->getMethod()) { - case Request::METHOD_GET: - case REQUEST::METHOD_HEAD: - return $this->indexApiAction('_index', $request, $_format); - - default: - throw $this->createNotFoundException('This method is not supported'); - } + return match ($request->getMethod()) { + Request::METHOD_GET, REQUEST::METHOD_HEAD => $this->indexApiAction('_index', $request, $_format), + default => throw $this->createNotFoundException('This method is not supported'), + }; } public function onBeforeSerialize(string $action, Request $request, $_format, $entity): ?Response @@ -242,7 +222,7 @@ class ApiController extends AbstractCRUDController * @throw BadRequestException if unable to deserialize the posted data * @throw BadRequestException if the method is not POST or DELETE */ - protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, array $postedDataContext = [], bool $forcePersist = false): Response + protected function addRemoveSomething(string $action, mixed $id, Request $request, string $_format, string $property, string $postedDataType, array $postedDataContext = [], bool $forcePersist = false): Response { $entity = $this->getEntity($action, $id, $request); @@ -277,23 +257,11 @@ class ApiController extends AbstractCRUDController 'data: %s', $e->getMessage()), $e, 0); } - switch ($request->getMethod()) { - case Request::METHOD_DELETE: - // oups... how to use property accessor to remove element ? - /* @phpstan-ignore-next-line as we do not find a simpler way to do this */ - $entity->{'remove' . ucfirst($property)}($postedData); - - break; - - case Request::METHOD_POST: - /* @phpstan-ignore-next-line as we do not find a simpler way to do this */ - $entity->{'add' . ucfirst($property)}($postedData); - - break; - - default: - throw new BadRequestHttpException('this method is not supported'); - } + match ($request->getMethod()) { + Request::METHOD_DELETE => $entity->{'remove' . ucfirst($property)}($postedData), + Request::METHOD_POST => $entity->{'add' . ucfirst($property)}($postedData), + default => throw new BadRequestHttpException('this method is not supported'), + }; $errors = $this->validate($action, $request, $_format, $entity, [$postedData]); @@ -319,21 +287,16 @@ class ApiController extends AbstractCRUDController if ($response instanceof Response) { return $response; } - - switch ($request->getMethod()) { - case Request::METHOD_DELETE: - return $this->json('', Response::HTTP_OK); - - case Request::METHOD_POST: - return $this->json( - $postedData, - Response::HTTP_OK, - [], - $this->getContextForSerializationPostAlter($action, $request, $_format, $entity, [$postedData]) - ); - } - - throw new Exception('Unable to handle such request method.'); + return match ($request->getMethod()) { + Request::METHOD_DELETE => $this->json('', Response::HTTP_OK), + Request::METHOD_POST => $this->json( + $postedData, + Response::HTTP_OK, + [], + $this->getContextForSerializationPostAlter($action, $request, $_format, $entity, [$postedData]) + ), + default => throw new Exception('Unable to handle such request method.'), + }; } /** @@ -376,7 +339,7 @@ class ApiController extends AbstractCRUDController * @param mixed $id * @param mixed $_format */ - protected function entityGet(string $action, Request $request, $id, $_format = 'html'): Response + protected function entityGet(string $action, Request $request, mixed $id, mixed $_format = 'html'): Response { $entity = $this->getEntity($action, $id, $request); @@ -474,18 +437,11 @@ class ApiController extends AbstractCRUDController protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array { - switch ($request->getMethod()) { - case Request::METHOD_GET: - return ['groups' => ['read']]; - - case Request::METHOD_PUT: - case Request::METHOD_PATCH: - case Request::METHOD_POST: - return ['groups' => ['write']]; - - default: - throw new LogicException('get context for serialization is not implemented for this method'); - } + return match ($request->getMethod()) { + Request::METHOD_GET => ['groups' => ['read']], + Request::METHOD_PUT, Request::METHOD_PATCH, Request::METHOD_POST => ['groups' => ['write']], + default => throw new LogicException('get context for serialization is not implemented for this method'), + }; } /** @@ -496,7 +452,7 @@ class ApiController extends AbstractCRUDController * * @param mixed $entity */ - protected function getContextForSerializationPostAlter(string $action, Request $request, string $_format, $entity, array $more = []): array + protected function getContextForSerializationPostAlter(string $action, Request $request, string $_format, mixed $entity, array $more = []): array { return ['groups' => ['read']]; } @@ -533,7 +489,7 @@ class ApiController extends AbstractCRUDController * @param string $action * @param mixed $_format */ - protected function indexApiAction($action, Request $request, $_format) + protected function indexApiAction($action, Request $request, mixed $_format) { $this->onPreIndex($action, $request, $_format); @@ -611,10 +567,8 @@ class ApiController extends AbstractCRUDController /** * Serialize collections. - * - * @param mixed $entities */ - protected function serializeCollection(string $action, Request $request, string $_format, PaginatorInterface $paginator, $entities): Response + protected function serializeCollection(string $action, Request $request, string $_format, PaginatorInterface $paginator, mixed $entities): Response { $model = new Collection($entities, $paginator); diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 730ac32c1..4f7f3b5f9 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -62,17 +62,15 @@ class CRUDController extends AbstractController * * @param mixed $id */ - public function edit(Request $request, $id): Response + public function edit(Request $request, mixed $id): Response { return $this->formEditAction('edit', $request, $id); } /** * Get the context for the serialization. - * - * @param mixed $entity */ - public function getContextForSerialization(string $action, Request $request, $entity, string $_format): array + public function getContextForSerialization(string $action, Request $request, mixed $entity, string $_format): array { return []; } @@ -125,7 +123,7 @@ class CRUDController extends AbstractController * * @param mixed $id */ - public function view(Request $request, $id): Response + public function view(Request $request, mixed $id): Response { return $this->viewAction('view', $request, $id); } @@ -188,7 +186,7 @@ class CRUDController extends AbstractController * * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedHttpException */ - protected function checkACL(string $action, $entity) + protected function checkACL(string $action, mixed $entity) { $this->denyAccessUnlessGranted($this->getRoleFor($action), $entity); } @@ -228,7 +226,7 @@ class CRUDController extends AbstractController * @param mixed $entity * @param string $formClass */ - protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface + protected function createFormFor(string $action, mixed $entity, ?string $formClass = null, array $formOptions = []): FormInterface { $formClass ??= $this->getFormClassFor($action); @@ -491,7 +489,7 @@ class CRUDController extends AbstractController * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ - protected function formEditAction(string $action, Request $request, $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); @@ -572,29 +570,15 @@ class CRUDController extends AbstractController * Generate a success message when a form could be flushed successfully. * * @param string $action - * @param mixed $entity */ - protected function generateFormSuccessMessage($action, $entity): string + protected function generateFormSuccessMessage($action, mixed $entity): string { - switch ($action) { - case 'edit': - $msg = 'crud.edit.success'; - - break; - - case 'new': - $msg = 'crud.new.success'; - - break; - - case 'delete': - $msg = 'crud.delete.success'; - - break; - - default: - $msg = 'crud.default.success'; - } + $msg = match ($action) { + 'edit' => 'crud.edit.success', + 'new' => 'crud.new.success', + 'delete' => 'crud.delete.success', + default => 'crud.default.success', + }; return $this->getTranslator()->trans($msg); } @@ -652,11 +636,10 @@ class CRUDController extends AbstractController * get the instance of the entity with the given id. * * @param string $id - * @param mixed $action * * @return object */ - protected function getEntity($action, $id, Request $request): ?object + protected function getEntity(mixed $action, $id, Request $request): ?object { return $this->getDoctrine() ->getRepository($this->getEntityClass()) @@ -763,33 +746,22 @@ class CRUDController extends AbstractController * * @return string the path to the template */ - protected function getTemplateFor($action, $entity, Request $request) + protected function getTemplateFor($action, mixed $entity, Request $request) { if ($this->hasCustomTemplate($action, $entity, $request)) { return $this->getActionConfig($action)['template']; } - switch ($action) { - case 'new': - return '@ChillMain/CRUD/new.html.twig'; - - case 'edit': - return '@ChillMain/CRUD/edit.html.twig'; - - case 'index': - return '@ChillMain/CRUD/index.html.twig'; - - case 'view': - return '@ChillMain/CRUD/view.html.twig'; - - case 'delete': - return '@ChillMain/CRUD/delete.html.twig'; - - default: - throw new LogicException("the view for action {$action} is not " - . 'defined. You should override ' . __METHOD__ . ' to add this ' - . 'action'); - } + return match ($action) { + 'new' => '@ChillMain/CRUD/new.html.twig', + 'edit' => '@ChillMain/CRUD/edit.html.twig', + 'index' => '@ChillMain/CRUD/index.html.twig', + 'view' => '@ChillMain/CRUD/view.html.twig', + 'delete' => '@ChillMain/CRUD/delete.html.twig', + default => throw new LogicException("the view for action {$action} is not " + . 'defined. You should override ' . __METHOD__ . ' to add this ' + . 'action'), + }; } protected function getTranslator(): TranslatorInterface @@ -909,22 +881,17 @@ class CRUDController extends AbstractController * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - protected function onBeforeRedirectAfterSubmission(string $action, $entity, FormInterface $form, Request $request) + protected function onBeforeRedirectAfterSubmission(string $action, mixed $entity, FormInterface $form, Request $request) { $next = $request->request->get('submit', 'save-and-close'); - switch ($next) { - case 'save-and-close': - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index'); - - case 'save-and-new': - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', $request->query->all()); - - default: - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ - 'id' => $entity->getId(), - ]); - } + return match ($next) { + 'save-and-close' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index'), + 'save-and-new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', $request->query->all()), + default => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ + 'id' => $entity->getId(), + ]), + }; } protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) @@ -958,19 +925,15 @@ class CRUDController extends AbstractController /** * method used by indexAction. - * - * @param mixed $query */ - protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query) + protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $query) { } /** * method used by indexAction. - * - * @param mixed $entities */ - protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $entities) + protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $entities) { } @@ -1091,7 +1054,7 @@ class CRUDController extends AbstractController * @param mixed $id * @param mixed $_format */ - protected function viewAction(string $action, Request $request, $id, $_format = 'html'): Response + protected function viewAction(string $action, Request $request, mixed $id, mixed $_format = 'html'): Response { $entity = $this->getEntity($action, $id, $request); diff --git a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php index 4fbf5961d..f77113579 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php +++ b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php @@ -36,17 +36,10 @@ class CRUDRoutesLoader extends Loader Request::METHOD_DELETE, ]; - protected array $apiCrudConfig = []; - - protected array $crudConfig = []; - private bool $isLoaded = false; - public function __construct(array $crudConfig, array $apiCrudConfig) + public function __construct(protected array $crudConfig, protected array $apiCrudConfig) { - $this->crudConfig = $crudConfig; - $this->apiCrudConfig = $apiCrudConfig; - parent::__construct(); } @@ -104,23 +97,11 @@ class CRUDRoutesLoader extends Loader // continue; } - // compute default action - switch ($name) { - case '_entity': - $controllerAction = 'entityApi'; - - break; - - case '_index': - $controllerAction = 'indexApi'; - - break; - - default: - $controllerAction = $name . 'Api'; - - break; - } + $controllerAction = match ($name) { + '_entity' => 'entityApi', + '_index' => 'indexApi', + default => $name . 'Api', + }; $defaults = [ '_controller' => $controller . ':' . ($action['controller_action'] ?? $controllerAction), diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index e6f49c6b5..d4c3dcb42 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -53,39 +53,23 @@ class ChillImportUsersCommand extends Command protected bool $doChanges = true; - protected EntityManagerInterface $em; - protected array $groupCenters; - protected LoggerInterface $logger; - protected Writer $output; - protected UserPasswordEncoderInterface $passwordEncoder; - protected array $permissionGroups; protected InputInterface $tempInput; protected OutputInterface $tempOutput; - protected UserRepository $userRepository; - - protected ValidatorInterface $validator; - public function __construct( - EntityManagerInterface $em, - LoggerInterface $logger, - UserPasswordEncoderInterface $passwordEncoder, - ValidatorInterface $validator, - UserRepository $userRepository + protected EntityManagerInterface $em, + protected LoggerInterface $logger, + protected UserPasswordEncoderInterface $passwordEncoder, + protected ValidatorInterface $validator, + protected UserRepository $userRepository ) { - $this->em = $em; - $this->passwordEncoder = $passwordEncoder; - $this->validator = $validator; - $this->logger = $logger; - $this->userRepository = $userRepository; - parent::__construct('chill:main:import-users'); } diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index ce8196aa4..5f62d39ed 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -162,7 +162,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command if (array_key_exists('email', $row)) { return $userRepository->findOneByUsernameOrEmail(trim($row['email'])); } - } catch (\Doctrine\ORM\NoResultException $e) { + } catch (\Doctrine\ORM\NoResultException) { // continue, we will try username } @@ -170,7 +170,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command if (array_key_exists('username', $row)) { return $userRepository->findOneByUsernameOrEmail(trim($row['username'])); } - } catch (\Doctrine\ORM\NoResultException $e) { + } catch (\Doctrine\ORM\NoResultException) { return null; } } diff --git a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php index 0e81177dc..e2d7bd6dd 100644 --- a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php @@ -19,14 +19,10 @@ use Symfony\Component\Console\Output\OutputInterface; class ExecuteCronJobCommand extends Command { - private CronManagerInterface $cronManager; - public function __construct( - CronManagerInterface $cronManager + private CronManagerInterface $cronManager ) { parent::__construct('chill:cron-job:execute'); - - $this->cronManager = $cronManager; } protected function configure() diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php index cc26b7687..0335f11ee 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php @@ -20,17 +20,11 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesBEFromBestAddressCommand extends Command { - private AddressReferenceBEFromBestAddress $addressImporter; - - private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter; - public function __construct( - AddressReferenceBEFromBestAddress $addressImporter, - PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter + private AddressReferenceBEFromBestAddress $addressImporter, + private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter ) { parent::__construct(); - $this->addressImporter = $addressImporter; - $this->postalCodeBEFromBestAddressImporter = $postalCodeBEFromBestAddressImporter; } protected function configure() diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php index 40772d52b..732355a44 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php @@ -19,12 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesFRFromBANOCommand extends Command { - private AddressReferenceFromBano $addressReferenceFromBano; - - public function __construct(AddressReferenceFromBano $addressReferenceFromBano) + public function __construct(private AddressReferenceFromBano $addressReferenceFromBano) { parent::__construct(); - $this->addressReferenceFromBano = $addressReferenceFromBano; } protected function configure() diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index 8c5351b07..702a71403 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -34,13 +34,6 @@ class LoadAndUpdateLanguagesCommand extends Command private $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga', 'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ]; - private $availableLanguages; - - /** - * @var EntityManager - */ - private $entityManager; - // The regional version of language are language with _ in the code // This array contains regional code to not exclude private $regionalVersionToInclude = ['ro_MD']; @@ -50,10 +43,8 @@ class LoadAndUpdateLanguagesCommand extends Command * * @param $availableLanguages */ - public function __construct(EntityManager $entityManager, $availableLanguages) + public function __construct(private EntityManager $entityManager, private $availableLanguages) { - $this->entityManager = $entityManager; - $this->availableLanguages = $availableLanguages; parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index 1dd5a603f..01400a9ad 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -20,22 +20,13 @@ use Symfony\Component\Intl\Intl; class LoadCountriesCommand extends Command { - private $availableLanguages; - - /** - * @var EntityManager - */ - private $entityManager; - /** * LoadCountriesCommand constructor. * * @param $availableLanguages */ - public function __construct(EntityManager $entityManager, $availableLanguages) + public function __construct(private EntityManager $entityManager, private $availableLanguages) { - $this->entityManager = $entityManager; - $this->availableLanguages = $availableLanguages; parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php index 522c36305..6d1999127 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php @@ -18,12 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadPostalCodeFR extends Command { - private PostalCodeFRFromOpenData $loader; - - public function __construct(PostalCodeFRFromOpenData $loader) + public function __construct(private PostalCodeFRFromOpenData $loader) { - $this->loader = $loader; - parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index ea42fde78..208f67cab 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -30,14 +30,8 @@ use function strlen; class LoadPostalCodesCommand extends Command { - private EntityManagerInterface $entityManager; - - private ValidatorInterface $validator; - - public function __construct(EntityManagerInterface $entityManager, ValidatorInterface $validator) + public function __construct(private EntityManagerInterface $entityManager, private ValidatorInterface $validator) { - $this->entityManager = $entityManager; - $this->validator = $validator; parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php index 1a570c3a9..16619bf54 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -26,17 +26,11 @@ use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; */ class SetPasswordCommand extends Command { - /** - * @var EntityManager - */ - private $entityManager; - /** * SetPasswordCommand constructor. */ - public function __construct(EntityManager $entityManager) + public function __construct(private EntityManager $entityManager) { - $this->entityManager = $entityManager; parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index 68f6f7f1d..68a0afdb6 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -28,14 +28,8 @@ use function trim; final class AddressReferenceAPIController extends ApiController { - private AddressReferenceRepository $addressReferenceRepository; - - private PaginatorFactory $paginatorFactory; - - public function __construct(AddressReferenceRepository $addressReferenceRepository, PaginatorFactory $paginatorFactory) + public function __construct(private AddressReferenceRepository $addressReferenceRepository, private PaginatorFactory $paginatorFactory) { - $this->addressReferenceRepository = $addressReferenceRepository; - $this->paginatorFactory = $paginatorFactory; } /** diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index aab63aea3..fc92cd299 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -23,20 +23,8 @@ use Symfony\Component\Serializer\SerializerInterface; class AddressToReferenceMatcherController { - private Security $security; - - private EntityManagerInterface $entityManager; - - private SerializerInterface $serializer; - - public function __construct( - Security $security, - EntityManagerInterface $entityManager, - SerializerInterface $serializer - ) { - $this->security = $security; - $this->entityManager = $entityManager; - $this->serializer = $serializer; + public function __construct(private Security $security, private EntityManagerInterface $entityManager, private SerializerInterface $serializer) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/CenterController.php b/src/Bundle/ChillMainBundle/Controller/CenterController.php index 64d9a4527..af31c67ea 100644 --- a/src/Bundle/ChillMainBundle/Controller/CenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/CenterController.php @@ -47,10 +47,8 @@ class CenterController extends AbstractController /** * Displays a form to edit an existing Center entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -98,10 +96,8 @@ class CenterController extends AbstractController /** * Finds and displays a Center entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -118,10 +114,8 @@ class CenterController extends AbstractController /** * Edits an existing Center entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 6c4ea0269..9e62cacf6 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -47,54 +47,8 @@ use function unserialize; */ class ExportController extends AbstractController { - private EntityManagerInterface $entityManager; - - /** - * @var ExportManager - */ - private $exportManager; - - /** - * @var FormFactoryInterface - */ - private $formFactory; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var ChillRedis - */ - private $redis; - - /** - * @var SessionInterface - */ - private $session; - - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct( - ChillRedis $chillRedis, - ExportManager $exportManager, - FormFactoryInterface $formFactory, - LoggerInterface $logger, - SessionInterface $session, - TranslatorInterface $translator, - EntityManagerInterface $entityManager - ) { - $this->entityManager = $entityManager; - $this->redis = $chillRedis; - $this->exportManager = $exportManager; - $this->formFactory = $formFactory; - $this->logger = $logger; - $this->session = $session; - $this->translator = $translator; + public function __construct(private ChillRedis $redis, private ExportManager $exportManager, private FormFactoryInterface $formFactory, private LoggerInterface $logger, private SessionInterface $session, private TranslatorInterface $translator, private EntityManagerInterface $entityManager) + { } public function downloadResultAction(Request $request, $alias) @@ -221,22 +175,13 @@ class ExportController extends AbstractController $step = $request->query->getAlpha('step', 'centers'); - switch ($step) { - case 'centers': - return $this->selectCentersStep($request, $export, $alias); - - case 'export': - return $this->exportFormStep($request, $export, $alias); - - case 'formatter': - return $this->formatterFormStep($request, $export, $alias); - - case 'generate': - return $this->forwardToGenerate($request, $export, $alias); - - default: - throw $this->createNotFoundException("The given step '{$step}' is invalid"); - } + return match ($step) { + 'centers' => $this->selectCentersStep($request, $export, $alias), + 'export' => $this->exportFormStep($request, $export, $alias), + 'formatter' => $this->formatterFormStep($request, $export, $alias), + 'generate' => $this->forwardToGenerate($request, $export, $alias), + default => throw $this->createNotFoundException("The given step '{$step}' is invalid"), + }; } /** @@ -284,13 +229,12 @@ class ExportController extends AbstractController * * @param string $alias * @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter' - * @param mixed $step */ - protected function createCreateFormExport($alias, $step, $data = []): FormInterface + protected function createCreateFormExport($alias, mixed $step, $data = []): FormInterface { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; - $isGenerate = strpos($step, 'generate_') === 0; + $isGenerate = str_starts_with($step, 'generate_'); $builder = $this->formFactory ->createNamedBuilder(null, FormType::class, [], [ @@ -341,7 +285,7 @@ class ExportController extends AbstractController * * @return \Symfony\Component\HttpFoundation\Response */ - protected function exportFormStep(Request $request, $export, $alias) + protected function exportFormStep(Request $request, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export, $alias) { $exportManager = $this->exportManager; @@ -405,7 +349,7 @@ class ExportController extends AbstractController * * @return \Symfony\Component\HttpFoundation\Response */ - protected function formatterFormStep(Request $request, $export, $alias) + protected function formatterFormStep(Request $request, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export, $alias) { // check we have data from the previous step (export step) $data = $this->session->get('export_step', null); @@ -462,7 +406,7 @@ class ExportController extends AbstractController * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - protected function forwardToGenerate(Request $request, $export, $alias) + protected function forwardToGenerate(Request $request, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export, $alias) { $dataCenters = $this->session->get('centers_step_raw', null); $dataFormatter = $this->session->get('formatter_step_raw', null); @@ -522,12 +466,10 @@ class ExportController extends AbstractController } /** - * @param \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export * @param string $alias - * * @return Response */ - protected function selectCentersStep(Request $request, $export, $alias) + protected function selectCentersStep(Request $request, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export, $alias) { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; @@ -608,7 +550,7 @@ class ExportController extends AbstractController * * @return string the next/current step */ - private function getNextStep($step, $export, $reverse = false) + private function getNextStep($step, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export, $reverse = false) { switch ($step) { case 'centers': diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index 988439de5..6ab4a6e3e 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -24,30 +24,8 @@ use Symfony\Component\Serializer\SerializerInterface; class GeographicalUnitByAddressApiController { - private PaginatorFactory $paginatorFactory; - - private GeographicalUnitRepositoryInterface $geographicalUnitRepository; - - private Security $security; - - private SerializerInterface $serializer; - - /** - * @param PaginatorFactory $paginatorFactory - * @param GeographicalUnitRepositoryInterface $geographicalUnitRepository - * @param Security $security - * @param SerializerInterface $serializer - */ - public function __construct( - PaginatorFactory $paginatorFactory, - GeographicalUnitRepositoryInterface $geographicalUnitRepository, - Security $security, - SerializerInterface $serializer - ) { - $this->paginatorFactory = $paginatorFactory; - $this->geographicalUnitRepository = $geographicalUnitRepository; - $this->security = $security; - $this->serializer = $serializer; + public function __construct(private PaginatorFactory $paginatorFactory, private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private Security $security, private SerializerInterface $serializer) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 62a1dd10c..52810cd97 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -33,28 +33,8 @@ use UnexpectedValueException; */ class NotificationApiController { - private EntityManagerInterface $entityManager; - - private NotificationRepository $notificationRepository; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private SerializerInterface $serializer; - - public function __construct( - EntityManagerInterface $entityManager, - NotificationRepository $notificationRepository, - PaginatorFactory $paginatorFactory, - Security $security, - SerializerInterface $serializer - ) { - $this->entityManager = $entityManager; - $this->notificationRepository = $notificationRepository; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; - $this->serializer = $serializer; + public function __construct(private EntityManagerInterface $entityManager, private NotificationRepository $notificationRepository, private PaginatorFactory $paginatorFactory, private Security $security, private SerializerInterface $serializer) + { } /** @@ -116,20 +96,11 @@ class NotificationApiController throw new RuntimeException('not possible to mark as read by this user'); } - switch ($target) { - case 'read': - $notification->markAsReadBy($user); - - break; - - case 'unread': - $notification->markAsUnreadBy($user); - - break; - - default: - throw new UnexpectedValueException("target not supported: {$target}"); - } + match ($target) { + 'read' => $notification->markAsReadBy($user), + 'unread' => $notification->markAsUnreadBy($user), + default => throw new UnexpectedValueException("target not supported: {$target}"), + }; $this->entityManager->flush(); diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index 327a06df6..d2d37ad77 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -41,44 +41,8 @@ use function in_array; */ class NotificationController extends AbstractController { - private LoggerInterface $chillLogger; - - private EntityManagerInterface $em; - - private LoggerInterface $logger; - - private NotificationHandlerManager $notificationHandlerManager; - - private NotificationRepository $notificationRepository; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private TranslatorInterface $translator; - - private UserRepository $userRepository; - - public function __construct( - EntityManagerInterface $em, - LoggerInterface $chillLogger, - LoggerInterface $logger, - Security $security, - NotificationRepository $notificationRepository, - NotificationHandlerManager $notificationHandlerManager, - PaginatorFactory $paginatorFactory, - TranslatorInterface $translator, - UserRepository $userRepository - ) { - $this->em = $em; - $this->logger = $logger; - $this->chillLogger = $chillLogger; - $this->security = $security; - $this->notificationRepository = $notificationRepository; - $this->notificationHandlerManager = $notificationHandlerManager; - $this->paginatorFactory = $paginatorFactory; - $this->translator = $translator; - $this->userRepository = $userRepository; + public function __construct(private EntityManagerInterface $em, private LoggerInterface $chillLogger, private LoggerInterface $logger, private Security $security, private NotificationRepository $notificationRepository, private NotificationHandlerManager $notificationHandlerManager, private PaginatorFactory $paginatorFactory, private TranslatorInterface $translator, private UserRepository $userRepository) + { } /** @@ -117,7 +81,7 @@ class NotificationController extends AbstractController try { $handler = $this->notificationHandlerManager->getHandler($notification); - } catch (NotificationHandlerNotFound $e) { + } catch (NotificationHandlerNotFound) { throw new BadRequestHttpException('no handler for this notification'); } diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index a9a14b7a1..0151d403e 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -96,7 +96,7 @@ class PasswordController extends AbstractController /** * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function recoverAction(Request $request) + public function recoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { return new Response($this->translator->trans('You are not allowed ' @@ -164,7 +164,7 @@ class PasswordController extends AbstractController * * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse */ - public function requestRecoverAction(Request $request) + public function requestRecoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { return new Response($this->translator->trans('You are not allowed ' diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 9f77e06f4..a28ca46f4 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -24,16 +24,8 @@ use function json_decode; class PermissionApiController extends AbstractController { - private DenormalizerInterface $denormalizer; - - private Security $security; - - public function __construct( - DenormalizerInterface $denormalizer, - Security $security - ) { - $this->denormalizer = $denormalizer; - $this->security = $security; + public function __construct(private DenormalizerInterface $denormalizer, private Security $security) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 5d32a8dbb..f1b485870 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -34,46 +34,11 @@ use function array_key_exists; */ class PermissionsGroupController extends AbstractController { - /** - * @var RoleHierarchy - */ - private $roleHierarchy; - - /** - * @var RoleProvider - */ - private $roleProvider; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var ValidatorInterface - */ - private $validator; - /** * PermissionsGroupController constructor. */ - public function __construct( - TranslatableStringHelper $translatableStringHelper, - RoleProvider $roleProvider, - RoleHierarchy $roleHierarchy, - TranslatorInterface $translator, - ValidatorInterface $validator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->roleProvider = $roleProvider; - $this->roleHierarchy = $roleHierarchy; - $this->translator = $translator; - $this->validator = $validator; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private RoleProvider $roleProvider, private RoleHierarchy $roleHierarchy, private TranslatorInterface $translator, private ValidatorInterface $validator) + { } /** @@ -214,7 +179,7 @@ class PermissionsGroupController extends AbstractController try { $permissionsGroup->removeRoleScope($roleScope); - } catch (RuntimeException $ex) { + } catch (RuntimeException) { $this->addFlash( 'notice', $this->translator->trans("The role '%role%' and circle " @@ -260,10 +225,8 @@ class PermissionsGroupController extends AbstractController /** * Displays a form to edit an existing PermissionsGroup entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -338,10 +301,8 @@ class PermissionsGroupController extends AbstractController /** * Finds and displays a PermissionsGroup entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -393,10 +354,8 @@ class PermissionsGroupController extends AbstractController /** * Edits an existing PermissionsGroup entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index 8e679b228..945ad8fcf 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -26,20 +26,8 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class PostalCodeAPIController extends ApiController { - private CountryRepository $countryRepository; - - private PaginatorFactory $paginatorFactory; - - private PostalCodeRepositoryInterface $postalCodeRepository; - - public function __construct( - CountryRepository $countryRepository, - PostalCodeRepositoryInterface $postalCodeRepository, - PaginatorFactory $paginatorFactory - ) { - $this->countryRepository = $countryRepository; - $this->postalCodeRepository = $postalCodeRepository; - $this->paginatorFactory = $paginatorFactory; + public function __construct(private CountryRepository $countryRepository, private PostalCodeRepositoryInterface $postalCodeRepository, private PaginatorFactory $paginatorFactory) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 197fe253d..f5e84c1b3 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -36,44 +36,8 @@ use function count; class SavedExportController { - private EntityManagerInterface $entityManager; - - private ExportManager $exportManager; - - private FormFactoryInterface $formFactory; - - private SavedExportRepositoryInterface $savedExportRepository; - - private Security $security; - - private SessionInterface $session; - - private EngineInterface $templating; - - private TranslatorInterface $translator; - - private UrlGeneratorInterface $urlGenerator; - - public function __construct( - EngineInterface $templating, - EntityManagerInterface $entityManager, - ExportManager $exportManager, - FormFactoryInterface $formBuilder, - SavedExportRepositoryInterface $savedExportRepository, - Security $security, - SessionInterface $session, - TranslatorInterface $translator, - UrlGeneratorInterface $urlGenerator - ) { - $this->exportManager = $exportManager; - $this->entityManager = $entityManager; - $this->formFactory = $formBuilder; - $this->savedExportRepository = $savedExportRepository; - $this->security = $security; - $this->session = $session; - $this->templating = $templating; - $this->translator = $translator; - $this->urlGenerator = $urlGenerator; + public function __construct(private EngineInterface $templating, private EntityManagerInterface $entityManager, private ExportManager $exportManager, private FormFactoryInterface $formFactory, private SavedExportRepositoryInterface $savedExportRepository, private Security $security, private SessionInterface $session, private TranslatorInterface $translator, private UrlGeneratorInterface $urlGenerator) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/ScopeController.php b/src/Bundle/ChillMainBundle/Controller/ScopeController.php index f3b08204d..542efb4ed 100644 --- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php +++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php @@ -47,10 +47,8 @@ class ScopeController extends AbstractController /** * Displays a form to edit an existing Scope entity. - * - * @param mixed $id */ - public function editAction($id) + public function editAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -98,10 +96,8 @@ class ScopeController extends AbstractController /** * Finds and displays a Scope entity. - * - * @param mixed $id */ - public function showAction($id) + public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); @@ -118,10 +114,8 @@ class ScopeController extends AbstractController /** * Edits an existing Scope entity. - * - * @param mixed $id */ - public function updateAction(Request $request, $id) + public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 7eec60324..dfaaa50d4 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -36,24 +36,8 @@ use function reset; */ class SearchController extends AbstractController { - protected PaginatorFactory $paginatorFactory; - - protected SearchApi $searchApi; - - protected SearchProvider $searchProvider; - - protected TranslatorInterface $translator; - - public function __construct( - SearchProvider $searchProvider, - TranslatorInterface $translator, - PaginatorFactory $paginatorFactory, - SearchApi $searchApi - ) { - $this->searchProvider = $searchProvider; - $this->translator = $translator; - $this->paginatorFactory = $paginatorFactory; - $this->searchApi = $searchApi; + public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) + { } public function advancedSearchAction($name, Request $request) @@ -64,7 +48,7 @@ class SearchController extends AbstractController /** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */ $search = $this->searchProvider ->getHasAdvancedFormByName($name); - } catch (\Chill\MainBundle\Search\UnknowSearchNameException $e) { + } catch (\Chill\MainBundle\Search\UnknowSearchNameException) { throw $this->createNotFoundException('no advanced search for ' . "{$name}"); } diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index c51952b3a..fdb521882 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -22,20 +22,8 @@ use function count; class TimelineCenterController extends AbstractController { - protected PaginatorFactory $paginatorFactory; - - protected TimelineBuilder $timelineBuilder; - - private Security $security; - - public function __construct( - TimelineBuilder $timelineBuilder, - PaginatorFactory $paginatorFactory, - Security $security - ) { - $this->timelineBuilder = $timelineBuilder; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; + public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private Security $security) + { } /** diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php index da873e118..0eb6c711c 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -28,10 +28,8 @@ class UserApiController extends ApiController * "_format": "json" * } * ) - * - * @param mixed $_format */ - public function currentLocation($_format): JsonResponse + public function currentLocation(mixed $_format): JsonResponse { return $this->json( $this->getUser()->getCurrentLocation(), @@ -49,10 +47,8 @@ class UserApiController extends ApiController * "_format": "json" * } * ) - * - * @param mixed $_format */ - public function whoami($_format): JsonResponse + public function whoami(mixed $_format): JsonResponse { return $this->json( $this->getUser(), diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index ecf8a3c9c..f8e512f78 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -38,37 +38,15 @@ class UserController extends CRUDController { public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter'; - protected ParameterBagInterface $parameterBag; - - private LoggerInterface $logger; - - private UserPasswordEncoderInterface $passwordEncoder; - - private UserRepository $userRepository; - - private ValidatorInterface $validator; - - public function __construct( - LoggerInterface $chillLogger, - ValidatorInterface $validator, - UserPasswordEncoderInterface $passwordEncoder, - UserRepository $userRepository, - ParameterBagInterface $parameterBag - ) { - $this->logger = $chillLogger; - $this->userRepository = $userRepository; - $this->validator = $validator; - $this->passwordEncoder = $passwordEncoder; - $this->parameterBag = $parameterBag; + public function __construct(private LoggerInterface $logger, private ValidatorInterface $validator, private UserPasswordEncoderInterface $passwordEncoder, private UserRepository $userRepository, protected ParameterBagInterface $parameterBag) + { } /** * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", * name="admin_user_add_groupcenter") - * - * @param mixed $uid */ - public function addLinkGroupCenterAction(Request $request, $uid): Response + public function addLinkGroupCenterAction(Request $request, mixed $uid): Response { $em = $this->getDoctrine()->getManager(); @@ -122,11 +100,8 @@ class UserController extends CRUDController /** * @Route("/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}", * name="admin_user_delete_groupcenter") - * - * @param mixed $uid - * @param mixed $gcid */ - public function deleteLinkGroupCenterAction($uid, $gcid, Request $request): RedirectResponse + public function deleteLinkGroupCenterAction(mixed $uid, mixed $gcid, Request $request): RedirectResponse { $em = $this->getDoctrine()->getManager(); @@ -421,10 +396,8 @@ class UserController extends CRUDController /** * Creates a form to delete a link to a GroupCenter. - * - * @param mixed $request */ - private function createDeleteLinkGroupCenterForm(User $user, GroupCenter $groupCenter, $request): FormInterface + private function createDeleteLinkGroupCenterForm(User $user, GroupCenter $groupCenter, mixed $request): FormInterface { $returnPathParams = $request->query->has('returnPath') ? ['returnPath' => $request->query->get('returnPath')] : []; diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index f0e728252..dfb06d3df 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -30,28 +30,8 @@ use Symfony\Component\Serializer\SerializerInterface; class WorkflowApiController { - private EntityManagerInterface $entityManager; - - private EntityWorkflowRepository $entityWorkflowRepository; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private SerializerInterface $serializer; - - public function __construct( - EntityManagerInterface $entityManager, - EntityWorkflowRepository $entityWorkflowRepository, - PaginatorFactory $paginatorFactory, - Security $security, - SerializerInterface $serializer - ) { - $this->entityManager = $entityManager; - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; - $this->serializer = $serializer; + public function __construct(private EntityManagerInterface $entityManager, private EntityWorkflowRepository $entityWorkflowRepository, private PaginatorFactory $paginatorFactory, private Security $security, private SerializerInterface $serializer) + { } /** @@ -160,46 +140,19 @@ class WorkflowApiController $user = $this->security->getUser(); - switch ($request->query->get('subscribe')) { - case 'final': - switch ($action) { - case 'subscribe': - $entityWorkflow->addSubscriberToFinal($user); - - break; - - case 'unsubscribe': - $entityWorkflow->removeSubscriberToFinal($user); - - break; - - default: - throw new LogicException(); - } - - break; - - case 'step': - switch ($action) { - case 'subscribe': - $entityWorkflow->addSubscriberToStep($user); - - break; - - case 'unsubscribe': - $entityWorkflow->removeSubscriberToStep($user); - - break; - - default: - throw new LogicException(); - } - - break; - - default: - throw new BadRequestHttpException('subscribe parameter must be equal to "step" or "final"'); - } + match ($request->query->get('subscribe')) { + 'final' => match ($action) { + 'subscribe' => $entityWorkflow->addSubscriberToFinal($user), + 'unsubscribe' => $entityWorkflow->removeSubscriberToFinal($user), + default => throw new LogicException(), + }, + 'step' => match ($action) { + 'subscribe' => $entityWorkflow->addSubscriberToStep($user), + 'unsubscribe' => $entityWorkflow->removeSubscriberToStep($user), + default => throw new LogicException(), + }, + default => throw new BadRequestHttpException('subscribe parameter must be equal to "step" or "final"'), + }; $this->entityManager->flush(); diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index 36647612b..b3d2ad475 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -39,32 +39,8 @@ use function count; class WorkflowController extends AbstractController { - private EntityManagerInterface $entityManager; - - private EntityWorkflowManager $entityWorkflowManager; - - private EntityWorkflowRepository $entityWorkflowRepository; - - private PaginatorFactory $paginatorFactory; - - private Registry $registry; - - private Security $security; - - private TranslatorInterface $translator; - - private ValidatorInterface $validator; - - public function __construct(EntityWorkflowManager $entityWorkflowManager, EntityWorkflowRepository $entityWorkflowRepository, ValidatorInterface $validator, PaginatorFactory $paginatorFactory, Registry $registry, EntityManagerInterface $entityManager, TranslatorInterface $translator, Security $security) + public function __construct(private EntityWorkflowManager $entityWorkflowManager, private EntityWorkflowRepository $entityWorkflowRepository, private ValidatorInterface $validator, private PaginatorFactory $paginatorFactory, private Registry $registry, private EntityManagerInterface $entityManager, private TranslatorInterface $translator, private Security $security) { - $this->entityWorkflowManager = $entityWorkflowManager; - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->validator = $validator; - $this->paginatorFactory = $paginatorFactory; - $this->registry = $registry; - $this->entityManager = $entityManager; - $this->translator = $translator; - $this->security = $security; } /** diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index f69dcba76..0bf928ee1 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -46,30 +46,11 @@ class CronManager implements CronManagerInterface private const UPDATE_BEFORE_EXEC = 'UPDATE ' . CronJobExecution::class . ' cr SET cr.lastStart = :now WHERE cr.key = :key'; - private CronJobExecutionRepositoryInterface $cronJobExecutionRepository; - - private EntityManagerInterface $entityManager; - - /** - * @var iterable - */ - private iterable $jobs; - - private LoggerInterface $logger; - /** * @param CronJobInterface[] $jobs */ - public function __construct( - CronJobExecutionRepositoryInterface $cronJobExecutionRepository, - EntityManagerInterface $entityManager, - iterable $jobs, - LoggerInterface $logger - ) { - $this->cronJobExecutionRepository = $cronJobExecutionRepository; - $this->entityManager = $entityManager; - $this->jobs = $jobs; - $this->logger = $logger; + public function __construct(private CronJobExecutionRepositoryInterface $cronJobExecutionRepository, private EntityManagerInterface $entityManager, private iterable $jobs, private LoggerInterface $logger) + { } public function run(?string $forceJob = null): void @@ -115,7 +96,7 @@ class CronManager implements CronManagerInterface $this->logger->info(sprintf('%sSuccessfully run job', self::LOG_PREFIX), ['job' => $job->getKey()]); return; - } catch (Exception $e) { + } catch (Exception) { $this->logger->error(sprintf('%sRunning job failed', self::LOG_PREFIX), ['job' => $job->getKey()]); $this->entityManager ->createQuery(self::UPDATE_AFTER_EXEC) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index c86a69be2..2da35e7ef 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -93,10 +93,7 @@ class ChillMainExtension extends Extension implements $this->widgetFactories[] = $factory; } - /** - * @return \Chill\MainBundle\DependencyInjection\Configuration|object|\Symfony\Component\Config\Definition\ConfigurationInterface|null - */ - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): \Chill\MainBundle\DependencyInjection\Configuration|object|\Symfony\Component\Config\Definition\ConfigurationInterface|null { return new Configuration($this->widgetFactories, $container); } diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ACLFlagsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ACLFlagsCompilerPass.php index 40baccfc0..70efbf409 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ACLFlagsCompilerPass.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ACLFlagsCompilerPass.php @@ -27,21 +27,16 @@ class ACLFlagsCompilerPass implements CompilerPassInterface $reference = new Reference($id); foreach ($tags as $tag) { - switch ($tag['scope']) { - case PermissionsGroupType::FLAG_SCOPE: - $permissionGroupType->addMethodCall('addFlagProvider', [$reference]); - - break; - - default: - throw new LogicException( - sprintf( - "This tag 'scope' is not implemented: %s, on service with id %s", - $tag['scope'], - $id - ) - ); - } + match ($tag['scope']) { + PermissionsGroupType::FLAG_SCOPE => $permissionGroupType->addMethodCall('addFlagProvider', [$reference]), + default => throw new LogicException( + sprintf( + "This tag 'scope' is not implemented: %s, on service with id %s", + $tag['scope'], + $id + ) + ), + }; } } } diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 4605f35ab..0c5fd56c9 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -24,14 +24,11 @@ class Configuration implements ConfigurationInterface { use AddWidgetConfigurationTrait; - private ContainerBuilder $containerBuilder; - public function __construct( array $widgetFactories, - ContainerBuilder $containerBuilder + private ContainerBuilder $containerBuilder ) { $this->setWidgetFactories($widgetFactories); - $this->containerBuilder = $containerBuilder; } public function getConfigTreeBuilder() diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php index d5234bfbe..70a3e2ea1 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php @@ -153,7 +153,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface $extension, HasWidgetFactoriesExtensionInterface::class, HasWidgetFactoriesExtensionInterface::class, - get_class($extensionClass) + $extensionClass::class )); } @@ -277,7 +277,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface if (empty($alias)) { throw new LogicException(sprintf( 'the widget factory %s returns an empty alias', - get_class($factory) + $factory::class )); } @@ -285,13 +285,13 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface if (!is_array($factory->getAllowedPlaces())) { throw new UnexpectedValueException("the method 'getAllowedPlaces' " . 'should return a non-empty array. Unexpected value on ' . - get_class($factory)); + $factory::class); } if (count($factory->getAllowedPlaces()) === 0) { throw new LengthException("The method 'getAllowedPlaces' should " . 'return a non-empty array, but returned 0 elements on ' . - get_class($factory) . '::getAllowedPlaces()'); + $factory::class . '::getAllowedPlaces()'); } // check the alias does not exists yet @@ -365,12 +365,10 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface /** * get the places where the service is allowed. * - * @param mixed $place - * @param mixed $widgetAlias * * @return unknown */ - private function isPlaceAllowedForWidget($place, $widgetAlias, ContainerBuilder $container) + private function isPlaceAllowedForWidget(mixed $place, mixed $widgetAlias, ContainerBuilder $container) { if ($this->widgetServices[$widgetAlias] instanceof WidgetFactoryInterface) { if ( diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/OverlapsI.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/OverlapsI.php index 29642dc15..89ba084c4 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/OverlapsI.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/OverlapsI.php @@ -73,20 +73,11 @@ class OverlapsI extends FunctionNode protected function makeCase($sqlWalker, $part, string $position): string { - switch ($position) { - case 'start': - $p = '-infinity'; - - break; - - case 'end': - $p = 'infinity'; - - break; - - default: - throw new Exception('Unexpected position value.'); - } + $p = match ($position) { + 'start' => '-infinity', + 'end' => 'infinity', + default => throw new Exception('Unexpected position value.'), + }; if ($part instanceof PathExpression) { return sprintf( diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index bf493c344..0c8159df3 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -22,11 +22,8 @@ use Symfony\Component\Security\Core\Security; class TrackCreateUpdateSubscriber implements EventSubscriber { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function getSubscribedEvents() diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index 684030ee3..de73bdf5a 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -20,14 +20,8 @@ class Point implements JsonSerializable { public static string $SRID = '4326'; - private ?float $lat; - - private ?float $lon; - - private function __construct(?float $lon, ?float $lat) + private function __construct(private ?float $lon, private ?float $lat) { - $this->lat = $lat; - $this->lon = $lon; } public static function fromArrayGeoJson(array $array): self diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php index 896ddb600..91033ec0b 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php @@ -91,28 +91,12 @@ class NativeDateIntervalType extends DateIntervalType if (is_numeric($current)) { $next = next($strings); - switch ($next) { - case 'year': - case 'years': - $unit = 'Y'; - - break; - - case 'mon': - case 'mons': - $unit = 'M'; - - break; - - case 'day': - case 'days': - $unit = 'D'; - - break; - - default: - throw $this->createConversionException(implode('', $strings)); - } + $unit = match ($next) { + 'year', 'years' => 'Y', + 'mon', 'mons' => 'M', + 'day', 'days' => 'D', + default => throw $this->createConversionException(implode('', $strings)), + }; return $current . $unit; } diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php index 3f74c62a3..e1849574b 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php @@ -44,10 +44,8 @@ class PointType extends Type /** * @param mixed $value - * - * @return ?Point */ - public function convertToPHPValue($value, AbstractPlatform $platform) + public function convertToPHPValue($value, AbstractPlatform $platform): ?\Chill\MainBundle\Doctrine\Model\Point { if (null === $value) { return null; diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 1bd1a453a..52e8d7c62 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -399,9 +399,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface return $this->streetNumber; } - /** - * @return DateTime - */ public function getValidFrom(): DateTime { return $this->validFrom; @@ -567,7 +564,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @param string $streetAddress1 * - * @return Address * @deprecated */ public function setStreetAddress1(?string $streetAddress1): self @@ -582,7 +578,6 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @param string $streetAddress2 * @deprecated - * @return Address */ public function setStreetAddress2(?string $streetAddress2): self { diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php index 5ca051ec0..e4c42ba7e 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -20,7 +20,7 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * @ORM\Table(name="centers") */ -class Center implements HasCenterInterface +class Center implements HasCenterInterface, \Stringable { /** * @var Collection @@ -59,7 +59,7 @@ class Center implements HasCenterInterface /** * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } @@ -85,7 +85,7 @@ class Center implements HasCenterInterface /** * @return ArrayCollection|Collection */ - public function getGroupCenters() + public function getGroupCenters(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->groupCenters; } diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 5ed82445c..0263e3b64 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -79,9 +79,6 @@ class Civility return $this->order; } - /** - * @return Civility - */ public function setAbbreviation(array $abbreviation): self { $this->abbreviation = $abbreviation; diff --git a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php index 0cacffac9..ea3d47f72 100644 --- a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php +++ b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php @@ -24,12 +24,6 @@ class CronJobExecution public const SUCCESS = 1; - /** - * @ORM\Column(type="text", nullable=false) - * @ORM\Id - */ - private string $key; - /** * @var DateTimeImmutable * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) @@ -46,9 +40,12 @@ class CronJobExecution */ private ?int $lastStatus = null; - public function __construct(string $key) - { - $this->key = $key; + public function __construct(/** + * @ORM\Column(type="text", nullable=false) + * @ORM\Id + */ + private string $key + ) { $this->lastStart = new DateTimeImmutable('now'); } diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index 7add53066..987cb05ec 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -20,39 +20,31 @@ use Symfony\Component\Serializer\Annotation as Serializer; */ class SimpleGeographicalUnitDTO { - /** - * @readonly - * @psalm-readonly - * @Serializer\Groups({"read"}) - */ - public int $id; - - /** - * @readonly - * @psalm-readonly - * @Serializer\Groups({"read"}) - */ - public int $layerId; - - /** - * @readonly - * @psalm-readonly - * @Serializer\Groups({"read"}) - */ - public string $unitName; - - /** - * @readonly - * @psalm-readonly - * @Serializer\Groups({"read"}) - */ - public string $unitRefId; - - public function __construct(int $id, string $unitName, string $unitRefId, int $layerId) - { - $this->id = $id; - $this->unitName = $unitName; - $this->unitRefId = $unitRefId; - $this->layerId = $layerId; + public function __construct( + /** + * @readonly + * @psalm-readonly + * @Serializer\Groups({"read"}) + */ + public int $id, + /** + * @readonly + * @psalm-readonly + * @Serializer\Groups({"read"}) + */ + public string $unitName, + /** + * @readonly + * @psalm-readonly + * @Serializer\Groups({"read"}) + */ + public string $unitRefId, + /** + * @readonly + * @psalm-readonly + * @Serializer\Groups({"read"}) + */ + public int $layerId + ) { } } diff --git a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php index 6c0d0be5b..a32fa978b 100644 --- a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php +++ b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php @@ -109,7 +109,7 @@ class PermissionsGroup /** * @return ArrayCollection|Collection */ - public function getRoleScopes() + public function getRoleScopes(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->roleScopes; } diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index a8ef88fbe..6ea9b81f8 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -32,7 +32,7 @@ use function in_array; * "user": User::class * }) */ -class User implements UserInterface +class User implements UserInterface, \Stringable { /** * @ORM\Id @@ -158,14 +158,12 @@ class User implements UserInterface /** * @return string */ - public function __toString() + public function __toString(): string { return $this->getLabel(); } /** - * @param \Chill\MainBundle\Entity\GroupCenter $groupCenter - * * @return \Chill\MainBundle\Entity\User */ public function addGroupCenter(GroupCenter $groupCenter) @@ -359,8 +357,6 @@ class User implements UserInterface } /** - * @param \Chill\MainBundle\Entity\GroupCenter $groupCenter - * * @throws RuntimeException if the groupCenter is not in the collection */ public function removeGroupCenter(GroupCenter $groupCenter) diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index d0f558cd5..8dfc400f7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -294,7 +294,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface /** * @return ArrayCollection|Collection */ - public function getSteps() + public function getSteps(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->steps; } @@ -335,7 +335,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface /** * @return ArrayCollection|Collection */ - public function getSubscriberToFinal() + public function getSubscriberToFinal(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->subscriberToFinal; } @@ -343,7 +343,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface /** * @return ArrayCollection|Collection */ - public function getSubscriberToStep() + public function getSubscriberToStep(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection { return $this->subscriberToStep; } diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 1f3070eb2..75d055ce3 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -356,8 +356,6 @@ class EntityWorkflowStep } /** - * @return EntityWorkflowStep - * * @internal */ public function setNext(?EntityWorkflowStep $next): self @@ -368,8 +366,6 @@ class EntityWorkflowStep } /** - * @return EntityWorkflowStep - * * @internal */ public function setPrevious(?EntityWorkflowStep $previous): self @@ -409,10 +405,8 @@ class EntityWorkflowStep /** * @Assert\Callback - * - * @param mixed $payload */ - public function validateOnCreation(ExecutionContextInterface $context, $payload): void + public function validateOnCreation(ExecutionContextInterface $context, mixed $payload): void { return; diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index f39926083..9b8fb340e 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -44,10 +44,6 @@ class ExportManager */ private array $aggregators = []; - private AuthorizationCheckerInterface $authorizationChecker; - - private AuthorizationHelperInterface $authorizationHelper; - /** * Collected Exports, injected by DI. * @@ -69,17 +65,15 @@ class ExportManager */ private array $formatters = []; - private LoggerInterface $logger; - /** * @var \Symfony\Component\Security\Core\User\UserInterface */ private $user; public function __construct( - LoggerInterface $logger, - AuthorizationCheckerInterface $authorizationChecker, - AuthorizationHelperInterface $authorizationHelper, + private LoggerInterface $logger, + private AuthorizationCheckerInterface $authorizationChecker, + private AuthorizationHelperInterface $authorizationHelper, TokenStorageInterface $tokenStorage, iterable $exports, iterable $aggregators, @@ -87,9 +81,6 @@ class ExportManager //iterable $formatters, //iterable $exportElementProvider ) { - $this->logger = $logger; - $this->authorizationChecker = $authorizationChecker; - $this->authorizationHelper = $authorizationHelper; $this->user = $tokenStorage->getToken()->getUser(); $this->exports = iterator_to_array($exports); $this->aggregators = iterator_to_array($aggregators); @@ -163,7 +154,7 @@ class ExportManager } elseif ($element instanceof FormatterInterface) { $this->addFormatter($element, $alias); } else { - throw new LogicException('This element ' . get_class($element) . ' ' + throw new LogicException('This element ' . $element::class . ' ' . 'is not an instance of export element'); } } @@ -468,12 +459,10 @@ class ExportManager * Return true if the current user has access to the ExportElement for every * center, false if the user hasn't access to element for at least one center. * - * @param \Chill\MainBundle\Export\ExportElementInterface $element - * @param DirectExportInterface|ExportInterface $export * * @return bool */ - public function isGrantedForElement(ExportElementInterface $element, ?ExportElementInterface $export = null, ?array $centers = null) + public function isGrantedForElement(ExportElementInterface $element, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export = null, ?array $centers = null) { if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) { $role = $element->requiredRole(); @@ -506,7 +495,7 @@ class ExportManager //debugging $this->logger->debug('user has no access to element', [ 'method' => __METHOD__, - 'type' => get_class($element), + 'type' => $element::class, 'center' => $center->getName(), 'role' => $role, ]); @@ -577,7 +566,7 @@ class ExportManager private function handleFilters( ExportInterface $export, QueryBuilder $qb, - $data, + mixed $data, array $centers ) { $filters = $this->retrieveUsedFilters($data); @@ -598,11 +587,9 @@ class ExportManager } /** - * @param mixed $data - * * @return AggregatorInterface[] */ - private function retrieveUsedAggregators($data) + private function retrieveUsedAggregators(mixed $data) { if (null === $data) { return []; @@ -616,11 +603,9 @@ class ExportManager } /** - * @param mixed $data - * * @return string[] */ - private function retrieveUsedAggregatorsType($data) + private function retrieveUsedAggregatorsType(mixed $data) { if (null === $data) { return []; @@ -660,7 +645,7 @@ class ExportManager * * @return array an array with types */ - private function retrieveUsedFiltersType($data) + private function retrieveUsedFiltersType(mixed $data) { if (null === $data) { return []; @@ -684,11 +669,10 @@ class ExportManager /** * parse the data to retrieve the used filters and aggregators. * - * @param mixed $data * * @return string[] */ - private function retrieveUsedModifiers($data) + private function retrieveUsedModifiers(mixed $data) { if (null === $data) { return []; diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php index c8b20a88b..ef5059e9d 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php @@ -56,13 +56,10 @@ class CSVFormatter implements FormatterInterface protected $result; - protected TranslatorInterface $translator; - public function __construct( - TranslatorInterface $translator, + protected TranslatorInterface $translator, ExportManager $manager ) { - $this->translator = $translator; $this->exportManager = $manager; } diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php index dc09c55a1..99af717f8 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php @@ -347,27 +347,12 @@ class SpreadSheetFormatter implements FormatterInterface $line = $this->addContentTable($worksheet, $sortedResult, $line); - switch ($this->formatterData['format']) { - case 'ods': - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods'); - - break; - - case 'xlsx': - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); - - break; - - case 'csv': - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv'); - - break; - - default: - // this should not happen - // throw an exception to ensure that the error is catched - throw new LogicException(); - } + $writer = match ($this->formatterData['format']) { + 'ods' => \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods'), + 'xlsx' => \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'), + 'csv' => \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv'), + default => throw new LogicException(), + }; $writer->save($this->tempfile); } @@ -435,11 +420,10 @@ class SpreadSheetFormatter implements FormatterInterface * Get the displayable result. * * @param string $key - * @param mixed $value * * @return string */ - protected function getDisplayableResult($key, $value) + protected function getDisplayableResult($key, mixed $value) { if (false === $this->cacheDisplayableResultIsInitialized) { $this->initializeCache($key); diff --git a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 1c2c99083..6b780715b 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -18,11 +18,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class DateTimeHelper { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function getLabel($header): callable diff --git a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php index fca338a6f..465fe6608 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -74,14 +74,6 @@ class ExportAddressHelper 'geographical_units' => ['_unit_names', '_unit_refs'], ]; - private AddressRender $addressRender; - - private AddressRepository $addressRepository; - - private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - /** * @var array>|null */ @@ -92,16 +84,8 @@ class ExportAddressHelper */ private ?array $unitRefsKeysCache = []; - public function __construct( - AddressRender $addressRender, - AddressRepository $addressRepository, - GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->addressRepository = $addressRepository; - $this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->addressRender = $addressRender; + public function __construct(private AddressRender $addressRender, private AddressRepository $addressRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addSelectClauses(int $params, QueryBuilder $queryBuilder, $entityName = 'address', $prefix = 'add') @@ -369,16 +353,11 @@ class ExportAddressHelper $decodedValues = json_decode($value, true, 512, JSON_THROW_ON_ERROR); - switch (count($decodedValues)) { - case 0: - return ''; - - case 1: - return $decodedValues[0]; - - default: - return implode('|', $decodedValues); - } + return match (count($decodedValues)) { + 0 => '', + 1 => $decodedValues[0], + default => implode('|', $decodedValues), + }; }; } diff --git a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php index 9b49d476b..37a41325e 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -21,11 +21,8 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ class TranslatableStringExportLabelHelper { - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function getLabel(string $key, array $values, string $header) diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index 2821bf1a6..cb13ac1c9 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -18,14 +18,8 @@ use const SORT_NUMERIC; class UserHelper { - private UserRender $userRender; - - private UserRepositoryInterface $userRepository; - - public function __construct(UserRender $userRender, UserRepositoryInterface $userRepository) + public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) { - $this->userRender = $userRender; - $this->userRepository = $userRepository; } public function getLabel($key, array $values, string $header): callable diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index e8c7e6c5a..18fceeb5c 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -19,11 +19,8 @@ use Symfony\Component\Security\Core\Security; final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function mapDataToForms($viewData, $forms) diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index ebae9f2b9..bb5f64895 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -16,14 +16,8 @@ use Symfony\Component\Form\DataMapperInterface; class ScopePickerDataMapper implements DataMapperInterface { - /** - * @var \Chill\MainBundle\Entity\Scope - */ - private $scope; - - public function __construct(?Scope $scope = null) + public function __construct(private ?Scope $scope = null) { - $this->scope = $scope; } public function mapDataToForms($data, $forms) diff --git a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php index 6aa5eee40..48dd0dc7c 100644 --- a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php @@ -31,17 +31,11 @@ class IdToEntityDataTransformer implements DataTransformerInterface { private Closure $getId; - private bool $multiple = false; - - private ObjectRepository $repository; - /** * @param Closure $getId */ - public function __construct(ObjectRepository $repository, bool $multiple = false, ?callable $getId = null) + public function __construct(private ObjectRepository $repository, private bool $multiple = false, ?callable $getId = null) { - $this->repository = $repository; - $this->multiple = $multiple; $this->getId = $getId ?? static fn (object $o) => $o->getId(); } diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php index 3c58ddc7c..2f64f0699 100644 --- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php +++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php @@ -17,14 +17,8 @@ class CustomizeFormEvent extends \Symfony\Component\EventDispatcher\Event { public const NAME = 'chill_main.customize_form'; - protected FormBuilderInterface $builder; - - protected string $type; - - public function __construct(string $type, FormBuilderInterface $builder) + public function __construct(protected string $type, protected FormBuilderInterface $builder) { - $this->type = $type; - $this->builder = $builder; } public function getBuilder(): FormBuilderInterface diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php index ff2c563d3..dd102dfc6 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -24,11 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class LocationFormType extends AbstractType { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php index 38f1475d5..d9a469dec 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php @@ -43,18 +43,12 @@ class ComposedRoleScopeType extends AbstractType */ private $rolesWithoutScope = []; - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - public function __construct( - TranslatableStringHelper $translatableStringHelper, + private TranslatableStringHelper $translatableStringHelper, RoleProvider $roleProvider ) { $this->roles = $roleProvider->getRoles(); $this->rolesWithoutScope = $roleProvider->getRolesWithoutScopes(); - $this->translatableStringHelper = $translatableStringHelper; $this->roleProvider = $roleProvider; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php index 844834177..a9774d06e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php @@ -17,11 +17,8 @@ use Symfony\Component\Form\Exception\TransformationFailedException; final class AddressToIdDataTransformer implements DataTransformerInterface { - private AddressRepository $addressRepository; - - public function __construct(AddressRepository $addressRepository) + public function __construct(private AddressRepository $addressRepository) { - $this->addressRepository = $addressRepository; } public function reverseTransform($value) diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index 48807655c..b195a5905 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -23,16 +23,8 @@ use function count; class CenterTransformer implements DataTransformerInterface { - private CenterRepository $centerRepository; - - private bool $multiple = false; - - public function __construct( - CenterRepository $centerRepository, - bool $multiple = false - ) { - $this->centerRepository = $centerRepository; - $this->multiple = $multiple; + public function __construct(private CenterRepository $centerRepository, private bool $multiple = false) + { } public function reverseTransform($id) diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php index 529bd9789..109e83b14 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -25,20 +25,8 @@ use function array_key_exists; class EntityToJsonTransformer implements DataTransformerInterface { - private DenormalizerInterface $denormalizer; - - private bool $multiple; - - private SerializerInterface $serializer; - - private string $type; - - public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, bool $multiple, string $type) + public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private bool $multiple, private string $type) { - $this->denormalizer = $denormalizer; - $this->serializer = $serializer; - $this->multiple = $multiple; - $this->type = $type; } public function reverseTransform($value) @@ -87,25 +75,12 @@ class EntityToJsonTransformer implements DataTransformerInterface throw new TransformationFailedException('the key "id" is missing on element'); } - switch ($this->type) { - case 'user': - $class = User::class; - - break; - - case 'person': - $class = Person::class; - - break; - - case 'thirdparty': - $class = ThirdParty::class; - - break; - - default: - throw new UnexpectedValueException('This type is not supported'); - } + $class = match ($this->type) { + 'user' => User::class, + 'person' => Person::class, + 'thirdparty' => ThirdParty::class, + default => throw new UnexpectedValueException('This type is not supported'), + }; return $this->denormalizer->denormalize( diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php index a21f49b2c..345df74bd 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php @@ -17,14 +17,8 @@ use Symfony\Component\Form\DataTransformerInterface; class MultipleObjectsToIdTransformer implements DataTransformerInterface { - private ?string $class; - - private EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em, ?string $class = null) + public function __construct(private EntityManagerInterface $em, private ?string $class = null) { - $this->em = $em; - $this->class = $class; } /** diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php index 1e4ee2439..fe87fdb6c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php @@ -17,14 +17,8 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ObjectToIdTransformer implements DataTransformerInterface { - private ?string $class; - - private EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em, ?string $class = null) + public function __construct(private EntityManagerInterface $em, private ?string $class = null) { - $this->em = $em; - $this->class = $class; } /** @@ -33,10 +27,8 @@ class ObjectToIdTransformer implements DataTransformerInterface * @param string $id * * @throws TransformationFailedException if object is not found. - * - * @return object|null */ - public function reverseTransform($id) + public function reverseTransform($id): ?object { if (null === $id) { return null; diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php index ca488fe1a..d18e3de8c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php @@ -20,11 +20,8 @@ use function is_int; class PostalCodeToIdTransformer implements DataTransformerInterface { - private PostalCodeRepositoryInterface $postalCodeRepository; - - public function __construct(PostalCodeRepositoryInterface $postalCodeRepository) + public function __construct(private PostalCodeRepositoryInterface $postalCodeRepository) { - $this->postalCodeRepository = $postalCodeRepository; } public function reverseTransform($value) diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php index 5ae26ec79..bdd981706 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php @@ -18,11 +18,8 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ScopeTransformer implements DataTransformerInterface { - private EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { - $this->em = $em; } public function reverseTransform($id) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index c89907cf3..ef8dfb62e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -33,24 +33,15 @@ final class PickCenterType extends AbstractType { public const CENTERS_IDENTIFIERS = 'c'; - private AuthorizationHelperInterface $authorizationHelper; - - private ExportManager $exportManager; - - private RegroupmentRepository $regroupmentRepository; - private UserInterface $user; public function __construct( TokenStorageInterface $tokenStorage, - ExportManager $exportManager, - RegroupmentRepository $regroupmentRepository, - AuthorizationHelperInterface $authorizationHelper + private ExportManager $exportManager, + private RegroupmentRepository $regroupmentRepository, + private AuthorizationHelperInterface $authorizationHelper ) { - $this->exportManager = $exportManager; $this->user = $tokenStorage->getToken()->getUser(); - $this->authorizationHelper = $authorizationHelper; - $this->regroupmentRepository = $regroupmentRepository; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index aaa6afa24..d0dbfbe53 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -27,11 +27,8 @@ use function count; final class FilterOrderType extends \Symfony\Component\Form\AbstractType { - private RequestStack $requestStack; - - public function __construct(RequestStack $requestStack) + public function __construct(private RequestStack $requestStack) { - $this->requestStack = $requestStack; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php index 50d6f4eb7..dbbdf502f 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php @@ -43,16 +43,8 @@ use function uniqid; */ final class PickAddressType extends AbstractType { - private AddressToIdDataTransformer $addressToIdDataTransformer; - - private TranslatorInterface $translator; - - public function __construct( - AddressToIdDataTransformer $addressToIdDataTransformer, - TranslatorInterface $translator - ) { - $this->addressToIdDataTransformer = $addressToIdDataTransformer; - $this->translator = $translator; + public function __construct(private AddressToIdDataTransformer $addressToIdDataTransformer, private TranslatorInterface $translator) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php index 83e957623..be7c51950 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -38,20 +38,8 @@ use function count; */ class PickCenterType extends AbstractType { - protected AuthorizationHelperInterface $authorizationHelper; - - protected CenterRepository $centerRepository; - - protected Security $security; - - public function __construct( - AuthorizationHelperInterface $authorizationHelper, - Security $security, - CenterRepository $centerRepository - ) { - $this->authorizationHelper = $authorizationHelper; - $this->security = $security; - $this->centerRepository = $centerRepository; + public function __construct(protected AuthorizationHelperInterface $authorizationHelper, protected Security $security, protected CenterRepository $centerRepository) + { } /** diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php index adb0f2a67..2a7ab259c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php @@ -21,11 +21,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickCivilityType extends AbstractType { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php index 3d993c9f1..cc9737270 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php @@ -19,11 +19,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickLocationTypeType extends AbstractType { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php index d1feacd6a..2ef990704 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php @@ -21,11 +21,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickPostalCodeType extends AbstractType { - private PostalCodeToIdTransformer $postalCodeToIdTransformer; - - public function __construct(PostalCodeToIdTransformer $postalCodeToIdTransformer) + public function __construct(private PostalCodeToIdTransformer $postalCodeToIdTransformer) { - $this->postalCodeToIdTransformer = $postalCodeToIdTransformer; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index f6c2b7f4a..1b0a3c6e0 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -27,17 +27,8 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickUserDynamicType extends AbstractType { - private DenormalizerInterface $denormalizer; - - private NormalizerInterface $normalizer; - - private SerializerInterface $serializer; - - public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer) + public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) { - $this->denormalizer = $denormalizer; - $this->serializer = $serializer; - $this->normalizer = $normalizer; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php index d78957f29..cc8171c4a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php @@ -20,14 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickUserLocationType extends AbstractType { - private LocationRepository $locationRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper, LocationRepository $locationRepository) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private LocationRepository $locationRepository) { - $this->translatableStringHelper = $translatableStringHelper; - $this->locationRepository = $locationRepository; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 5c29f4d42..82b9feade 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -24,14 +24,11 @@ use Symfony\Component\Security\Core\User\UserInterface; class PrivateCommentType extends AbstractType { - protected PrivateCommentDataMapper $dataMapper; - protected UserInterface $user; - public function __construct(TokenStorageInterface $tokenStorage, PrivateCommentDataMapper $dataMapper) + public function __construct(TokenStorageInterface $tokenStorage, protected PrivateCommentDataMapper $dataMapper) { $this->user = $tokenStorage->getToken()->getUser(); - $this->dataMapper = $dataMapper; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index c86684a8a..28894a421 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -42,20 +42,8 @@ use function count; */ class ScopePickerType extends AbstractType { - private AuthorizationHelperInterface $authorizationHelper; - - private Security $security; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - AuthorizationHelperInterface $authorizationHelper, - Security $security, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->authorizationHelper = $authorizationHelper; - $this->security = $security; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php index bc4d7d3ef..c22c3f523 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -29,24 +29,8 @@ use const SORT_STRING; */ class Select2CountryType extends AbstractType { - protected ParameterBagInterface $parameterBag; - - protected TranslatableStringHelper $translatableStringHelper; - - private ObjectManager $em; - - private RequestStack $requestStack; - - public function __construct( - RequestStack $requestStack, - ObjectManager $em, - TranslatableStringHelper $translatableStringHelper, - ParameterBagInterface $parameterBag - ) { - $this->requestStack = $requestStack; - $this->em = $em; - $this->translatableStringHelper = $translatableStringHelper; - $this->parameterBag = $parameterBag; + public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index 328f3c174..7e5adb0cf 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -29,24 +29,8 @@ use const SORT_STRING; */ class Select2LanguageType extends AbstractType { - protected ParameterBagInterface $parameterBag; - - protected TranslatableStringHelper $translatableStringHelper; - - private ObjectManager $em; - - private RequestStack $requestStack; - - public function __construct( - RequestStack $requestStack, - ObjectManager $em, - TranslatableStringHelper $translatableStringHelper, - ParameterBagInterface $parameterBag - ) { - $this->requestStack = $requestStack; - $this->em = $em; - $this->translatableStringHelper = $translatableStringHelper; - $this->parameterBag = $parameterBag; + public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php index ee39ef75e..580f2ca09 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php @@ -24,13 +24,12 @@ use function in_array; class TranslatableStringFormType extends AbstractType { - private $availableLanguages; // The langauges availaible + // The langauges availaible private $frameworkTranslatorFallback; // The langagues used for the translation - public function __construct(array $availableLanguages, Translator $translator) + public function __construct(private array $availableLanguages, Translator $translator) { - $this->availableLanguages = $availableLanguages; $this->frameworkTranslatorFallback = $translator->getFallbackLocales(); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php index c430a1053..38987d8fb 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php @@ -44,24 +44,15 @@ class UserPickerType extends AbstractType */ protected $tokenStorage; - protected UserACLAwareRepositoryInterface $userACLAwareRepository; - - protected UserRepository $userRepository; - - private UserRender $userRender; - public function __construct( AuthorizationHelper $authorizationHelper, TokenStorageInterface $tokenStorage, - UserRepository $userRepository, - UserACLAwareRepositoryInterface $userACLAwareRepository, - UserRender $userRender + protected UserRepository $userRepository, + protected UserACLAwareRepositoryInterface $userACLAwareRepository, + private UserRender $userRender ) { $this->authorizationHelper = $authorizationHelper; $this->tokenStorage = $tokenStorage; - $this->userRepository = $userRepository; - $this->userACLAwareRepository = $userACLAwareRepository; - $this->userRender = $userRender; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index f8485aa99..63f319de4 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -35,16 +35,8 @@ use Symfony\Component\Validator\Constraints\Regex; class UserType extends AbstractType { - protected ParameterBagInterface $parameterBag; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - ParameterBagInterface $parameterBag - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->parameterBag = $parameterBag; + public function __construct(private TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index c6278d133..e967d299f 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -36,17 +36,8 @@ use function array_key_exists; class WorkflowStepType extends AbstractType { - private EntityWorkflowManager $entityWorkflowManager; - - private Registry $registry; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(EntityWorkflowManager $entityWorkflowManager, Registry $registry, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private EntityWorkflowManager $entityWorkflowManager, private Registry $registry, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->entityWorkflowManager = $entityWorkflowManager; - $this->registry = $registry; - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index a17ffbdae..cbafdcfaf 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -25,14 +25,8 @@ use Symfony\Component\Security\Core\User\UserInterface; final class NotificationByUserCounter implements NotificationCounterInterface { - private CacheItemPoolInterface $cacheItemPool; - - private NotificationRepository $notificationRepository; - - public function __construct(CacheItemPoolInterface $cacheItemPool, NotificationRepository $notificationRepository) + public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) { - $this->cacheItemPool = $cacheItemPool; - $this->notificationRepository = $notificationRepository; } public function addNotification(UserInterface $u): int diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 5290492b1..3d63c28a9 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -25,17 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class NotificationMailer { - private LoggerInterface $logger; - - private MailerInterface $mailer; - - private TranslatorInterface $translator; - - public function __construct(MailerInterface $mailer, LoggerInterface $logger, TranslatorInterface $translator) + public function __construct(private MailerInterface $mailer, private LoggerInterface $logger, private TranslatorInterface $translator) { - $this->mailer = $mailer; - $this->logger = $logger; - $this->translator = $translator; } public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void diff --git a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php index f9e050769..0601f0141 100644 --- a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php @@ -19,14 +19,8 @@ use function count; class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface { - private EntityManagerInterface $em; - - private NotificationPersisterInterface $persister; - - public function __construct(EntityManagerInterface $em, NotificationPersisterInterface $persister) + public function __construct(private EntityManagerInterface $em, private NotificationPersisterInterface $persister) { - $this->em = $em; - $this->persister = $persister; } public static function getSubscribedEvents() diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index 307d5d1df..d0a449787 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -39,11 +39,6 @@ class Mailer */ private $logger; - /** - * @var array - */ - private $routeParameters; - /** * @var RouterInterface */ @@ -62,6 +57,7 @@ class Mailer * Mailer constructor. * * @param $routeParameters + * @param mixed[] $routeParameters */ public function __construct( MailerInterface $mailer, @@ -69,14 +65,13 @@ class Mailer EngineInterface $twig, RouterInterface $router, TranslatorInterface $translator, - $routeParameters + protected $routeParameters ) { $this->logger = $logger; $this->twig = $twig; $this->mailer = $mailer; $this->router = $router; $this->translator = $translator; - $this->routeParameters = $routeParameters; } /** @@ -112,15 +107,13 @@ class Mailer * @param array $subject Subject of the message [ 0 => $message (required), 1 => $parameters (optional), 3 => $domain (optional) ] * @param array $bodies The bodies. An array where keys are the contentType and values the bodies * @param callable $callback a callback to customize the message (add attachment, etc.) - * @param mixed $recipient - * @param mixed $force */ public function sendNotification( - $recipient, + mixed $recipient, array $subject, array $bodies, ?callable $callback = null, - $force = false + mixed $force = false ) { $fromEmail = $this->routeParameters['from_email']; $fromName = $this->routeParameters['from_name']; diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php index 9efe69ffb..d39bc8a00 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php @@ -17,16 +17,8 @@ use Doctrine\ORM\EntityManagerInterface; final class NotificationHandlerManager { - private EntityManagerInterface $em; - - private iterable $handlers; - - public function __construct( - iterable $handlers, - EntityManagerInterface $em - ) { - $this->handlers = $handlers; - $this->em = $em; + public function __construct(private iterable $handlers, private EntityManagerInterface $em) + { } /** diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php index c09b845d7..51cb73ccf 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php @@ -24,14 +24,8 @@ class NotificationPresence { private array $cache = []; - private NotificationRepository $notificationRepository; - - private Security $security; - - public function __construct(Security $security, NotificationRepository $notificationRepository) + public function __construct(private Security $security, private NotificationRepository $notificationRepository) { - $this->security = $security; - $this->notificationRepository = $notificationRepository; } public function countNotificationsForClassAndEntity(string $relatedEntityClass, int $relatedEntityId): array diff --git a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php index 0720c6da6..3c31b7201 100644 --- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php @@ -21,17 +21,8 @@ use Twig\Extension\RuntimeExtensionInterface; class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface { - private FormFactoryInterface $formFactory; - - private NotificationPresence $notificationPresence; - - private UrlGeneratorInterface $urlGenerator; - - public function __construct(FormFactoryInterface $formFactory, NotificationPresence $notificationPresence, UrlGeneratorInterface $urlGenerator) + public function __construct(private FormFactoryInterface $formFactory, private NotificationPresence $notificationPresence, private UrlGeneratorInterface $urlGenerator) { - $this->formFactory = $formFactory; - $this->notificationPresence = $notificationPresence; - $this->urlGenerator = $urlGenerator; } public function counterNotificationFor(Environment $environment, string $relatedEntityClass, int $relatedEntityId, array $options = []): string diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php index 2831d9322..2c75ad41a 100644 --- a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php +++ b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php @@ -48,20 +48,11 @@ class ChillPaginationTwig extends AbstractExtension PaginatorInterface $paginator, $template = '@ChillMain/Pagination/long.html.twig' ) { - switch ($template) { - case 'long': - $t = self::LONG_TEMPLATE; - - break; - - case 'short': - $t = self::SHORT_TEMPLATE; - - break; - - default: - $t = $template; - } + $t = match ($template) { + 'long' => self::LONG_TEMPLATE, + 'short' => self::SHORT_TEMPLATE, + default => $template, + }; return $env->render($t, [ 'paginator' => $paginator, diff --git a/src/Bundle/ChillMainBundle/Pagination/Page.php b/src/Bundle/ChillMainBundle/Pagination/Page.php index d7c47ebbd..597d3d2e5 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Page.php +++ b/src/Bundle/ChillMainBundle/Pagination/Page.php @@ -18,59 +18,36 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; */ class Page implements PageInterface { - /** - * the number of item per page. - * - */ - protected int $itemPerPage; - - /** - * the number of the current page. - * - * @var int - */ - protected int $number; - - /** - * The route for the current page. - * - * @var string - */ - protected string $route; - - /** - * Parameters for the route to the current page. - * - * @var array - */ - protected array $routeParameters; - - /** - * The number of items in the whole iteration. - * - * @var int - */ - protected int $totalItems; - /** * @var UrlGeneratorInterface */ protected $urlGenerator; public function __construct( - int $number, - int $itemPerPage, + /** + * the number of the current page. + */ + protected int $number, + /** + * the number of item per page. + * + */ + protected int $itemPerPage, UrlGeneratorInterface $urlGenerator, - string $route, - array $routeParameters, - int $totalItems + /** + * The route for the current page. + */ + protected string $route, + /** + * Parameters for the route to the current page. + */ + protected array $routeParameters, + /** + * The number of items in the whole iteration. + */ + protected int $totalItems ) { $this->urlGenerator = $urlGenerator; - $this->number = $number; - $this->itemPerPage = $itemPerPage; - $this->route = $route; - $this->routeParameters = $routeParameters; - $this->totalItems = $totalItems; } public function generateUrl(): string diff --git a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php index 4a10fde2a..07d89fd1b 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php +++ b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php @@ -20,11 +20,8 @@ class PageGenerator implements Iterator { protected int $current = 1; - protected Paginator $paginator; - - public function __construct(Paginator $paginator) + public function __construct(protected Paginator $paginator) { - $this->paginator = $paginator; } public function current(): Page diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php index 5427bf46d..b7d5aa9ca 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php +++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php @@ -22,80 +22,43 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class Paginator implements PaginatorInterface { /** - * The number of the current page. - * - * @var int + * @param string[] $routeParameters */ - protected int $currentPageNumber; - - /** - * the number of items on a single page. - * - * @var int - */ - protected int $itemPerPage; - - /** - * the key in the GET parameter to indicate the number of item per page. - * - * @var string - */ - protected string $itemPerPageKey; - - /** - * the key in the GET parameter to indicate the page number in - * generated routes. - * - * @var string - */ - protected string $pageKey; - - /** - * the route of the pages. - * - * @var string - */ - protected string $route; - - /** - * the parameters of the route. - * - * @var string[] - */ - protected array $routeParameters; - - /** - * The number of total items. - * - * @var int - */ - protected int $totalItems; - - /** - * the generator for url. - * - * @var UrlGeneratorInterface - */ - protected UrlGeneratorInterface $urlGenerator; - public function __construct( - int $totalItems, - int $itemPerPage, - int $currentPageNumber, - string $route, - array $routeParameters, - UrlGeneratorInterface $urlGenerator, - string $pageKey, - string $itemPerPageKey + /** + * The number of total items. + */ + protected int $totalItems, + /** + * the number of items on a single page. + */ + protected int $itemPerPage, + /** + * The number of the current page. + */ + protected int $currentPageNumber, + /** + * the route of the pages. + */ + protected string $route, + /** + * the parameters of the route. + */ + protected array $routeParameters, + /** + * the generator for url. + */ + protected UrlGeneratorInterface $urlGenerator, + /** + * the key in the GET parameter to indicate the page number in + * generated routes. + */ + protected string $pageKey, + /** + * the key in the GET parameter to indicate the number of item per page. + */ + protected string $itemPerPageKey ) { - $this->totalItems = $totalItems; - $this->itemPerPage = $itemPerPage; - $this->currentPageNumber = $currentPageNumber; - $this->route = $route; - $this->routeParameters = $routeParameters; - $this->urlGenerator = $urlGenerator; - $this->pageKey = $pageKey; - $this->itemPerPageKey = $itemPerPageKey; } public function count(): int diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 7f06bf216..60f9a6bc0 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -26,35 +26,23 @@ class PaginatorFactory public const DEFAULT_PAGE_NUMBER = 1; /** - * the default item per page. This may be overriden by - * the request or inside the paginator. - * - * @var int + * @param int $itemPerPage */ - private $itemPerPage; - - /** - * the request stack. - * - * @var RequestStack - */ - private $requestStack; - - /** - * the router and generator for url. - * - * @var RouterInterface - */ - private $router; - public function __construct( - RequestStack $requestStack, - RouterInterface $router, - $itemPerPage = 20 + /** + * the request stack. + */ + private RequestStack $requestStack, + /** + * the router and generator for url. + */ + private RouterInterface $router, + /** + * the default item per page. This may be overriden by + * the request or inside the paginator. + */ + private $itemPerPage = 20 ) { - $this->itemPerPage = $itemPerPage; - $this->requestStack = $requestStack; - $this->router = $router; } /** @@ -71,7 +59,7 @@ class PaginatorFactory */ public function create( $totalItems, - $route = null, + ?string $route = null, ?array $routeParameters = null ) { return new Paginator( diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index a92db39ce..0c6fbbf03 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -35,25 +35,19 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface public const LOOKUP_URI = 'https://lookups.twilio.com/v1/PhoneNumbers/%s'; - private CacheItemPoolInterface $cachePool; - private array $config; private bool $isConfigured = false; - private LoggerInterface $logger; - private PhonenumberUtil $phoneNumberUtil; private Client $twilioClient; public function __construct( - CacheItemPoolInterface $cacheUserData, + private CacheItemPoolInterface $cachePool, ParameterBagInterface $parameterBag, - LoggerInterface $logger + private LoggerInterface $logger ) { - $this->logger = $logger; - $this->cachePool = $cacheUserData; $this->config = $config = $parameterBag->get('chill_main.phone_helper'); if ( @@ -93,17 +87,11 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface */ public function getType(PhoneNumber $phonenumber): string { - switch ($this->phoneNumberUtil->getNumberType($phonenumber)) { - case PhoneNumberType::MOBILE: - return 'mobile'; - - case PhoneNumberType::FIXED_LINE: - case PhoneNumberType::VOIP: - return 'landline'; - - default: - return 'landline'; - } + return match ($this->phoneNumberUtil->getNumberType($phonenumber)) { + PhoneNumberType::MOBILE => 'mobile', + PhoneNumberType::FIXED_LINE, PhoneNumberType::VOIP => 'landline', + default => 'landline', + }; } /** diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php index b6304e0de..6f4f09bfd 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php @@ -16,11 +16,8 @@ use Twig\TwigFilter; class Templating extends AbstractExtension { - protected PhonenumberHelper $phonenumberHelper; - - public function __construct(PhonenumberHelper $phonenumberHelper) + public function __construct(protected PhonenumberHelper $phonenumberHelper) { - $this->phonenumberHelper = $phonenumberHelper; } public function formatPhonenumber($phonenumber) diff --git a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php index 72f9ea5d1..5677adedb 100644 --- a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php @@ -23,16 +23,13 @@ use Doctrine\Persistence\ObjectRepository; final class NotificationRepository implements ObjectRepository { - private EntityManagerInterface $em; - private ?Statement $notificationByRelatedEntityAndUserAssociatedStatement = null; private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $em) { - $this->em = $entityManager; - $this->repository = $entityManager->getRepository(Notification::class); + $this->repository = $em->getRepository(Notification::class); } public function countAllForAttendee(User $addressee): int diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index 395874deb..a64c77f10 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -19,14 +19,8 @@ use Doctrine\ORM\EntityManagerInterface; class UserACLAwareRepository implements UserACLAwareRepositoryInterface { - private EntityManagerInterface $em; - - private ParentRoleHelper $parentRoleHelper; - - public function __construct(ParentRoleHelper $parentRoleHelper, EntityManagerInterface $em) + public function __construct(private ParentRoleHelper $parentRoleHelper, private EntityManagerInterface $em) { - $this->parentRoleHelper = $parentRoleHelper; - $this->em = $em; } public function findUsersByReachedACL(string $role, $center, $scope = null, bool $onlyEnabled = true): array diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php index a26ae04ad..360171f58 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php @@ -24,13 +24,10 @@ use function count; final class UserRepository implements UserRepositoryInterface { - private EntityManagerInterface $entityManager; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; $this->repository = $entityManager->getRepository(User::class); } @@ -150,7 +147,7 @@ final class UserRepository implements UserRepositoryInterface try { return $qb->getQuery()->getSingleResult(); - } catch (NoResultException $e) { + } catch (NoResultException) { return null; } } diff --git a/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php b/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php index 112054ee3..ebfb263aa 100644 --- a/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php +++ b/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php @@ -22,12 +22,8 @@ use Symfony\Component\Routing\RouteCollection; */ class ChillRoutesLoader extends Loader { - private array $routes; - - public function __construct(array $routes) + public function __construct(private array $routes) { - $this->routes = $routes; - parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php index 7bd23c81f..4a2ad04ad 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminUserMenuBuilder.php @@ -23,14 +23,11 @@ class AdminUserMenuBuilder implements LocalMenuBuilderInterface */ protected $authorizationChecker; - protected ParameterBagInterface $parameterBag; - public function __construct( AuthorizationCheckerInterface $authorizationChecker, - ParameterBagInterface $parameterBag + protected ParameterBagInterface $parameterBag ) { $this->authorizationChecker = $authorizationChecker; - $this->parameterBag = $parameterBag; } public function buildMenu($menuId, MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php index 305b944d8..c58c65189 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php @@ -23,20 +23,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SectionMenuBuilder implements LocalMenuBuilderInterface { - protected AuthorizationCheckerInterface $authorizationChecker; - - protected ParameterBagInterface $parameterBag; - - protected TranslatorInterface $translator; - /** * SectionMenuBuilder constructor. */ - public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator, ParameterBagInterface $parameterBag) + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator, protected ParameterBagInterface $parameterBag) { - $this->authorizationChecker = $authorizationChecker; - $this->translator = $translator; - $this->parameterBag = $parameterBag; } /** diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php index e4ee3b062..81c84a7a8 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php @@ -22,32 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - protected ParameterBagInterface $parameterBag; - - private NotificationByUserCounter $notificationByUserCounter; - - private RequestStack $requestStack; - - private Security $security; - - private TranslatorInterface $translator; - - private WorkflowByUserCounter $workflowByUserCounter; - - public function __construct( - NotificationByUserCounter $notificationByUserCounter, - WorkflowByUserCounter $workflowByUserCounter, - Security $security, - TranslatorInterface $translator, - ParameterBagInterface $parameterBag, - RequestStack $requestStack - ) { - $this->notificationByUserCounter = $notificationByUserCounter; - $this->workflowByUserCounter = $workflowByUserCounter; - $this->security = $security; - $this->translator = $translator; - $this->parameterBag = $parameterBag; - $this->requestStack = $requestStack; + public function __construct(private NotificationByUserCounter $notificationByUserCounter, private WorkflowByUserCounter $workflowByUserCounter, private Security $security, private TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private RequestStack $requestStack) + { } public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters) diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php index 2fc1eb3d0..ed9ff5169 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php @@ -31,22 +31,10 @@ class MenuComposer { private array $localMenuBuilders = []; - private FactoryInterface $menuFactory; - private RouteCollection $routeCollection; - private RouterInterface $router; - - private TranslatorInterface $translator; - - public function __construct( - RouterInterface $router, - FactoryInterface $menuFactory, - TranslatorInterface $translator - ) { - $this->router = $router; - $this->menuFactory = $menuFactory; - $this->translator = $translator; + public function __construct(private RouterInterface $router, private FactoryInterface $menuFactory, private TranslatorInterface $translator) + { } public function addLocalMenuBuilder(LocalMenuBuilderInterface $menuBuilder, $menuId) diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index bca9a81c3..b77d4343f 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -38,14 +38,8 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface 'activeRouteKey' => null, ]; - /** - * @var MenuComposer - */ - private $menuComposer; - - public function __construct(MenuComposer $menuComposer) + public function __construct(private MenuComposer $menuComposer) { - $this->menuComposer = $menuComposer; } /** diff --git a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php index 0ddf5cd0a..f65319a09 100644 --- a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php +++ b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php @@ -65,7 +65,7 @@ abstract class AbstractSearch implements SearchInterface foreach ($supportedTerms as $term) { if (array_key_exists($term, $terms) && '_default' !== $term) { $recomposed .= ' ' . $term . ':'; - $containsSpace = strpos($terms[$term], ' ') !== false; + $containsSpace = str_contains($terms[$term], ' '); if ($containsSpace) { $recomposed .= '"'; diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php index 6affc5a5d..397e0b589 100644 --- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php +++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php @@ -20,11 +20,8 @@ use function in_array; class SearchUserApiProvider implements SearchApiInterface { - private UserRepository $userRepository; - - public function __construct(UserRepository $userRepository) + public function __construct(private UserRepository $userRepository) { - $this->userRepository = $userRepository; } public function getResult(string $key, array $metadata, float $pertinence) diff --git a/src/Bundle/ChillMainBundle/Search/Model/Result.php b/src/Bundle/ChillMainBundle/Search/Model/Result.php index 33312a961..1ef249c1f 100644 --- a/src/Bundle/ChillMainBundle/Search/Model/Result.php +++ b/src/Bundle/ChillMainBundle/Search/Model/Result.php @@ -13,20 +13,16 @@ namespace Chill\MainBundle\Search\Model; class Result { - private float $relevance; - - /** - * mixed an arbitrary result. - */ - private $result; - /** * @param $result */ - public function __construct(float $relevance, $result) - { - $this->relevance = $relevance; - $this->result = $result; + public function __construct( + private float $relevance, + /** + * mixed an arbitrary result. + */ + private $result + ) { } public function getRelevance(): float diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php index 1fea71c46..e7159db06 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApi.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php @@ -26,20 +26,8 @@ use function strtr; class SearchApi { - private EntityManagerInterface $em; - - private PaginatorFactory $paginator; - - private iterable $providers; - - public function __construct( - EntityManagerInterface $em, - iterable $providers, - PaginatorFactory $paginator - ) { - $this->em = $em; - $this->providers = $providers; - $this->paginator = $paginator; + public function __construct(private EntityManagerInterface $em, private iterable $providers, private PaginatorFactory $paginator) + { } public function getResults(string $pattern, array $types, array $parameters): Collection diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php index 6a389088d..542e18d7c 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php @@ -18,19 +18,16 @@ use function implode; class SearchApiNoQueryException extends RuntimeException { - private array $parameters; - private string $pattern; private array $types; - public function __construct(string $pattern = '', array $types = [], array $parameters = [], $code = 0, ?Throwable $previous = null) + public function __construct(string $pattern = '', array $types = [], private array $parameters = [], $code = 0, ?Throwable $previous = null) { $typesStr = implode(', ', $types); $message = "No query for this search: pattern : {$pattern}, types: {$typesStr}"; $this->pattern = $pattern; $this->types = $types; - $this->parameters = $parameters; parent::__construct($message, $code, $previous); } diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index cd0fa06e1..b49c01565 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -17,13 +17,10 @@ class SearchApiResult { private float $pertinence; - private float $relevance; - private $result; - public function __construct(float $relevance) + public function __construct(private float $relevance) { - $this->relevance = $relevance; } /** diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php index 095b749bc..52b484c2d 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php +++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php @@ -62,13 +62,11 @@ class SearchProvider * return search services with a specific name, defined in service * definition. * - * @param mixed $name * * @throws UnknowSearchNameException if not exists - * * @return SearchInterface */ - public function getByName($name) + public function getByName(mixed $name) { if (isset($this->searchServices[$name])) { return $this->searchServices[$name]; diff --git a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php index 0c885de59..20d5948a3 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php @@ -13,14 +13,8 @@ namespace Chill\MainBundle\Search\Utils; class SearchExtractionResult { - private string $filteredSubject; - - private array $found; - - public function __construct(string $filteredSubject, array $found) + public function __construct(private string $filteredSubject, private array $found) { - $this->filteredSubject = $filteredSubject; - $this->found = $found; } public function getFilteredSubject(): string diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index 1105c9d8a..2ba3865b7 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -34,28 +34,8 @@ use function get_class; */ class AuthorizationHelper implements AuthorizationHelperInterface { - private CenterResolverManagerInterface $centerResolverManager; - - private LoggerInterface $logger; - - private ParentRoleHelper $parentRoleHelper; - - private ScopeResolverDispatcher $scopeResolverDispatcher; - - private UserACLAwareRepositoryInterface $userACLAwareRepository; - - public function __construct( - CenterResolverManagerInterface $centerResolverManager, - LoggerInterface $logger, - ScopeResolverDispatcher $scopeResolverDispatcher, - UserACLAwareRepositoryInterface $userACLAwareRepository, - ParentRoleHelper $parentRoleHelper - ) { - $this->centerResolverManager = $centerResolverManager; - $this->logger = $logger; - $this->scopeResolverDispatcher = $scopeResolverDispatcher; - $this->userACLAwareRepository = $userACLAwareRepository; - $this->parentRoleHelper = $parentRoleHelper; + public function __construct(private CenterResolverManagerInterface $centerResolverManager, private LoggerInterface $logger, private ScopeResolverDispatcher $scopeResolverDispatcher, private UserACLAwareRepositoryInterface $userACLAwareRepository, private ParentRoleHelper $parentRoleHelper) + { } /** @@ -63,9 +43,8 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @param User $user The user * @param array $centers a list of centers which are going to be filtered - * @param mixed $role */ - public function filterReachableCenters(User $user, array $centers, $role): array + public function filterReachableCenters(User $user, array $centers, mixed $role): array { $results = []; @@ -85,12 +64,10 @@ class AuthorizationHelper implements AuthorizationHelperInterface /** * @deprecated use UserACLAwareRepositoryInterface::findUsersByReachedACL instead * - * @param array|Center|Center[] $center - * @param array|Scope|Scope[]|null $scope * * @return User[] */ - public function findUsersReaching(string $role, $center, $scope = null, bool $onlyEnabled = true): array + public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, array|\Chill\MainBundle\Entity\Scope|null $scope = null, bool $onlyEnabled = true): array { return $this->userACLAwareRepository ->findUsersByReachedACL($role, $center, $scope, $onlyEnabled); @@ -155,12 +132,10 @@ class AuthorizationHelper implements AuthorizationHelperInterface /** * Return all reachable circle for a given user, center and role. * - * @param Role|string $role * @param Center|Center[] $center - * * @return Scope[] */ - public function getReachableCircles(UserInterface $user, $role, $center) + public function getReachableCircles(UserInterface $user, \Symfony\Component\Security\Core\Role\Role|string $role, \Chill\MainBundle\Entity\Center|array $center) { $scopes = []; @@ -210,7 +185,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @param Center|Center[] $center May be an array of center */ - public function userCanReachCenter(User $user, $center): bool + public function userCanReachCenter(User $user, \Chill\MainBundle\Entity\Center|array $center): bool { if ($center instanceof Traversable) { foreach ($center as $c) { @@ -236,7 +211,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface sprintf( 'The entity given is not an instance of %s, %s given', Center::class, - get_class($center) + $center::class ) ); } @@ -252,7 +227,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface * * @return bool true if the user has access */ - public function userHasAccess(User $user, $entity, $attribute) + public function userHasAccess(User $user, mixed $entity, \Symfony\Component\Security\Core\Role\Role|string $attribute) { $centers = $this->centerResolverManager->resolveCenters($entity); diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php index 55005fe92..45a1f3095 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php @@ -17,14 +17,8 @@ use Symfony\Component\Security\Core\Security; class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrentUserInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private Security $security; - - public function __construct(AuthorizationHelperInterface $authorizationHelper, Security $security) + public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security) { - $this->authorizationHelper = $authorizationHelper; - $this->security = $security; } public function getReachableCenters(string $role, ?Scope $scope = null): array diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php index ec2b2112c..c6ae44d9f 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php @@ -18,20 +18,8 @@ use function in_array; final class DefaultVoterHelper implements VoterHelperInterface { - private AuthorizationHelper $authorizationHelper; - - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private array $configuration = []; - - public function __construct( - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher, - array $configuration - ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->configuration = $configuration; + public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private array $configuration) + { } public function supports($attribute, $subject): bool diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php index 6fd0b0ef0..d00fc6495 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php @@ -15,16 +15,8 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; class DefaultVoterHelperFactory implements VoterHelperFactoryInterface { - protected AuthorizationHelper $authorizationHelper; - - protected CenterResolverDispatcherInterface $centerResolverDispatcher; - - public function __construct( - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher - ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; + public function __construct(protected AuthorizationHelper $authorizationHelper, protected CenterResolverDispatcherInterface $centerResolverDispatcher) + { } public function generate($context): VoterGeneratorInterface diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php index 2e56c9856..7844632d8 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php @@ -15,18 +15,10 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; final class DefaultVoterHelperGenerator implements VoterGeneratorInterface { - private AuthorizationHelper $authorizationHelper; - - private CenterResolverDispatcherInterface $centerResolverDispatcher; - private array $configuration = []; - public function __construct( - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher - ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; + public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher) + { } public function addCheckFor(?string $subject, array $attributes): self diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php index ffcc1bb95..5d2bc72a7 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php @@ -29,14 +29,8 @@ class EntityWorkflowVoter extends Voter public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW'; - private EntityWorkflowManager $manager; - - private Security $security; - - public function __construct(EntityWorkflowManager $manager, Security $security) + public function __construct(private EntityWorkflowManager $manager, private Security $security) { - $this->manager = $manager; - $this->security = $security; } protected function supports($attribute, $subject) diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/NotificationVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/NotificationVoter.php index 9fae2f51a..a1707d7c5 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/NotificationVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/NotificationVoter.php @@ -53,35 +53,22 @@ final class NotificationVoter extends Voter } if ($subject instanceof Notification) { - switch ($attribute) { - case self::COMMENT_ADD: - return false === $subject->isSystem() && ( - $subject->getAddressees()->contains($user) || $subject->getSender() === $user - ); - - case self::NOTIFICATION_SEE: - case self::NOTIFICATION_TOGGLE_READ_STATUS: - return $subject->getSender() === $user || $subject->getAddressees()->contains($user); - - case self::NOTIFICATION_UPDATE: - return $subject->getSender() === $user && false === $subject->isSystem(); - - default: - throw new UnexpectedValueException("this subject {$attribute} is not implemented"); - } + return match ($attribute) { + self::COMMENT_ADD => false === $subject->isSystem() && ( + $subject->getAddressees()->contains($user) || $subject->getSender() === $user + ), + self::NOTIFICATION_SEE, self::NOTIFICATION_TOGGLE_READ_STATUS => $subject->getSender() === $user || $subject->getAddressees()->contains($user), + self::NOTIFICATION_UPDATE => $subject->getSender() === $user && false === $subject->isSystem(), + default => throw new UnexpectedValueException("this subject {$attribute} is not implemented"), + }; } elseif ($subject instanceof NotificationComment) { - switch ($attribute) { - case self::COMMENT_ADD: - return false === $subject->getNotification()->isSystem() && ( - $subject->getNotification()->getAddressees()->contains($user) || $subject->getNotification()->getSender() === $user - ); - - case self::COMMENT_EDIT: - return $subject->getCreatedBy() === $user && false === $subject->getNotification()->isSystem(); - - default: - throw new UnexpectedValueException("this subject {$attribute} is not implemented"); - } + return match ($attribute) { + self::COMMENT_ADD => false === $subject->getNotification()->isSystem() && ( + $subject->getNotification()->getAddressees()->contains($user) || $subject->getNotification()->getSender() === $user + ), + self::COMMENT_EDIT => $subject->getCreatedBy() === $user && false === $subject->getNotification()->isSystem(), + default => throw new UnexpectedValueException("this subject {$attribute} is not implemented"), + }; } throw new UnexpectedValueException(); diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php index 667bced46..179cada57 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php @@ -38,15 +38,9 @@ class SavedExportVoter extends Voter protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { - /** @var SavedExport $subject */ - switch ($attribute) { - case self::DELETE: - case self::EDIT: - case self::GENERATE: - return $subject->getUser() === $token->getUser(); - - default: - throw new UnexpectedValueException('attribute not supported: ' . $attribute); - } + return match ($attribute) { + self::DELETE, self::EDIT, self::GENERATE => $subject->getUser() === $token->getUser(), + default => throw new UnexpectedValueException('attribute not supported: ' . $attribute), + }; } } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php index b75acb7ae..23265306d 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -21,17 +21,11 @@ use function is_object; class WorkflowEntityDeletionVoter extends Voter { - private EntityWorkflowRepository $entityWorkflowRepository; - /** - * @var iterable|EntityWorkflowHandlerInterface[] + * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - private iterable $handlers; - - public function __construct($handlers, EntityWorkflowRepository $entityWorkflowRepository) + public function __construct(private $handlers, private EntityWorkflowRepository $entityWorkflowRepository) { - $this->handlers = $handlers; - $this->entityWorkflowRepository = $entityWorkflowRepository; } protected function supports($attribute, $subject) diff --git a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php index f53e49583..65ca6b233 100644 --- a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php +++ b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php @@ -31,13 +31,10 @@ class ParentRoleHelper */ protected array $hierarchy; - protected RoleHierarchyInterface $roleHierarchy; - public function __construct( - RoleHierarchyInterface $roleHierarchy, + protected RoleHierarchyInterface $roleHierarchy, ParameterBagInterface $parameterBag ) { - $this->roleHierarchy = $roleHierarchy; $this->hierarchy = $parameterBag->get('security.role_hierarchy.roles'); } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php index c39c34ebe..8bc23b54a 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php @@ -22,21 +22,11 @@ class PasswordRecoverEvent extends Event public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token'; - /** - * @var string - */ - protected $ip; - /** * @var bool */ protected $safelyGenerated; - /** - * @var string - */ - protected $token; - /** * @var User */ @@ -48,11 +38,9 @@ class PasswordRecoverEvent extends Event * @param type $ip * @param bool $safelyGenerated true if generated safely (from console command, etc.) */ - public function __construct($token = null, ?User $user = null, $ip = null, bool $safelyGenerated = false) + public function __construct(protected $token = null, ?User $user = null, protected $ip = null, bool $safelyGenerated = false) { $this->user = $user; - $this->token = $token; - $this->ip = $ip; $this->safelyGenerated = $safelyGenerated; } @@ -69,10 +57,7 @@ class PasswordRecoverEvent extends Event return $this->token; } - /** - * @return User|null - */ - public function getUser() + public function getUser(): ?\Chill\MainBundle\Entity\User { return $this->user; } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php index cc09dbef6..53be72874 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php @@ -80,67 +80,36 @@ class PasswordRecoverLocker */ public static function generateLockKey($usage, int $number, $discriminator = null) { - switch ($usage) { - case 'invalid_token_global': - return sprintf('invalid_token_global_%d', $number); - - case 'invalid_token_by_ip': - return sprintf('invalid_token_ip_%s_%d', $discriminator, $number); - - case 'ask_token_invalid_form_global': - return sprintf('ask_token_invalid_form_global_%d', $number); - - case 'ask_token_invalid_form_by_ip': - return sprintf('ask_token_invalid_form_by_ip_%s_%d', $discriminator, $number); - - case 'ask_token_success_by_user': - return sprintf('ask_token_success_by_user_%s_%d', $discriminator->getId(), $number); - - default: - throw new LogicException('this usage is not implemented'); - } + return match ($usage) { + 'invalid_token_global' => sprintf('invalid_token_global_%d', $number), + 'invalid_token_by_ip' => sprintf('invalid_token_ip_%s_%d', $discriminator, $number), + 'ask_token_invalid_form_global' => sprintf('ask_token_invalid_form_global_%d', $number), + 'ask_token_invalid_form_by_ip' => sprintf('ask_token_invalid_form_by_ip_%s_%d', $discriminator, $number), + 'ask_token_success_by_user' => sprintf('ask_token_success_by_user_%s_%d', $discriminator->getId(), $number), + default => throw new LogicException('this usage is not implemented'), + }; } public function getMax($usage) { - switch ($usage) { - case 'invalid_token_global': - return self::MAX_INVALID_TOKEN_GLOBAL; - - case 'invalid_token_by_ip': - return self::MAX_INVALID_TOKEN_BY_IP; - - case 'ask_token_invalid_form_global': - return self::MAX_ASK_TOKEN_INVALID_FORM_GLOBAL; - - case 'ask_token_invalid_form_by_ip': - return self::MAX_ASK_TOKEN_INVALID_FORM_BY_IP; - - case 'ask_token_success_by_user': - return self::MAX_ASK_TOKEN_BY_USER; - - default: - throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"); - } + return match ($usage) { + 'invalid_token_global' => self::MAX_INVALID_TOKEN_GLOBAL, + 'invalid_token_by_ip' => self::MAX_INVALID_TOKEN_BY_IP, + 'ask_token_invalid_form_global' => self::MAX_ASK_TOKEN_INVALID_FORM_GLOBAL, + 'ask_token_invalid_form_by_ip' => self::MAX_ASK_TOKEN_INVALID_FORM_BY_IP, + 'ask_token_success_by_user' => self::MAX_ASK_TOKEN_BY_USER, + default => throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"), + }; } public function getTtl($usage) { - switch ($usage) { - case 'invalid_token_global': - case 'invalid_token_by_ip': - return self::INVALID_TOKEN_TTL; - - case 'ask_token_invalid_form_global': - case 'ask_token_invalid_form_by_ip': - return self::ASK_TOKEN_INVALID_FORM_TTL; - - case 'ask_token_success_by_user': - return self::ASK_TOKEN_INVALID_FORM_TTL * 24; - - default: - throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"); - } + return match ($usage) { + 'invalid_token_global', 'invalid_token_by_ip' => self::INVALID_TOKEN_TTL, + 'ask_token_invalid_form_global', 'ask_token_invalid_form_by_ip' => self::ASK_TOKEN_INVALID_FORM_TTL, + 'ask_token_success_by_user' => self::ASK_TOKEN_INVALID_FORM_TTL * 24, + default => throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"), + }; } public function isLocked($usage, $discriminator = null) diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php index 3d4afb1b3..370c1c521 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php @@ -43,13 +43,10 @@ class TokenManager protected $logger; /** - * @var string + * @param string $secret */ - protected $secret; - - public function __construct($secret, LoggerInterface $logger) + public function __construct(protected $secret, LoggerInterface $logger) { - $this->secret = $secret; $this->logger = $logger; } diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php index f757efa3a..d01ba6665 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php @@ -14,13 +14,10 @@ namespace Chill\MainBundle\Security\Resolver; final class CenterResolverDispatcher implements CenterResolverDispatcherInterface { /** - * @var CenterResolverInterface[] + * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - private iterable $resolvers; - - public function __construct(iterable $resolvers = []) + public function __construct(private iterable $resolvers = []) { - $this->resolvers = $resolvers; } public function resolveCenter($entity, ?array $options = []) diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php index 65507e610..3ccdd3746 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php @@ -20,13 +20,10 @@ use function is_array; final class CenterResolverManager implements CenterResolverManagerInterface { /** - * @var CenterResolverInterface[] + * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - private iterable $resolvers; - - public function __construct(iterable $resolvers = []) + public function __construct(private iterable $resolvers = []) { - $this->resolvers = $resolvers; } public function resolveCenters($entity, ?array $options = []): array @@ -51,7 +48,7 @@ final class CenterResolverManager implements CenterResolverManagerInterface 'the return type of a %s should be an instance of %s, an array or null. Resolver is %s', CenterResolverInterface::class, Center::class, - get_class($resolver) + $resolver::class )); } } diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php index 058bea75d..299d8dd2b 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php @@ -15,14 +15,8 @@ use Twig\TwigFilter; final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension { - private CenterResolverManagerInterface $centerResolverDispatcher; - - private ScopeResolverDispatcher $scopeResolverDispatcher; - - public function __construct(CenterResolverManagerInterface $centerResolverDispatcher, ScopeResolverDispatcher $scopeResolverDispatcher) + public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher) { - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->scopeResolverDispatcher = $scopeResolverDispatcher; } public function getFilters() @@ -45,11 +39,9 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension } /** - * @param mixed $entity - * * @return Center|Center[]|null */ - public function resolveCenter($entity, ?array $options = []) + public function resolveCenter(mixed $entity, ?array $options = []) { return $this->centerResolverDispatcher->resolveCenters($entity, $options); } @@ -59,7 +51,7 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension * * @return array|\Chill\MainBundle\Entity\Scope|\Chill\MainBundle\Entity\Scope[] */ - public function resolveScope($entity, ?array $options = []) + public function resolveScope($entity, ?array $options = []): array|\Chill\MainBundle\Entity\Scope { return $this->scopeResolverDispatcher->resolveScope(); } diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index 308b9aee0..1c40ad282 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -17,13 +17,10 @@ use Doctrine\Common\Collections\Collection; final class ScopeResolverDispatcher { /** - * @var iterable|ScopeResolverInterface[] + * @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers */ - private iterable $resolvers; - - public function __construct(iterable $resolvers) + public function __construct(private iterable $resolvers) { - $this->resolvers = $resolvers; } public function isConcerned($entity, ?array $options = []): bool @@ -42,7 +39,7 @@ final class ScopeResolverDispatcher * * @return iterable|Scope|Scope[] */ - public function resolveScope($entity, ?array $options = []) + public function resolveScope($entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|array { foreach ($this->resolvers as $resolver) { if ($resolver->supports($entity, $options)) { diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php index c299ee508..c7e589674 100644 --- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php +++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php @@ -35,8 +35,6 @@ class RoleProvider * Add a role provider. * * @internal This function is called by the dependency injector: it inject provider - * - * @param \Chill\MainBundle\Security\ProvideRoleInterface $provider */ public function addProvider(ProvideRoleInterface $provider) { diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index ff0c73fb6..ceee95b56 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -21,11 +21,8 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; class UserProvider implements UserProviderInterface { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; } public function loadUserByUsername($username): UserInterface diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php index 38b151bb7..4f6248621 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php @@ -15,14 +15,8 @@ use Chill\MainBundle\Pagination\PaginatorInterface; class Collection { - private $items; - - private PaginatorInterface $paginator; - - public function __construct($items, PaginatorInterface $paginator) + public function __construct(private $items, private PaginatorInterface $paginator) { - $this->items = $items; - $this->paginator = $paginator; } public function getItems() diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php index 10669c1c5..39a83ee5a 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php @@ -15,11 +15,8 @@ use JsonSerializable; class Counter implements JsonSerializable { - private int $counter; - - public function __construct(?int $counter) + public function __construct(private ?int $counter) { - $this->counter = $counter; } public function getCounter(): ?int diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index 8018fe951..5e6c8cc05 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -48,11 +48,8 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'confidential', ]; - private AddressRender $addressRender; - - public function __construct(AddressRender $addressRender) + public function __construct(private AddressRender $addressRender) { - $this->addressRender = $addressRender; } /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index e0b2a3e96..cfb53e1a1 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -22,11 +22,8 @@ use function array_key_exists; class CenterNormalizer implements DenormalizerInterface, NormalizerInterface { - private CenterRepository $repository; - - public function __construct(CenterRepository $repository) + public function __construct(private CenterRepository $repository) { - $this->repository = $repository; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index a00e6379a..10c865608 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -25,11 +25,8 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa { use NormalizerAwareTrait; - private UserRepository $userRepository; - - public function __construct(UserRepository $userRepository) + public function __construct(private UserRepository $userRepository) { - $this->userRepository = $userRepository; } /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index 8bd0fd3c1..c5032a7b9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -26,14 +26,8 @@ use function is_array; class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface { - private ParameterBagInterface $parameterBag; - - private RequestStack $requestStack; - - public function __construct(RequestStack $requestStack, ParameterBagInterface $parameterBag) + public function __construct(private RequestStack $requestStack, private ParameterBagInterface $parameterBag) { - $this->requestStack = $requestStack; - $this->parameterBag = $parameterBag; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index 3f4d0c51f..94c5d400e 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -23,14 +23,8 @@ use function is_array; class DoctrineExistingEntityNormalizer implements DenormalizerInterface { - private EntityManagerInterface $em; - - private ClassMetadataFactoryInterface $serializerMetadataFactory; - - public function __construct(EntityManagerInterface $em, ClassMetadataFactoryInterface $serializerMetadataFactory) + public function __construct(private EntityManagerInterface $em, private ClassMetadataFactoryInterface $serializerMetadataFactory) { - $this->em = $em; - $this->serializerMetadataFactory = $serializerMetadataFactory; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php index 4dd6888a0..16553ab29 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php @@ -23,20 +23,8 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn { use NormalizerAwareTrait; - private EntityWorkflowManager $entityWorkflowManager; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct( - EntityWorkflowManager $entityWorkflowManager, - MetadataExtractor $metadataExtractor, - Registry $registry - ) { - $this->entityWorkflowManager = $entityWorkflowManager; - $this->metadataExtractor = $metadataExtractor; - $this->registry = $registry; + public function __construct(private EntityWorkflowManager $entityWorkflowManager, private MetadataExtractor $metadataExtractor, private Registry $registry) + { } /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 63b2c1141..874faf9c9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -21,11 +21,8 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz { use NormalizerAwareTrait; - private MetadataExtractor $metadataExtractor; - - public function __construct(MetadataExtractor $metadataExtractor) + public function __construct(private MetadataExtractor $metadataExtractor) { - $this->metadataExtractor = $metadataExtractor; } /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 589d0b914..98101a86d 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -24,17 +24,8 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - private EntityManagerInterface $entityManager; - - private NotificationHandlerManager $notificationHandlerManager; - - private Security $security; - - public function __construct(NotificationHandlerManager $notificationHandlerManager, EntityManagerInterface $entityManager, Security $security) + public function __construct(private NotificationHandlerManager $notificationHandlerManager, private EntityManagerInterface $entityManager, private Security $security) { - $this->notificationHandlerManager = $notificationHandlerManager; - $this->entityManager = $entityManager; - $this->security = $security; } /** diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php index 0049657bb..6a98bc428 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -18,11 +18,8 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index fde3a3d8e..5f68454fd 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -36,11 +36,8 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware 'email' => '', ]; - private UserRender $userRender; - - public function __construct(UserRender $userRender) + public function __construct(private UserRender $userRender) { - $this->userRender = $userRender; } public function normalize($object, $format = null, array $context = []) diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index 9dbb38a3f..b64891695 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -20,11 +20,8 @@ use UnexpectedValueException; class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJobInterface { - private Connection $connection; - - public function __construct(Connection $connection) + public function __construct(private Connection $connection) { - $this->connection = $connection; } public function canRun(?CronJobExecution $cronJobExecution): bool diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php index c06ded0a8..09bc5e3f8 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php @@ -22,20 +22,8 @@ class AddressReferenceBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - private AddressReferenceBaseImporter $baseImporter; - - private AddressToReferenceMatcher $addressToReferenceMatcher; - - private HttpClientInterface $client; - - public function __construct( - HttpClientInterface $client, - AddressReferenceBaseImporter $baseImporter, - AddressToReferenceMatcher $addressToReferenceMatcher - ) { - $this->client = $client; - $this->baseImporter = $baseImporter; - $this->addressToReferenceMatcher = $addressToReferenceMatcher; + public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher) + { } public function import(string $lang, array $lists): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php index c6ddfcf40..9c8f2f705 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php @@ -46,18 +46,12 @@ final class AddressReferenceBaseImporter private ?string $currentSource = null; - private Connection $defaultConnection; - private bool $isInitialized = false; - private LoggerInterface $logger; - private array $waitingForInsert = []; - public function __construct(Connection $defaultConnection, LoggerInterface $logger) + public function __construct(private Connection $defaultConnection, private LoggerInterface $logger) { - $this->defaultConnection = $defaultConnection; - $this->logger = $logger; } public function finalize(): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php index d02a846ec..657463dc7 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php @@ -20,17 +20,8 @@ use function is_int; class AddressReferenceFromBano { - private AddressReferenceBaseImporter $baseImporter; - - private AddressToReferenceMatcher $addressToReferenceMatcher; - - private HttpClientInterface $client; - - public function __construct(HttpClientInterface $client, AddressReferenceBaseImporter $baseImporter, AddressToReferenceMatcher $addressToReferenceMatcher) + public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher) { - $this->client = $client; - $this->baseImporter = $baseImporter; - $this->addressToReferenceMatcher = $addressToReferenceMatcher; } public function import(string $departementNo): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php index eab6858d9..bf9b57a1a 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php @@ -21,10 +21,6 @@ use Psr\Log\LoggerInterface; */ final class AddressToReferenceMatcher { - private Connection $connection; - - private LoggerInterface $logger; - private const LOG_PREFIX = '[address_to_reference_matcher] '; private const SQL_MARK_TO_REVIEW_ADDRESS_UNMATCHING = <<<'SQL' @@ -68,10 +64,8 @@ final class AddressToReferenceMatcher '{{ reviewed }}' => Address::ADDR_REFERENCE_STATUS_REVIEWED ]; - public function __construct(Connection $connection, LoggerInterface $logger) + public function __construct(private Connection $connection, private LoggerInterface $logger) { - $this->connection = $connection; - $this->logger = $logger; } public function checkAddressesMatchingReferences(): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index 1ec6b70de..c8a229cd7 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -43,18 +43,12 @@ final class GeographicalUnitBaseImporter */ private array $cachingStatements = []; - private Connection $defaultConnection; - private bool $isInitialized = false; - private LoggerInterface $logger; - private array $waitingForInsert = []; - public function __construct(Connection $defaultConnection, LoggerInterface $logger) + public function __construct(private Connection $defaultConnection, private LoggerInterface $logger) { - $this->defaultConnection = $defaultConnection; - $this->logger = $logger; } public function finalize(): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php index aa04c9ac3..41672e421 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php @@ -21,17 +21,8 @@ class PostalCodeBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - private PostalCodeBaseImporter $baseImporter; - - private HttpClientInterface $client; - - private LoggerInterface $logger; - - public function __construct(PostalCodeBaseImporter $baseImporter, HttpClientInterface $client, LoggerInterface $logger) + public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger) { - $this->baseImporter = $baseImporter; - $this->client = $client; - $this->logger = $logger; } public function import(string $lang = 'fr'): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php index 9086e1843..8b5e6d4e1 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php @@ -55,14 +55,10 @@ class PostalCodeBaseImporter */ private array $cachingStatements = []; - private Connection $defaultConnection; - private array $waitingForInsert = []; - public function __construct( - Connection $defaultConnection - ) { - $this->defaultConnection = $defaultConnection; + public function __construct(private Connection $defaultConnection) + { } public function finalize(): void diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php index e680b8497..23687d558 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php @@ -26,20 +26,8 @@ class PostalCodeFRFromOpenData { private const CSV = 'https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B'; - private PostalCodeBaseImporter $baseImporter; - - private HttpClientInterface $client; - - private LoggerInterface $logger; - - public function __construct( - PostalCodeBaseImporter $baseImporter, - HttpClientInterface $client, - LoggerInterface $logger - ) { - $this->baseImporter = $baseImporter; - $this->client = $client; - $this->logger = $logger; + public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger) + { } public function import(): void @@ -86,7 +74,7 @@ class PostalCodeFRFromOpenData $ref = trim($record['Code_commune_INSEE']); - if ('987' === substr($ref, 0, 3)) { + if (str_starts_with($ref, '987')) { // some differences in French Polynesia $ref .= '.' . trim($record['Libellé_d_acheminement']); } diff --git a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php index 36374c6af..6474ccf9c 100644 --- a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php +++ b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php @@ -20,16 +20,10 @@ use Symfony\Component\Mime\RawMessage; class ChillMailer implements MailerInterface { - private LoggerInterface $chillLogger; - - private MailerInterface $initial; - private string $prefix = '[Chill] '; - public function __construct(MailerInterface $initial, LoggerInterface $chillLogger) + public function __construct(private MailerInterface $initial, private LoggerInterface $chillLogger) { - $this->initial = $initial; - $this->chillLogger = $chillLogger; } public function send(RawMessage $message, ?Envelope $envelope = null): void diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index e8427c62f..32aa7030a 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -63,25 +63,19 @@ class RollingDate public const T_YEAR_PREVIOUS_START = 'year_previous_start'; - private ?DateTimeImmutable $fixedDate; - /** * The pivot date is the date from the rolling is computed. By default, it is "now". */ private DateTimeImmutable $pivotDate; - private string $roll; - /** * @param string|self::T_* $roll * @param DateTimeImmutable|null $pivotDate Will be "now" if null is given * @param DateTimeImmutable|null $fixedDate Only to insert if $roll equals @see{self::T_FIXED_DATE} */ - public function __construct(string $roll, ?DateTimeImmutable $fixedDate = null, ?DateTimeImmutable $pivotDate = null) + public function __construct(private string $roll, private ?\DateTimeImmutable $fixedDate = null, ?DateTimeImmutable $pivotDate = null) { - $this->roll = $roll; $this->pivotDate = $pivotDate ?? new DateTimeImmutable('now'); - $this->fixedDate = $fixedDate; } public function getFixedDate(): ?DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php index 026ff7a8a..0b9d5e4cd 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php @@ -82,38 +82,13 @@ class RollingDateConverter implements RollingDateConverterInterface private function toBeginOfQuarter(DateTimeImmutable $date): DateTimeImmutable { - switch ((int) $date->format('n')) { - case 1: - case 2: - case 3: - $month = '01'; - - break; - - case 4: - case 5: - case 6: - $month = '04'; - - break; - - case 7: - case 8: - case 9: - $month = '07'; - - break; - - case 10: - case 11: - case 12: - $month = '10'; - - break; - - default: - throw new LogicException('this month is not valid: ' . $date->format('n')); - } + $month = match ((int) $date->format('n')) { + 1, 2, 3 => '01', + 4, 5, 6 => '04', + 7, 8, 9 => '07', + 10, 11, 12 => '10', + default => throw new LogicException('this month is not valid: ' . $date->format('n')), + }; return DateTimeImmutable::createFromFormat( 'Y-m-d His', diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php index 145e90593..2a86ddab4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php @@ -26,17 +26,8 @@ class ShortMessage public const PRIORITY_MEDIUM = 'medium'; - private string $content; - - private PhoneNumber $phoneNumber; - - private string $priority = 'low'; - - public function __construct(string $content, PhoneNumber $phoneNumber, string $priority = 'low') + public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') { - $this->content = $content; - $this->phoneNumber = $phoneNumber; - $this->priority = $priority; } public function getContent(): string diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php index 924335ad9..6f8b5427d 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php @@ -25,11 +25,8 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class ShortMessageHandler implements MessageHandlerInterface { - private ShortMessageTransporterInterface $messageTransporter; - - public function __construct(ShortMessageTransporterInterface $messageTransporter) + public function __construct(private ShortMessageTransporterInterface $messageTransporter) { - $this->messageTransporter = $messageTransporter; } public function __invoke(ShortMessage $message): void diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php index 6fdc8b05d..5dfbc9fc0 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php @@ -20,12 +20,8 @@ namespace Chill\MainBundle\Service\ShortMessage; class ShortMessageTransporter implements ShortMessageTransporterInterface { - private ShortMessageSenderInterface $sender; - - public function __construct( - ShortMessageSenderInterface $sender // hint: must remain at place 0 for DI - ) { - $this->sender = $sender; + public function __construct(private ShortMessageSenderInterface $sender) + { } public function send(ShortMessage $shortMessage): void diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php index e3273578a..72ef53b85 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php @@ -27,28 +27,16 @@ use Psr\Log\LoggerInterface; class OvhShortMessageSender implements ShortMessageSenderInterface { - private Api $api; - - private LoggerInterface $logger; - - private PhoneNumberUtil $phoneNumberUtil; - - private string $sender; - - private string $serviceName; - public function __construct( - Api $api, // for DI, must remains as first argument - string $serviceName, // for di, must remains as second argument - string $sender, // for DI, must remains as third argument - LoggerInterface $logger, - PhoneNumberUtil $phoneNumberUtil + private Api $api, + // for DI, must remains as first argument + private string $serviceName, + // for di, must remains as second argument + private string $sender, + // for DI, must remains as third argument + private LoggerInterface $logger, + private PhoneNumberUtil $phoneNumberUtil ) { - $this->api = $api; - $this->serviceName = $serviceName; - $this->sender = $sender; - $this->logger = $logger; - $this->phoneNumberUtil = $phoneNumberUtil; } public function send(ShortMessage $shortMessage): void diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php index a503426f0..95b307ed7 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php @@ -65,27 +65,15 @@ class ChillTwigHelper extends AbstractExtension 'time_format' => 'none', ], $options); - switch ($template) { - case 'default': - case 'blockquote': - $t = '@ChillMain/Extensions/PrintOrMessage/' . $template . '_date.html.twig'; - - break; - - default: - $t = $template; - } + $t = match ($template) { + 'default', 'blockquote' => '@ChillMain/Extensions/PrintOrMessage/' . $template . '_date.html.twig', + default => $template, + }; } else { - switch ($template) { - case 'default': - case 'blockquote': - $t = '@ChillMain/Extensions/PrintOrMessage/' . $template . '.html.twig'; - - break; - - default: - $t = $template; - } + $t = match ($template) { + 'default', 'blockquote' => '@ChillMain/Extensions/PrintOrMessage/' . $template . '.html.twig', + default => $template, + }; } return $twig->render($t, array_merge([ diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index 132884d60..668f7875a 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -36,16 +36,8 @@ class AddressRender implements ChillEntityRenderInterface 'extended_infos' => false, ]; - private EngineInterface $templating; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - EngineInterface $templating, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->templating = $templating; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private EngineInterface $templating, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function renderBox($addr, array $options): string diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index 7e567725e..464415848 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -24,19 +24,9 @@ use function array_merge; class CommentRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - /** - * @var EngineInterface - */ - private $engine; - private UserRepositoryInterface $userRepository; - - public function __construct( - UserRepositoryInterface $userRepository, - EngineInterface $engine - ) { - $this->userRepository = $userRepository; - $this->engine = $engine; + public function __construct(private UserRepositoryInterface $userRepository, private EngineInterface $engine) + { } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index eab014289..e34440491 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -30,17 +30,8 @@ class UserRender implements ChillEntityRenderInterface 'absence' => true, ]; - private EngineInterface $engine; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine, TranslatorInterface $translator) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) { - $this->translatableStringHelper = $translatableStringHelper; - $this->engine = $engine; - $this->translator = $translator; } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 367cc0861..c8b3839c9 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -26,26 +26,18 @@ class FilterOrderHelper private array $dateRanges = []; - private FormFactoryInterface $formFactory; - private ?string $formName = 'f'; private array $formOptions = []; private string $formType = FilterOrderType::class; - private RequestStack $requestStack; - private ?array $searchBoxFields = null; private ?array $submitted = null; - public function __construct( - FormFactoryInterface $formFactory, - RequestStack $requestStack - ) { - $this->formFactory = $formFactory; - $this->requestStack = $requestStack; + public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + { } public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = []): self diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index d68c8c37a..770b42cae 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -21,18 +21,10 @@ class FilterOrderHelperBuilder private array $dateRanges = []; - private FormFactoryInterface $formFactory; - - private RequestStack $requestStack; - private ?array $searchBoxFields = null; - public function __construct( - FormFactoryInterface $formFactory, - RequestStack $requestStack - ) { - $this->formFactory = $formFactory; - $this->requestStack = $requestStack; + public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + { } public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = []): self diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index c88c71af5..930da454c 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -16,16 +16,8 @@ use Symfony\Component\HttpFoundation\RequestStack; class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface { - private FormFactoryInterface $formFactory; - - private RequestStack $requestStack; - - public function __construct( - FormFactoryInterface $formFactory, - RequestStack $requestStack - ) { - $this->formFactory = $formFactory; - $this->requestStack = $requestStack; + public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + { } public function create(string $context, ?array $options = []): FilterOrderHelperBuilder diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php index 19f9a4d45..6136ffc3e 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php @@ -21,14 +21,8 @@ final class TranslatableStringHelper implements TranslatableStringHelperInterfac { private string $defaultLocale; - private RequestStack $requestStack; - - private TranslatorInterface $translator; - - public function __construct(RequestStack $requestStack, TranslatorInterface $translator, ParameterBagInterface $parameterBag) + public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator, ParameterBagInterface $parameterBag) { - $this->requestStack = $requestStack; - $this->translator = $translator; $this->defaultLocale = $parameterBag->get('kernel.default_locale'); } diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php index 61a381f75..aaefdeeae 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php @@ -19,17 +19,11 @@ class TranslatableStringTwig extends AbstractExtension { use ContainerAwareTrait; - /** - * @var TranslatableStringHelper - */ - private $helper; - /** * TranslatableStringTwig constructor. */ - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $helper) { - $this->helper = $translatableStringHelper; } /** diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php index 39b74a041..9b752c439 100644 --- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php @@ -82,7 +82,7 @@ class WidgetRenderingTwig extends AbstractExtension * @param WidgetInterface $widget * @param mixed $ordering */ - public function addWidget($place, $ordering, $widget, array $config = []) + public function addWidget($place, mixed $ordering, $widget, array $config = []) { $this->widget[$place][$ordering] = [$widget, $config]; } diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index 23f6c4b84..89fb69c82 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -294,7 +294,7 @@ abstract class AbstractExportTest extends WebTestCase * @param mixed $acl * @param mixed $data */ - public function testInitiateQuery($modifiers, $acl, $data) + public function testInitiateQuery(mixed $modifiers, mixed $acl, mixed $data) { $query = $this->getExport()->initiateQuery($modifiers, $acl, $data); @@ -390,7 +390,7 @@ abstract class AbstractExportTest extends WebTestCase * @param mixed $acl * @param mixed $data */ - public function testSupportsModifier($modifiers, $acl, $data) + public function testSupportsModifier(mixed $modifiers, mixed $acl, mixed $data) { $export = $this->getExport(); $query = $export->initiateQuery($modifiers, $acl, $data); diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index e1c8665ec..7482476cf 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -205,7 +205,7 @@ abstract class AbstractFilterTest extends KernelTestCase sprintf( "This test is incomplete due to %s thrown by 'translator' : %s, " . 'complete stack : %s', - get_class($ex), + $ex::class, $ex->getMessage(), $ex->getTraceAsString() ) diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php index ef421020e..3192a3edb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php @@ -27,10 +27,8 @@ final class UserApiControllerTest extends WebTestCase /** * @depends testIndex - * - * @param mixed $existingUser */ - public function testEntity($existingUser) + public function testEntity(mixed $existingUser) { $client = $this->getClientAuthenticated(); diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php index bc14d2604..1cbee3002 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php @@ -130,10 +130,8 @@ final class UserControllerTest extends WebTestCase /** * @dataProvider dataGenerateUserId - * - * @param mixed $username */ - public function testUpdatePassword(int $userId, $username) + public function testUpdatePassword(int $userId, mixed $username) { $crawler = $this->client->request('GET', "/fr/admin/user/{$userId}/edit_password"); $newPassword = '1234Password!'; diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index 4b812ce2b..98de6891f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -161,11 +161,8 @@ final class CronManagerTest extends TestCase class JobCanRun implements CronJobInterface { - private string $key; - - public function __construct(string $key) + public function __construct(private string $key) { - $this->key = $key; } public function canRun(?CronJobExecution $cronJobExecution): bool diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index f0a57e1b0..1ae052963 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -305,17 +305,11 @@ final class ExportManagerTest extends KernelTestCase Argument::is(['cat a', 'cat b']), Argument::is([]) ) - ->willReturn(static function ($value) { - switch ($value) { - case '_header': return 'foo_header'; - - case 'cat a': return 'label cat a'; - - case 'cat b': return 'label cat b'; - - default: - throw new RuntimeException(sprintf('This value (%s) is not valid', $value)); - } + ->willReturn(static fn ($value) => match ($value) { + '_header' => 'foo_header', + 'cat a' => 'label cat a', + 'cat b' => 'label cat b', + default => throw new RuntimeException(sprintf('This value (%s) is not valid', $value)), }); $aggregator->addRole()->willReturn(null); //$aggregator->addRole()->shouldBeCalled(); diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php index 2ae0ecab7..b2b2c2960 100644 --- a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php @@ -110,17 +110,15 @@ final class PageTest extends KernelTestCase /** * @param int $itemPerPage * @param string $route - * @param mixed $number - * @param mixed $totalItems * * @return Page */ protected function generatePage( - $number = 1, + mixed $number = 1, $itemPerPage = 10, $route = 'route', array $routeParameters = [], - $totalItems = 100 + mixed $totalItems = 100 ) { $urlGenerator = $this->prophet->prophesize(); $urlGenerator->willImplement(UrlGeneratorInterface::class); diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php index 52f156843..e10c48adb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php @@ -149,14 +149,13 @@ final class PaginatorTest extends KernelTestCase * @param int $totalItems * @param int $itemPerPage * @param int $currentPage - * @param mixed $expectedHasNextPage * @dataProvider generateHasPreviousPage */ public function testHasPreviousPage( $totalItems, $itemPerPage, $currentPage, - $expectedHasNextPage + mixed $expectedHasNextPage ) { $paginator = $this->generatePaginator($totalItems, $itemPerPage, $currentPage); @@ -215,15 +214,13 @@ final class PaginatorTest extends KernelTestCase /** * @param int $itemPerPage * @param string $route - * @param mixed $totalItems - * @param mixed $currentPageNumber * * @return Paginator */ protected function generatePaginator( - $totalItems, + mixed $totalItems, $itemPerPage, - $currentPageNumber = 1, + mixed $currentPageNumber = 1, $route = '', array $routeParameters = [] ) { diff --git a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php index 962aac450..aa2e1bf30 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php @@ -46,14 +46,8 @@ final class ExtractPhonenumberFromPatternTest extends KernelTestCase /** * @dataProvider provideData - * - * @param mixed $subject - * @param mixed $expectedCount - * @param mixed $expected - * @param mixed $filteredSubject - * @param mixed $msg */ - public function testExtract(string $defaultCarrierCode, $subject, $expectedCount, $expected, $filteredSubject, $msg) + public function testExtract(string $defaultCarrierCode, mixed $subject, mixed $expectedCount, mixed $expected, mixed $filteredSubject, mixed $msg) { $extractor = new ExtractPhonenumberFromPattern(new ParameterBag(['chill_main' => [ 'phone_helper' => ['default_carrier_code' => $defaultCarrierCode], diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php index 8c681bfb0..3f0e6a71d 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php @@ -230,12 +230,8 @@ final class AuthorizationHelperTest extends KernelTestCase /** * @dataProvider dataProvider_getReachableCenters - * - * @param mixed $test - * @param mixed $result - * @param mixed $msg */ - public function testGetReachableCenters($test, $result, $msg) + public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg) { $this->assertEquals($test, $result, $msg); } diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php index fb8aeae27..f7ef7e986 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php @@ -68,14 +68,8 @@ final class DateNormalizerTest extends KernelTestCase /** * @dataProvider generateDataNormalize - * - * @param mixed $expected - * @param mixed $date - * @param mixed $format - * @param mixed $locale - * @param mixed $msg */ - public function testNormalize($expected, $date, $format, $locale, $msg) + public function testNormalize(mixed $expected, mixed $date, mixed $format, mixed $locale, mixed $msg) { $this->assertEquals($expected, $this->buildDateNormalizer($locale)->normalize($date, $format, []), $msg); } diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php index c7212c8e6..b0363c1c6 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php @@ -51,10 +51,8 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase /** * @dataProvider dataProviderUserId - * - * @param mixed $userId */ - public function testGetMappedClass($userId) + public function testGetMappedClass(mixed $userId) { $data = ['type' => 'user', 'id' => $userId]; $supports = $this->normalizer->supportsDenormalization($data, User::class); diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php index af5a28d9f..450eac2b5 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/PhonenumberNormalizerTest.php @@ -38,12 +38,8 @@ final class PhonenumberNormalizerTest extends TestCase /** * @dataProvider dataProviderNormalizePhonenumber - * - * @param mixed $format - * @param mixed $context - * @param mixed $expected */ - public function testNormalize(?Phonenumber $phonenumber, $format, $context, $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/ChillMainBundle/Tests/TestHelper.php b/src/Bundle/ChillMainBundle/Tests/TestHelper.php index 79426270f..bc49e601f 100644 --- a/src/Bundle/ChillMainBundle/Tests/TestHelper.php +++ b/src/Bundle/ChillMainBundle/Tests/TestHelper.php @@ -21,14 +21,12 @@ class TestHelper /** * create a client authenticated with an user. * - * @param mixed $username - * @param mixed $password * * @return \Symfony\Component\BrowserKit\Client authenticated client */ public static function getAuthenticatedClientOptions( - $username = 'center a_social', - $password = 'password' + mixed $username = 'center a_social', + mixed $password = 'password' ) { return [ 'PHP_AUTH_USER' => $username, diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index 20fc1b48c..c223bc375 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -29,11 +29,6 @@ class TimelineBuilder implements ContainerAwareInterface { use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - /** - * @var \Doctrine\ORM\EntityManagerInterface - */ - private $em; - /** * Record provider. * @@ -52,9 +47,8 @@ class TimelineBuilder implements ContainerAwareInterface */ private $providersByContext = []; - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { - $this->em = $em; } /** @@ -260,13 +254,11 @@ class TimelineBuilder implements ContainerAwareInterface * get the template data from the provider for the given entity, by type. * * @param string $type - * @param mixed $entity * @param string $context * @param mixed[] $args - * * @return array the template data fetched from the provider */ - private function getTemplateData($type, $entity, $context, array $args) + private function getTemplateData($type, mixed $entity, $context, array $args) { foreach ($this->getProvidersByContext($context) as $provider) { if ($provider->supportsType($type)) { diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php index 6ea51bd75..519883590 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php @@ -15,34 +15,10 @@ use function strtr; class TimelineSingleQuery { - private ?string $date; - private bool $distinct = false; - private ?string $from; - - private ?string $id; - - private ?string $key; - - private array $parameters = []; - - private ?string $where; - - public function __construct( - ?string $id = null, - ?string $date = null, - ?string $key = null, - ?string $from = null, - ?string $where = null, - array $parameters = [] - ) { - $this->id = $id; - $this->date = $date; - $this->key = $key; - $this->from = $from; - $this->where = $where; - $this->parameters = $parameters; + public function __construct(private ?string $id = null, private ?string $date = null, private ?string $key = null, private ?string $from = null, private ?string $where = null, private array $parameters = []) + { } public function buildSql(): string diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php index 488bb35b7..7ddecf70c 100644 --- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php +++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php @@ -69,21 +69,18 @@ class DateRangeCovering private array $sequence = []; - private DateTimeZone $tz; - private int $uniqueKeyCounter = 0; /** * @param int $minCover the minimum of covering required */ - public function __construct(int $minCover, DateTimeZone $tz) + public function __construct(int $minCover, private DateTimeZone $tz) { if (0 > $minCover) { throw new LogicException('argument minCover cannot be lower than 0'); } $this->minCover = $minCover; - $this->tz = $tz; } public function add(DateTimeInterface $start, ?DateTimeInterface $end = null, $metadata = null): self diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php index 09620d2a9..1ffb767e3 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php @@ -24,29 +24,8 @@ use function in_array; class RoleScopeScopePresence extends ConstraintValidator { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var RoleProvider - */ - private $roleProvider; - - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct( - RoleProvider $roleProvider, - LoggerInterface $logger, - TranslatorInterface $translator - ) { - $this->roleProvider = $roleProvider; - $this->logger = $logger; - $this->translator = $translator; + public function __construct(private RoleProvider $roleProvider, private LoggerInterface $logger, private TranslatorInterface $translator) + { } public function validate($value, Constraint $constraint) diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php index 9305cbf09..0c9eae2c4 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php @@ -19,16 +19,8 @@ use Symfony\Component\Validator\ConstraintValidator; final class ValidPhonenumber extends ConstraintValidator { - private LoggerInterface $logger; - - private PhoneNumberHelperInterface $phonenumberHelper; - - public function __construct( - LoggerInterface $logger, - PhoneNumberHelperInterface $phonenumberHelper - ) { - $this->phonenumberHelper = $phonenumberHelper; - $this->logger = $logger; + public function __construct(private LoggerInterface $logger, private PhoneNumberHelperInterface $phonenumberHelper) + { } /** diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index 5340ac78b..3dc5928d6 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -22,14 +22,8 @@ use Symfony\Component\Workflow\Event\Event; final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface { - private CacheItemPoolInterface $cacheItemPool; - - private EntityWorkflowStepRepository $workflowStepRepository; - - public function __construct(EntityWorkflowStepRepository $workflowStepRepository, CacheItemPoolInterface $cacheItemPool) + public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) { - $this->workflowStepRepository = $workflowStepRepository; - $this->cacheItemPool = $cacheItemPool; } public function addNotification(UserInterface $u): int diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php index 5be5f3fd9..2f5356e6e 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php +++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php @@ -18,16 +18,10 @@ use Symfony\Component\Workflow\Registry; class EntityWorkflowManager { /** - * @var iterable|EntityWorkflowHandlerInterface[] + * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - private iterable $handlers; - - private Registry $registry; - - public function __construct(iterable $handlers, Registry $registry) + public function __construct(private iterable $handlers, private Registry $registry) { - $this->handlers = $handlers; - $this->registry = $registry; } public function getHandler(EntityWorkflow $entityWorkflow, array $options = []): EntityWorkflowHandlerInterface diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php index f3e04eeca..3657e4f53 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php @@ -25,20 +25,8 @@ use function array_key_exists; class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterface { - private LoggerInterface $chillLogger; - - private Security $security; - - private UserRender $userRender; - - public function __construct( - LoggerInterface $chillLogger, - Security $security, - UserRender $userRender - ) { - $this->chillLogger = $chillLogger; - $this->security = $security; - $this->userRender = $userRender; + public function __construct(private LoggerInterface $chillLogger, private Security $security, private UserRender $userRender) + { } public function addDests(Event $event): void diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index 76ad4a4b0..ceeb3023f 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -25,28 +25,8 @@ use function in_array; class NotificationOnTransition implements EventSubscriberInterface { - private EngineInterface $engine; - - private EntityManagerInterface $entityManager; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - private Security $security; - - public function __construct( - EntityManagerInterface $entityManager, - EngineInterface $engine, - MetadataExtractor $metadataExtractor, - Security $security, - Registry $registry - ) { - $this->entityManager = $entityManager; - $this->engine = $engine; - $this->metadataExtractor = $metadataExtractor; - $this->registry = $registry; - $this->security = $security; + public function __construct(private EntityManagerInterface $entityManager, private EngineInterface $engine, private MetadataExtractor $metadataExtractor, private Security $security, private Registry $registry) + { } public static function getSubscribedEvents(): array diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php index 7d0ad8280..b1ce5074c 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php @@ -21,23 +21,8 @@ use Symfony\Component\Workflow\Registry; class SendAccessKeyEventSubscriber { - private EngineInterface $engine; - - private EntityWorkflowManager $entityWorkflowManager; - - private MailerInterface $mailer; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct(EngineInterface $engine, MetadataExtractor $metadataExtractor, Registry $registry, EntityWorkflowManager $entityWorkflowManager, MailerInterface $mailer) + public function __construct(private EngineInterface $engine, private MetadataExtractor $metadataExtractor, private Registry $registry, private EntityWorkflowManager $entityWorkflowManager, private MailerInterface $mailer) { - $this->engine = $engine; - $this->metadataExtractor = $metadataExtractor; - $this->registry = $registry; - $this->entityWorkflowManager = $entityWorkflowManager; - $this->mailer = $mailer; } public function postPersist(EntityWorkflowStep $step): void diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index 071b31d35..87026e920 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -20,14 +20,8 @@ use function array_key_exists; class MetadataExtractor { - private Registry $registry; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(Registry $registry, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private Registry $registry, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->registry = $registry; - $this->translatableStringHelper = $translatableStringHelper; } public function availableWorkflowFor(string $relatedEntityClass, ?int $relatedEntityId = 0): array diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php index d3e848d41..9f286508c 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php @@ -20,20 +20,8 @@ use Symfony\Component\Security\Core\Security; class WorkflowNotificationHandler implements NotificationHandlerInterface { - private EntityWorkflowManager $entityWorkflowManager; - - private EntityWorkflowRepository $entityWorkflowRepository; - - private Security $security; - - public function __construct( - EntityWorkflowRepository $entityWorkflowRepository, - EntityWorkflowManager $entityWorkflowManager, - Security $security - ) { - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->entityWorkflowManager = $entityWorkflowManager; - $this->security = $security; + public function __construct(private EntityWorkflowRepository $entityWorkflowRepository, private EntityWorkflowManager $entityWorkflowManager, private Security $security) + { } public function getTemplate(Notification $notification, array $options = []): string diff --git a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php index 1ea593b6d..d1381a397 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php @@ -23,28 +23,8 @@ use Twig\Extension\RuntimeExtensionInterface; class WorkflowTwigExtensionRuntime implements RuntimeExtensionInterface { - private EntityWorkflowManager $entityWorkflowManager; - - private MetadataExtractor $metadataExtractor; - - private NormalizerInterface $normalizer; - - private Registry $registry; - - private EntityWorkflowRepository $repository; - - public function __construct( - EntityWorkflowManager $entityWorkflowManager, - Registry $registry, - EntityWorkflowRepository $repository, - MetadataExtractor $metadataExtractor, - NormalizerInterface $normalizer - ) { - $this->entityWorkflowManager = $entityWorkflowManager; - $this->registry = $registry; - $this->repository = $repository; - $this->metadataExtractor = $metadataExtractor; - $this->normalizer = $normalizer; + public function __construct(private EntityWorkflowManager $entityWorkflowManager, private Registry $registry, private EntityWorkflowRepository $repository, private MetadataExtractor $metadataExtractor, private NormalizerInterface $normalizer) + { } public function getTransitionByString(EntityWorkflow $entityWorkflow, string $key): ?Transition diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php index bb3586251..eb035358d 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php @@ -22,16 +22,12 @@ use function count; class EntityWorkflowCreationValidator extends \Symfony\Component\Validator\ConstraintValidator { - private EntityWorkflowManager $entityWorkflowManager; - - public function __construct(EntityWorkflowManager $entityWorkflowManager) + public function __construct(private EntityWorkflowManager $entityWorkflowManager) { - $this->entityWorkflowManager = $entityWorkflowManager; } /** * @param EntityWorkflow $value - * @param Constraint|EntityWorkflowCreation $constraint */ public function validate($value, Constraint $constraint) { @@ -45,7 +41,7 @@ class EntityWorkflowCreationValidator extends \Symfony\Component\Validator\Const try { $handler = $this->entityWorkflowManager->getHandler($value); - } catch (HandlerNotFoundException $e) { + } catch (HandlerNotFoundException) { $this->context->buildViolation($constraint->messageHandlerNotFound) ->addViolation(); diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php index 2c286fff9..1e0b6868c 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php @@ -22,7 +22,6 @@ class StepDestValidValidator extends ConstraintValidator { /** * @param EntityWorkflowStep $value - * @param Constraint|StepDestValid $constraint * * @return void */ diff --git a/src/Bundle/ChillMainBundle/migrations/Version20180703191509.php b/src/Bundle/ChillMainBundle/migrations/Version20180703191509.php index 397239e95..b73ee5362 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20180703191509.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20180703191509.php @@ -34,7 +34,7 @@ final class Version20180703191509 extends AbstractMigration try { $this->addSql('CREATE EXTENSION IF NOT EXISTS pg_trgm'); $this->addSql('CREATE INDEX search_name_code ON chill_main_postal_code USING GIN (LOWER(code) gin_trgm_ops, LOWER(label) gin_trgm_ops)'); - } catch (Exception $e) { + } catch (Exception) { $this->skipIf(true, 'Could not create extension pg_trgm'); } } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index 666febe9d..a24d8adb4 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -24,24 +24,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonAddressMoveEventSubscriber implements EventSubscriberInterface { - private EngineInterface $engine; - - private NotificationPersisterInterface $notificationPersister; - - private Security $security; - - private TranslatorInterface $translator; - - public function __construct( - EngineInterface $engine, - NotificationPersisterInterface $notificationPersister, - Security $security, - TranslatorInterface $translator - ) { - $this->engine = $engine; - $this->notificationPersister = $notificationPersister; - $this->security = $security; - $this->translator = $translator; + public function __construct(private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister, private Security $security, private TranslatorInterface $translator) + { } public static function getSubscribedEvents(): array diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index 8d7249928..cefc348c2 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -24,20 +24,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserRefEventSubscriber implements EventSubscriberInterface { - private EngineInterface $engine; - - private NotificationPersisterInterface $notificationPersister; - - private Security $security; - - private TranslatorInterface $translator; - - public function __construct(Security $security, TranslatorInterface $translator, EngineInterface $engine, NotificationPersisterInterface $notificationPersister) + public function __construct(private Security $security, private TranslatorInterface $translator, private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister) { - $this->security = $security; - $this->translator = $translator; - $this->engine = $engine; - $this->notificationPersister = $notificationPersister; } public static function getSubscribedEvents() diff --git a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php index 83623a026..b3a335ce7 100644 --- a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php +++ b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php @@ -22,25 +22,6 @@ class ActionEvent extends Event public const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY'; - /** - * the FQDN class name as recorded in doctrine. - * - * @var string - */ - protected $entity; - - /** - * an array of key value data to describe the movement. - * - * @var array - */ - protected $metadata; - - /** - * @var int - */ - protected $personId; - /** * @var string[] */ @@ -52,18 +33,26 @@ class ActionEvent extends Event protected $preSql = []; /** - * the sql statement. - * - * @var string + * @param string $entity + * @param mixed[] $metadata + * @param int $personId + * @param string $sqlStatement */ - protected $sqlStatement; - - public function __construct($personId, $entity, $sqlStatement, $metadata = []) - { - $this->personId = $personId; - $this->entity = $entity; - $this->sqlStatement = $sqlStatement; - $this->metadata = $metadata; + public function __construct( + protected $personId, + /** + * the FQDN class name as recorded in doctrine. + */ + protected $entity, + /** + * the sql statement. + */ + protected $sqlStatement, + /** + * an array of key value data to describe the movement. + */ + protected $metadata = [] + ) { } /** diff --git a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php index 7bd337f6b..398114363 100644 --- a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php +++ b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php @@ -131,25 +131,14 @@ class EntityPersonCRUDController extends CRUDController return $this->getActionConfig($action)['template']; } - switch ($action) { - case 'new': - return '@ChillPerson/CRUD/new.html.twig'; - - case 'edit': - return '@ChillPerson/CRUD/edit.html.twig'; - - case 'view': - return '@ChillPerson/CRUD/view.html.twig'; - - case 'delete': - return '@ChillPerson/CRUD/delete.html.twig'; - - case 'index': - return '@ChillPerson/CRUD/index.html.twig'; - - default: - return parent::getTemplateFor($action, $entity, $request); - } + return match ($action) { + 'new' => '@ChillPerson/CRUD/new.html.twig', + 'edit' => '@ChillPerson/CRUD/edit.html.twig', + 'view' => '@ChillPerson/CRUD/view.html.twig', + 'delete' => '@ChillPerson/CRUD/delete.html.twig', + 'index' => '@ChillPerson/CRUD/index.html.twig', + default => parent::getTemplateFor($action, $entity, $request), + }; } /** @@ -161,28 +150,21 @@ class EntityPersonCRUDController extends CRUDController { $next = $request->request->get('submit', 'save-and-close'); - switch ($next) { - case 'save-and-close': - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [ - 'person_id' => $this->getPerson($request)->getId(), - ]); - - case 'save-and-new': - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [ - 'person_id' => $this->getPerson($request)->getId(), - ]); - - case 'new': - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ - 'id' => $entity->getId(), - 'person_id' => $this->getPerson($request)->getId(), - ]); - - default: - return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ - 'id' => $entity->getId(), - 'person_id' => $this->getPerson($request)->getId(), - ]); - } + return match ($next) { + 'save-and-close' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [ + 'person_id' => $this->getPerson($request)->getId(), + ]), + 'save-and-new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [ + 'person_id' => $this->getPerson($request)->getId(), + ]), + 'new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ + 'id' => $entity->getId(), + 'person_id' => $this->getPerson($request)->getId(), + ]), + default => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [ + 'id' => $entity->getId(), + 'person_id' => $this->getPerson($request)->getId(), + ]), + }; } } diff --git a/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php b/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php index b5f2cfeec..f9c53712a 100644 --- a/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php +++ b/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php @@ -50,21 +50,14 @@ class OneToOneEntityPersonCRUDController extends CRUDController return $this->crudConfig[$action]['template']; } - switch ($action) { - case 'new': - return '@ChillPerson/CRUD/new.html.twig'; - - case 'edit': - return '@ChillPerson/CRUD/edit.html.twig'; - - case 'index': - return '@ChillPerson/CRUD/index.html.twig'; - - default: - throw new LogicException("the view for action {$action} is not " - . 'defined. You should override ' . __METHOD__ . ' to add this ' - . 'action'); - } + return match ($action) { + 'new' => '@ChillPerson/CRUD/new.html.twig', + 'edit' => '@ChillPerson/CRUD/edit.html.twig', + 'index' => '@ChillPerson/CRUD/index.html.twig', + default => throw new LogicException("the view for action {$action} is not " + . 'defined. You should override ' . __METHOD__ . ' to add this ' + . 'action'), + }; } protected function onPostFetchEntity($action, Request $request, $entity): ?Response diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index 231f7b27d..42b8f6cac 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -25,22 +25,12 @@ use function ctype_digit; final class ChillPersonMoveCommand extends Command { - private LoggerInterface $chillLogger; - - private EntityManagerInterface $em; - - private PersonMove $mover; - public function __construct( - PersonMove $mover, - EntityManagerInterface $em, - LoggerInterface $chillLogger + private PersonMove $mover, + private EntityManagerInterface $em, + private LoggerInterface $chillLogger ) { parent::__construct('chill:person:move'); - - $this->mover = $mover; - $this->em = $em; - $this->chillLogger = $chillLogger; } protected function buildLoggingContext(Person $from, Person $to, $deleteEntities, $sqls) diff --git a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php index 91615935c..643e176c4 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php @@ -27,17 +27,10 @@ final class ImportSocialWorkMetadata extends Command { protected EntityManagerInterface $em; - /** - * @var LoggerInterface - */ - protected ChillImporter $importer; - public function __construct( - SocialWorkMetadataInterface $socialWorkMetadata + protected SocialWorkMetadataInterface $importer ) { parent::__construct('chill:person:import-socialwork'); - - $this->importer = $socialWorkMetadata; } protected function configure() diff --git a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php index 8d43df0d3..ac6551bd2 100644 --- a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php @@ -22,16 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface; class RemoveOldDraftAccompanyingPeriodCommand extends Command { - private LoggerInterface $logger; - - private OldDraftAccompanyingPeriodRemoverInterface $remover; - - public function __construct(LoggerInterface $logger, OldDraftAccompanyingPeriodRemoverInterface $remover) + public function __construct(private LoggerInterface $logger, private OldDraftAccompanyingPeriodRemoverInterface $remover) { parent::__construct('chill:person:remove-old-draft-period'); - - $this->logger = $logger; - $this->remover = $remover; } protected function configure(): void diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php index 8c4be9477..b3180792e 100644 --- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php +++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php @@ -17,15 +17,14 @@ namespace Chill\PersonBundle\Config; class ConfigPersonAltNamesHelper { /** - * the raw config, directly from the container parameter. - * - * @var array + * @param mixed[] $config */ - private $config = []; - - public function __construct($config) - { - $this->config = $config; + public function __construct( + /** + * the raw config, directly from the container parameter. + */ + private $config + ) { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 181f60a02..10329a87c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -51,32 +51,8 @@ use function count; final class AccompanyingCourseApiController extends ApiController { - private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository; - - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private EventDispatcherInterface $eventDispatcher; - - private ReferralsSuggestionInterface $referralAvailable; - - private Registry $registry; - - private ValidatorInterface $validator; - - public function __construct( - AccompanyingPeriodRepository $accompanyingPeriodRepository, - AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, - EventDispatcherInterface $eventDispatcher, - ReferralsSuggestionInterface $referralAvailable, - Registry $registry, - ValidatorInterface $validator - ) { - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository; - $this->eventDispatcher = $eventDispatcher; - $this->referralAvailable = $referralAvailable; - $this->registry = $registry; - $this->validator = $validator; + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private EventDispatcherInterface $eventDispatcher, private ReferralsSuggestionInterface $referralAvailable, private Registry $registry, private ValidatorInterface $validator) + { } public function commentApi($id, Request $request, string $_format): Response @@ -190,20 +166,11 @@ final class AccompanyingCourseApiController extends ApiController // $this->onPostCheckACL('participation', $request, $_format, $accompanyingPeriod); - switch ($request->getMethod()) { - case Request::METHOD_POST: - $participation = $accompanyingPeriod->createParticipationFor($person); - - break; - - case Request::METHOD_DELETE: - $participation = $accompanyingPeriod->closeParticipationFor($person); - - break; - - default: - throw new BadRequestHttpException('This method is not supported'); - } + $participation = match ($request->getMethod()) { + Request::METHOD_POST => $accompanyingPeriod->createParticipationFor($person), + Request::METHOD_DELETE => $accompanyingPeriod->closeParticipationFor($person), + default => throw new BadRequestHttpException('This method is not supported'), + }; $errors = $this->validator->validate($accompanyingPeriod); @@ -320,10 +287,8 @@ final class AccompanyingCourseApiController extends ApiController /** * @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential") * @ParamConverter("accompanyingCourse", options={"id": "id"}) - * - * @param mixed $id */ - public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, $id, Request $request) + public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request) { if ($request->getMethod() === 'POST') { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL, $accompanyingCourse); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index 5a6946696..99608d640 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -32,20 +32,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseCommentController extends AbstractController { - private EntityManagerInterface $entityManager; - - private FormFactoryInterface $formFactory; - - private TranslatorInterface $translator; - - public function __construct( - EntityManagerInterface $entityManager, - FormFactoryInterface $formFactory, - TranslatorInterface $translator - ) { - $this->entityManager = $entityManager; - $this->formFactory = $formFactory; - $this->translator = $translator; + public function __construct(private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private TranslatorInterface $translator) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index f7e3b3800..41e4a9b90 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -41,32 +41,8 @@ use function is_array; */ class AccompanyingCourseController extends Controller { - protected EventDispatcherInterface $dispatcher; - - protected SerializerInterface $serializer; - - protected ValidatorInterface $validator; - - private Registry $registry; - - private TranslatorInterface $translator; - - private AccompanyingPeriodWorkRepository $workRepository; - - public function __construct( - SerializerInterface $serializer, - EventDispatcherInterface $dispatcher, - ValidatorInterface $validator, - AccompanyingPeriodWorkRepository $workRepository, - Registry $registry, - TranslatorInterface $translator - ) { - $this->serializer = $serializer; - $this->dispatcher = $dispatcher; - $this->validator = $validator; - $this->workRepository = $workRepository; - $this->registry = $registry; - $this->translator = $translator; + public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private AccompanyingPeriodWorkRepository $workRepository, private Registry $registry, private TranslatorInterface $translator) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index b7c189155..f57ad0c56 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -23,11 +23,8 @@ use Symfony\Component\Routing\Annotation\Route; class AccompanyingCourseWorkApiController extends ApiController { - private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository; - - public function __construct(AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) + public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) { - $this->accompanyingPeriodWorkRepository = $accompanyingPeriodWorkRepository; } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 8d15ca30f..a36ad67b0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -28,28 +28,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseWorkController extends AbstractController { - private LoggerInterface $chillLogger; - - private PaginatorFactory $paginator; - - private SerializerInterface $serializer; - - private TranslatorInterface $trans; - - private AccompanyingPeriodWorkRepository $workRepository; - - public function __construct( - TranslatorInterface $trans, - SerializerInterface $serializer, - AccompanyingPeriodWorkRepository $workRepository, - PaginatorFactory $paginator, - LoggerInterface $chillLogger - ) { - $this->trans = $trans; - $this->serializer = $serializer; - $this->workRepository = $workRepository; - $this->paginator = $paginator; - $this->chillLogger = $chillLogger; + public function __construct(private TranslatorInterface $trans, private SerializerInterface $serializer, private AccompanyingPeriodWorkRepository $workRepository, private PaginatorFactory $paginator, private LoggerInterface $chillLogger) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index b32454387..a75785ce0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -36,8 +36,6 @@ use function count; */ class AccompanyingPeriodController extends AbstractController { - protected AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository; - /** * @var EventDispatcherInterface */ @@ -49,11 +47,10 @@ class AccompanyingPeriodController extends AbstractController protected $validator; public function __construct( - AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, + protected AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, EventDispatcherInterface $eventDispatcher, ValidatorInterface $validator ) { - $this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository; $this->eventDispatcher = $eventDispatcher; $this->validator = $validator; } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index 6bbb6c368..34aeb835a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -32,26 +32,8 @@ use Symfony\Component\Templating\EngineInterface; class AccompanyingPeriodRegulationListController { - private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository; - - private EngineInterface $engine; - - private FormFactoryInterface $formFactory; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, EngineInterface $engine, FormFactoryInterface $formFactory, PaginatorFactory $paginatorFactory, Security $security, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository; - $this->engine = $engine; - $this->formFactory = $formFactory; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; - $this->translatableStringHelper = $translatableStringHelper; } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index e41ab07c7..9a4b5e15a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -32,28 +32,8 @@ use function in_array; class AccompanyingPeriodWorkEvaluationApiController { - private AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository; - - private DocGeneratorTemplateRepository $docGeneratorTemplateRepository; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private SerializerInterface $serializer; - - public function __construct( - AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, - DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - SerializerInterface $serializer, - PaginatorFactory $paginatorFactory, - Security $security - ) { - $this->accompanyingPeriodWorkEvaluationRepository = $accompanyingPeriodWorkEvaluationRepository; - $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; - $this->serializer = $serializer; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; + public function __construct(private AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private SerializerInterface $serializer, private PaginatorFactory $paginatorFactory, private Security $security) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index 19080923e..695caa976 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -35,20 +35,8 @@ use function array_values; class HouseholdApiController extends ApiController { - private EventDispatcherInterface $eventDispatcher; - - private HouseholdACLAwareRepositoryInterface $householdACLAwareRepository; - - private HouseholdRepository $householdRepository; - - public function __construct( - EventDispatcherInterface $eventDispatcher, - HouseholdRepository $householdRepository, - HouseholdACLAwareRepositoryInterface $householdACLAwareRepository - ) { - $this->eventDispatcher = $eventDispatcher; - $this->householdRepository = $householdRepository; - $this->householdACLAwareRepository = $householdACLAwareRepository; + public function __construct(private EventDispatcherInterface $eventDispatcher, private HouseholdRepository $householdRepository, private HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 61e030322..1abb6290f 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -36,53 +36,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdCompositionController extends AbstractController { - private EngineInterface $engine; - - private EntityManagerInterface $entityManager; - - private FormFactoryInterface $formFactory; - - private HouseholdCompositionRepository $householdCompositionRepository; - - private HouseholdRepository $householdRepository; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private TranslatorInterface $translator; - - private UrlGeneratorInterface $urlGenerator; - - public function __construct( - Security $security, - HouseholdCompositionRepository $householdCompositionRepository, - HouseholdRepository $householdRepository, - PaginatorFactory $paginatorFactory, - FormFactoryInterface $formFactory, - EntityManagerInterface $entityManager, - TranslatorInterface $translator, - EngineInterface $engine, - UrlGeneratorInterface $urlGenerator - ) { - $this->security = $security; - $this->householdCompositionRepository = $householdCompositionRepository; - $this->paginatorFactory = $paginatorFactory; - $this->formFactory = $formFactory; - $this->entityManager = $entityManager; - $this->translator = $translator; - $this->engine = $engine; - $this->urlGenerator = $urlGenerator; - $this->householdRepository = $householdRepository; + public function __construct(private Security $security, private HouseholdCompositionRepository $householdCompositionRepository, private HouseholdRepository $householdRepository, private PaginatorFactory $paginatorFactory, private FormFactoryInterface $formFactory, private EntityManagerInterface $entityManager, private TranslatorInterface $translator, private EngineInterface $engine, private UrlGeneratorInterface $urlGenerator) + { } /** * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") - * - * @param mixed $household_id - * @param mixed $composition_id */ - public function deleteAction(Request $request, $household_id, $composition_id): Response + public function deleteAction(Request $request, mixed $household_id, mixed $composition_id): Response { $composition = $this->householdCompositionRepository->find($composition_id); $household = $this->householdRepository->find($household_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeApiController.php index dc332acdd..4e07e4004 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeApiController.php @@ -23,14 +23,9 @@ class HouseholdCompositionTypeApiController extends ApiController */ protected function customizeQuery(string $action, Request $request, $query): void { - switch ($action) { - case '_index': - $query->andWhere($query->expr()->eq('e.active', "'TRUE'")); - - break; - - default: - throw new UnexpectedValueException('unexepcted action: ' . $action); - } + match ($action) { + '_index' => $query->andWhere($query->expr()->eq('e.active', "'TRUE'")), + default => throw new UnexpectedValueException('unexepcted action: ' . $action), + }; } } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 42092249b..9c4ae1441 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -37,24 +37,8 @@ use function count; */ class HouseholdController extends AbstractController { - private PositionRepository $positionRepository; - - private Security $security; - - private SerializerInterface $serializer; - - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator, - PositionRepository $positionRepository, - SerializerInterface $serializer, - Security $security - ) { - $this->translator = $translator; - $this->positionRepository = $positionRepository; - $this->serializer = $serializer; - $this->security = $security; + public function __construct(private TranslatorInterface $translator, private PositionRepository $positionRepository, private SerializerInterface $serializer, private Security $security) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index d286cb270..24cda5fc1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -32,20 +32,8 @@ use function count; class HouseholdMemberController extends ApiController { - private UrlGeneratorInterface $generator; - - private AccompanyingPeriodRepository $periodRepository; - - private TranslatorInterface $translator; - - public function __construct( - UrlGeneratorInterface $generator, - TranslatorInterface $translator, - AccompanyingPeriodRepository $periodRepository - ) { - $this->generator = $generator; - $this->translator = $translator; - $this->periodRepository = $periodRepository; + public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private AccompanyingPeriodRepository $periodRepository) + { } /** @@ -175,10 +163,8 @@ class HouseholdMemberController extends ApiController * "/api/1.0/person/household/members/move.{_format}", * name="chill_api_person_household_members_move" * ) - * - * @param mixed $_format */ - public function move(Request $request, $_format): Response + public function move(Request $request, mixed $_format): Response { try { /** @var MembersEditor $editor */ diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 59ef949cf..133daf3be 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -287,8 +287,6 @@ class PersonAddressController extends AbstractController } /** - * @param Chill\PersonBundle\Entity\Person $person - * * @return \Symfony\Component\Validator\ConstraintViolationListInterface */ private function validatePerson(Person $person) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 505f307e6..a3513fc1a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -27,19 +27,13 @@ use function in_array; class PersonApiController extends ApiController { - private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation; - - private ConfigPersonAltNamesHelper $configPersonAltNameHelper; - private bool $showCenters; public function __construct( - AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation, - ConfigPersonAltNamesHelper $configPersonAltNameHelper, + private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation, + private ConfigPersonAltNamesHelper $configPersonAltNameHelper, ParameterBagInterface $parameterBag ) { - $this->authorizedCenterOnPersonCreation = $authorizedCenterOnPersonCreation; - $this->configPersonAltNameHelper = $configPersonAltNameHelper; $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 2d4732289..016577130 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -47,68 +47,20 @@ use function is_array; final class PersonController extends AbstractController { - private AuthorizationHelperInterface $authorizationHelper; - - /** - * @var ConfigPersonAltNamesHelper - */ - protected $configPersonAltNameHelper; - - /** - * @var EventDispatcherInterface - */ - protected $eventDispatcher; - - /** - * @var PersonRepository; - */ - protected $personRepository; - - /** - * @var SimilarPersonMatcher - */ - protected $similarPersonMatcher; - - /** - * @var TranslatorInterface - */ - protected $translator; - - /** - * @var EntityManagerInterface - */ - private $em; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - - /** - * @var ValidatorInterface - */ - private $validator; - public function __construct( - AuthorizationHelperInterface $authorizationHelper, - SimilarPersonMatcher $similarPersonMatcher, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher, - PersonRepository $personRepository, - ConfigPersonAltNamesHelper $configPersonAltNameHelper, - LoggerInterface $logger, - ValidatorInterface $validator, - EntityManagerInterface $em, + private AuthorizationHelperInterface $authorizationHelper, + protected SimilarPersonMatcher $similarPersonMatcher, + protected TranslatorInterface $translator, + protected EventDispatcherInterface $eventDispatcher, + /** + * @var PersonRepository; + */ + protected PersonRepository $personRepository, + protected ConfigPersonAltNamesHelper $configPersonAltNameHelper, + private LoggerInterface $logger, + private ValidatorInterface $validator, + private EntityManagerInterface $em ) { - $this->authorizationHelper = $authorizationHelper; - $this->similarPersonMatcher = $similarPersonMatcher; - $this->translator = $translator; - $this->eventDispatcher = $eventDispatcher; - $this->configPersonAltNameHelper = $configPersonAltNameHelper; - $this->personRepository = $personRepository; - $this->logger = $logger; - $this->validator = $validator; - $this->em = $em; } public function editAction($person_id, Request $request) @@ -335,11 +287,10 @@ final class PersonController extends AbstractController /** * easy getting a person by his id. * - * @param mixed $id * * @return \Chill\PersonBundle\Entity\Person */ - private function _getPerson($id) + private function _getPerson(mixed $id) { return $this->personRepository->find($id); } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 928112d2e..d699937f4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -34,43 +34,8 @@ use function count; class PersonDuplicateController extends Controller { - /** - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * @var \Chill\PersonBundle\Actions\Remove\PersonMove - */ - private $personMove; - - /** - * @var \Chill\PersonBundle\Repository\PersonRepository - */ - private $personRepository; - - /** - * @var \Chill\PersonBundle\Search\SimilarPersonMatcher - */ - private $similarPersonMatcher; - - /** - * @var \Symfony\Component\Translation\TranslatorInterface - */ - private $translator; - - public function __construct( - SimilarPersonMatcher $similarPersonMatcher, - TranslatorInterface $translator, - PersonRepository $personRepository, - PersonMove $personMove, - EventDispatcherInterface $eventDispatcher - ) { - $this->similarPersonMatcher = $similarPersonMatcher; - $this->translator = $translator; - $this->personRepository = $personRepository; - $this->personMove = $personMove; - $this->eventDispatcher = $eventDispatcher; + public function __construct(private SimilarPersonMatcher $similarPersonMatcher, private TranslatorInterface $translator, private PersonRepository $personRepository, private PersonMove $personMove, private EventDispatcherInterface $eventDispatcher) + { } public function confirmAction($person1_id, $person2_id, Request $request) @@ -279,10 +244,8 @@ class PersonDuplicateController extends Controller /** * easy getting a person by his id. - * - * @param mixed $id */ - private function _getPerson($id): ?Person + private function _getPerson(mixed $id): ?Person { return $this->personRepository->find($id); } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index 6ba9ca558..a1b852ba0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -25,24 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceController extends AbstractController { - private EntityManagerInterface $em; - - private PersonRepository $personRepository; - - private PersonResourceRepository $personResourceRepository; - - private TranslatorInterface $translator; - - public function __construct( - PersonResourceRepository $personResourceRepository, - PersonRepository $personRepository, - EntityManagerInterface $em, - TranslatorInterface $translator - ) { - $this->personResourceRepository = $personResourceRepository; - $this->personRepository = $personRepository; - $this->em = $em; - $this->translator = $translator; + public function __construct(private PersonResourceRepository $personResourceRepository, private PersonRepository $personRepository, private EntityManagerInterface $em, private TranslatorInterface $translator) + { } public function deleteAction(Request $request, $person_id, $resource_id): Response diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index bafc4b1cb..2a90c57a8 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -40,44 +40,8 @@ use function is_int; class ReassignAccompanyingPeriodController extends AbstractController { - private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository; - - private AccompanyingPeriodRepository $courseRepository; - - private EntityManagerInterface $em; - - private EngineInterface $engine; - - private FormFactoryInterface $formFactory; - - private PaginatorFactory $paginatorFactory; - - private Security $security; - - private UserRender $userRender; - - private UserRepository $userRepository; - - public function __construct( - AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, - UserRepository $userRepository, - AccompanyingPeriodRepository $courseRepository, - EngineInterface $engine, - FormFactoryInterface $formFactory, - PaginatorFactory $paginatorFactory, - Security $security, - UserRender $userRender, - EntityManagerInterface $em - ) { - $this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository; - $this->engine = $engine; - $this->formFactory = $formFactory; - $this->paginatorFactory = $paginatorFactory; - $this->security = $security; - $this->userRepository = $userRepository; - $this->userRender = $userRender; - $this->courseRepository = $courseRepository; - $this->em = $em; + public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private UserRepository $userRepository, private AccompanyingPeriodRepository $courseRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private UserRender $userRender, private EntityManagerInterface $em) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php index 572deb896..4d11e2620 100644 --- a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php @@ -21,14 +21,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class RelationshipApiController extends ApiController { - private RelationshipRepository $repository; - - private ValidatorInterface $validator; - - public function __construct(ValidatorInterface $validator, RelationshipRepository $repository) + public function __construct(private ValidatorInterface $validator, private RelationshipRepository $repository) { - $this->validator = $validator; - $this->repository = $repository; } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index e128b1486..7daf926fc 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -27,20 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class ResidentialAddressController extends AbstractController { - private UrlGeneratorInterface $generator; - - private ResidentialAddressRepository $residentialAddressRepository; - - private TranslatorInterface $translator; - - public function __construct( - UrlGeneratorInterface $generator, - TranslatorInterface $translator, - ResidentialAddressRepository $residentialAddressRepository - ) { - $this->generator = $generator; - $this->translator = $translator; - $this->residentialAddressRepository = $residentialAddressRepository; + public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private ResidentialAddressRepository $residentialAddressRepository) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index bd12ec8c2..8bfc90c0b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -22,11 +22,8 @@ use Symfony\Component\Routing\Annotation\Route; class SocialWorkEvaluationApiController extends AbstractController { - private PaginatorFactory $paginatorFactory; - - public function __construct(PaginatorFactory $paginatorFactory) + public function __construct(private PaginatorFactory $paginatorFactory) { - $this->paginatorFactory = $paginatorFactory; } /** diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php index 716aa0b2e..45165eec4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php @@ -21,14 +21,8 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkGoalApiController extends ApiController { - private GoalRepository $goalRepository; - - private PaginatorFactory $paginator; - - public function __construct(GoalRepository $goalRepository, PaginatorFactory $paginator) + public function __construct(private GoalRepository $goalRepository, private PaginatorFactory $paginator) { - $this->goalRepository = $goalRepository; - $this->paginator = $paginator; } public function listBySocialAction(Request $request, SocialAction $action): Response diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php index eee01a351..397164707 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php @@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkResultApiController extends ApiController { - private ResultRepository $resultRepository; - - public function __construct(ResultRepository $resultRepository) + public function __construct(private ResultRepository $resultRepository) { - $this->resultRepository = $resultRepository; } public function listByGoal(Request $request, Goal $goal): Response diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php index 4fe877a72..09f34dce9 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php @@ -23,14 +23,8 @@ use function count; class SocialWorkSocialActionApiController extends ApiController { - private PaginatorFactory $paginator; - - private SocialIssueRepository $socialIssueRepository; - - public function __construct(SocialIssueRepository $socialIssueRepository, PaginatorFactory $paginator) + public function __construct(private SocialIssueRepository $socialIssueRepository, private PaginatorFactory $paginator) { - $this->socialIssueRepository = $socialIssueRepository; - $this->paginator = $paginator; } public function listBySocialIssueApi($id, Request $request) diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index 95446e59b..b736715e4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -22,20 +22,8 @@ use Symfony\Component\HttpFoundation\Request; class TimelinePersonController extends AbstractController { - protected EventDispatcherInterface $eventDispatcher; - - protected PaginatorFactory $paginatorFactory; - - protected TimelineBuilder $timelineBuilder; - - public function __construct( - EventDispatcherInterface $eventDispatcher, - TimelineBuilder $timelineBuilder, - PaginatorFactory $paginatorFactory - ) { - $this->eventDispatcher = $eventDispatcher; - $this->timelineBuilder = $timelineBuilder; - $this->paginatorFactory = $paginatorFactory; + public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory) + { } public function personAction(Request $request, $person_id) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 658fdb7be..4a8580d30 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -19,14 +19,8 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private PaginatorFactory $paginatorFactory; - - public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository, PaginatorFactory $paginatorFactory) + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private PaginatorFactory $paginatorFactory) { - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->paginatorFactory = $paginatorFactory; } /** diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php index 94c907689..06e1aab71 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php @@ -31,16 +31,8 @@ class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture */ private array $cacheEvaluations = []; - private EvaluationRepository $evaluationRepository; - - private AccompanyingPeriodRepository $periodRepository; - - public function __construct( - AccompanyingPeriodRepository $periodRepository, - EvaluationRepository $evaluationRepository - ) { - $this->periodRepository = $periodRepository; - $this->evaluationRepository = $evaluationRepository; + public function __construct(private AccompanyingPeriodRepository $periodRepository, private EvaluationRepository $evaluationRepository) + { } public function getDependencies() diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php index 78180adff..e229fb877 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php @@ -46,25 +46,11 @@ class LoadCustomFields extends AbstractFixture implements */ private $customFieldText; - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - /** - * @var TranslatorInterface - */ - private $translator; - /** * LoadCustomFields constructor. */ - public function __construct( - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { } //put your code here diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php index 342dfb020..b619de76d 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php @@ -37,18 +37,12 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface { private const NUMBER_OF_HOUSEHOLD = 10; - private MembersEditorFactory $editorFactory; - - private EntityManagerInterface $em; - private NativeLoader $loader; private array $personIds; - public function __construct(MembersEditorFactory $editorFactory, EntityManagerInterface $em) + public function __construct(private MembersEditorFactory $editorFactory, private EntityManagerInterface $em) { - $this->editorFactory = $editorFactory; - $this->em = $em; $this->loader = new NativeLoader(); } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php index 4f43879fd..c658a6510 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php @@ -86,24 +86,10 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord */ protected array $cacheUsers = []; - protected CenterRepository $centerRepository; - - protected CountryRepository $countryRepository; - protected Generator $faker; protected NativeLoader $loader; - protected MaritalStatusRepository $maritalStatusRepository; - - protected ScopeRepository $scopeRepository; - - protected SocialIssueRepository $socialIssueRepository; - - protected UserRepository $userRepository; - - protected Registry $workflowRegistry; - private $genders = [Person::MALE_GENDER, Person::FEMALE_GENDER, Person::BOTH_GENDER]; private $peoples = [ @@ -243,24 +229,17 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord ]; public function __construct( - Registry $workflowRegistry, - SocialIssueRepository $socialIssueRepository, - CenterRepository $centerRepository, - CountryRepository $countryRepository, - MaritalStatusRepository $maritalStatusRepository, - ScopeRepository $scopeRepository, - UserRepository $userRepository + protected Registry $workflowRegistry, + protected SocialIssueRepository $socialIssueRepository, + protected CenterRepository $centerRepository, + protected CountryRepository $countryRepository, + protected MaritalStatusRepository $maritalStatusRepository, + protected ScopeRepository $scopeRepository, + protected UserRepository $userRepository ) { $this->faker = Factory::create('fr_FR'); $this->faker->addProvider($this); - $this->workflowRegistry = $workflowRegistry; - $this->socialIssueRepository = $socialIssueRepository; - $this->centerRepository = $centerRepository; - $this->countryRepository = $countryRepository; - $this->maritalStatusRepository = $maritalStatusRepository; $this->loader = new NativeLoader($this->faker); - $this->scopeRepository = $scopeRepository; - $this->userRepository = $userRepository; } public function getOrder() diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 6b5cf0696..65d79b243 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -28,11 +28,8 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface { use PersonRandomHelper; - private EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(private EntityManagerInterface $em) { - $this->em = $em; } public function getDependencies(): array diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php index 12c85c59d..9605ce6f6 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php @@ -21,11 +21,8 @@ use Throwable; class LoadSocialWorkMetadata extends Fixture implements OrderedFixtureInterface { - private SocialWorkMetadata $importer; - - public function __construct(SocialWorkMetadata $importer) + public function __construct(private SocialWorkMetadata $importer) { - $this->importer = $importer; } public function getOrder() diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 6a2dc924e..daa71754f 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -1081,17 +1081,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $container->setParameter('chill_person.person_fields', $config); foreach ($config as $key => $value) { - switch ($key) { - case 'accompanying_period': - $container->setParameter('chill_person.accompanying_period', $value); - - break; - - default: - $container->setParameter('chill_person.person_fields.' . $key, $value); - - break; - } + match ($key) { + 'accompanying_period' => $container->setParameter('chill_person.accompanying_period', $value), + default => $container->setParameter('chill_person.person_fields.' . $key, $value), + }; } } } diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php index a591663ad..f84fd49e1 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php @@ -49,7 +49,7 @@ class Configuration implements ConfigurationInterface ->ifTrue(static function ($period) { try { $interval = new DateInterval($period); - } catch (Exception $ex) { + } catch (Exception) { return true; } @@ -139,17 +139,10 @@ class Configuration implements ConfigurationInterface $tree = new TreeBuilder($key, 'enum'); $node = $tree->getRootNode(); - switch ($key) { - case 'accompanying_period': - $info = 'If the accompanying periods are shown'; - - break; - - default: - $info = "If the field {$key} must be shown"; - - break; - } + $info = match ($key) { + 'accompanying_period' => 'If the accompanying periods are shown', + default => "If the field {$key} must be shown", + }; $node ->values(['hidden', 'visible']) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index a0f6e7d7e..15970471a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -571,7 +571,7 @@ class AccompanyingPeriod implements * * @param mixed $person */ - public function closeParticipationFor($person): ?AccompanyingPeriodParticipation + public function closeParticipationFor(mixed $person): ?AccompanyingPeriodParticipation { $participation = $this->getOpenParticipationContainsPerson($person); @@ -950,10 +950,9 @@ class AccompanyingPeriod implements } /** - * @return Person|ThirdParty * @Groups({"read"}) */ - public function getRequestor() + public function getRequestor(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty { return $this->requestorPerson ?? $this->requestorThirdParty; } @@ -1215,7 +1214,7 @@ class AccompanyingPeriod implements * * @return AccompanyingPeriod */ - public function setClosingDate($closingDate) + public function setClosingDate(mixed $closingDate) { $this->closingDate = $closingDate; @@ -1274,11 +1273,10 @@ class AccompanyingPeriod implements /** * Set openingDate. * - * @param mixed $openingDate * * @return AccompanyingPeriod */ - public function setOpeningDate($openingDate) + public function setOpeningDate(mixed $openingDate) { if ($this->openingDate !== $openingDate) { $this->openingDate = $openingDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 8780f7d17..26df8f9ea 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -365,11 +365,9 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU /** * Arbitrary data, used for client. * - * @param mixed $key * - * @return AccompanyingPeriodWorkEvaluation */ - public function setKey($key): self + public function setKey(mixed $key): self { $this->key = $key; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php index 1b2bbea44..b3ad86ed6 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php @@ -147,11 +147,9 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct } /** - * @param mixed $key - * * @return AccompanyingPeriodWorkEvaluationDocument */ - public function setKey($key) + public function setKey(mixed $key) { $this->key = $key; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index aa8a16229..48479782a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -94,10 +94,9 @@ class Resource } /** - * @return Person|ThirdParty * @Groups({"read"}) */ - public function getResource() + public function getResource(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\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 2e073e50e..e2325aaa0 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -26,12 +26,6 @@ class UserHistory implements TrackCreationInterface { use TrackCreationTrait; - /** - * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories") - * @ORM\JoinColumn(nullable=false) - */ - private ?AccompanyingPeriod $accompanyingPeriod; - /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) */ @@ -49,17 +43,18 @@ class UserHistory implements TrackCreationInterface */ private DateTimeImmutable $startDate; - /** + public function __construct(/** + * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories") + * @ORM\JoinColumn(nullable=false) + */ + private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) */ - private User $user; - - public function __construct(AccompanyingPeriod $accompanyingPeriod, User $user, ?DateTimeImmutable $startDate = null) - { + private User $user, + ?DateTimeImmutable $startDate = null + ) { $this->startDate = $startDate ?? new DateTimeImmutable('now'); - $this->accompanyingPeriod = $accompanyingPeriod; - $this->user = $user; } public function getAccompanyingPeriod(): AccompanyingPeriod diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php index 9e5174217..2f3b0798e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php @@ -28,12 +28,6 @@ use Symfony\Component\Serializer\Annotation\Groups; */ class AccompanyingPeriodParticipation { - /** - * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"}) - * @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false) - */ - private ?AccompanyingPeriod $accompanyingPeriod = null; - /** * @ORM\Column(type="date", nullable=true) * @Groups({"read", "docgen:read"}) @@ -48,24 +42,24 @@ class AccompanyingPeriodParticipation */ private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") - * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) - * @Groups({"read", "docgen:read"}) - */ - private ?Person $person = null; - /** * @ORM\Column(type="date", nullable=false) * @Groups({"read", "docgen:read"}) */ private ?DateTime $startDate = null; - public function __construct(AccompanyingPeriod $accompanyingPeriod, Person $person) - { + public function __construct(/** + * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"}) + * @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false) + */ + private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, /** + * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") + * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) + * @Groups({"read", "docgen:read"}) + */ + private ?\Chill\PersonBundle\Entity\Person $person + ) { $this->startDate = new DateTime('now'); - $this->accompanyingPeriod = $accompanyingPeriod; - $this->person = $person; $person->getAccompanyingPeriodParticipations()->add($this); } diff --git a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php index e23038715..cce546802 100644 --- a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php +++ b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php @@ -60,8 +60,6 @@ class MaritalStatus /** * Set id. - * - * @return MaritalStatus */ public function setId(string $id): self { @@ -74,8 +72,6 @@ class MaritalStatus * Set name. * * @param string array $name - * - * @return MaritalStatus */ public function setName(array $name): self { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index af8e7f92b..ac8988c26 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -74,7 +74,7 @@ use function in_array; * groups={"household_memberships"} * ) */ -class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface +class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable { public const BOTH_GENDER = 'both'; @@ -554,7 +554,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI /** * @return string */ - public function __toString() + public function __toString(): string { return $this->getLabel(); } @@ -631,7 +631,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * @return true | array True if the accompanying periods are not collapsing, * an array with data for displaying the error */ - public function checkAccompanyingPeriodsAreNotCollapsing() + public function checkAccompanyingPeriodsAreNotCollapsing(): bool|array { $periods = $this->getAccompanyingPeriodsOrdered(); $periodsNbr = count($periods); @@ -1165,19 +1165,12 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI */ public function getGenderNumeric() { - switch ($this->getGender()) { - case self::FEMALE_GENDER: - return 1; - - case self::MALE_GENDER: - return 0; - - case self::BOTH_GENDER: - return 2; - - default: - return -1; - } + return match ($this->getGender()) { + self::FEMALE_GENDER => 1, + self::MALE_GENDER => 0, + self::BOTH_GENDER => 2, + default => -1, + }; } public function getHouseholdAddresses(): Collection @@ -1360,7 +1353,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI /** * @return PersonResource[]|Collection */ - public function getResources() + public function getResources(): array|\Doctrine\Common\Collections\Collection { return $this->resources; } @@ -1606,9 +1599,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - /** - * @return Person - */ public function setCFData(?array $cFData): self { $this->cFData = $cFData; @@ -1824,16 +1814,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI $histories = $this->centerHistory->matching($criteria); - switch ($histories->count()) { - case 0: - return null; - - case 1: - return $histories->first(); - - default: - throw new UnexpectedValueException('It should not contains more than one center at a time'); - } + return match ($histories->count()) { + 0 => null, + 1 => $histories->first(), + default => throw new UnexpectedValueException('It should not contains more than one center at a time'), + }; } /** diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php index 034ab81ec..0ce396e10 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php @@ -32,11 +32,6 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac use TrackUpdateTrait; - /** - * @ORM\ManyToOne(targetEntity=Center::class) - */ - private ?Center $center = null; - /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) */ @@ -49,21 +44,20 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac */ private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory") - */ - private ?Person $person = null; - - /** - * @ORM\Column(type="date_immutable", nullable=false) - */ - private ?DateTimeImmutable $startDate = null; - - public function __construct(?Person $person = null, ?Center $center = null, ?DateTimeImmutable $startDate = null) - { - $this->person = $person; - $this->center = $center; - $this->startDate = $startDate; + public function __construct( + /** + * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory") + */ + private ?\Chill\PersonBundle\Entity\Person $person = null, + /** + * @ORM\ManyToOne(targetEntity=Center::class) + */ + private ?\Chill\MainBundle\Entity\Center $center = null, + /** + * @ORM\Column(type="date_immutable", nullable=false) + */ + private ?\DateTimeImmutable $startDate = null + ) { } public function getCenter(): ?Center diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index a4b6cf085..87e7620c9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -221,10 +221,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface /** * @Assert\Callback - * - * @param mixed $payload */ - public function validate(ExecutionContextInterface $context, $payload) + public function validate(ExecutionContextInterface $context, mixed $payload) { if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) { $context->buildViolation('You must associate at least one entity') diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index a8c68c8ce..0c7120caf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -151,7 +151,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(Collection $socialActions): Collection + public static function findAncestorSocialActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection { $ancestors = new ArrayCollection(); @@ -231,7 +231,7 @@ class SocialAction /** * @param Collection|SocialAction[] $socialActions */ - public static function getDescendantsWithThisForActions($socialActions): Collection + public static function getDescendantsWithThisForActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection { $unique = []; diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 675a1a923..a36fa48d7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -74,7 +74,6 @@ class SocialIssue /** * @internal use @see{SocialIssue::setParent} instead * - * @param SocialIssue $child * * @return $this */ @@ -109,7 +108,7 @@ class SocialIssue * * @return Collection|SocialIssue[] */ - public static function findAncestorSocialIssues(Collection $socialIssues): Collection + public static function findAncestorSocialIssues(\Doctrine\Common\Collections\Collection|array $socialIssues): Collection { $ancestors = new ArrayCollection(); diff --git a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php index f4a8f6520..1242e61ef 100644 --- a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php +++ b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php @@ -27,16 +27,12 @@ class PersonAddressMoveEvent extends Event private ?HouseholdMember $nextMembership = null; - private Person $person; - private ?Address $previousAddress = null; private ?HouseholdMember $previousMembership = null; - public function __construct( - Person $person - ) { - $this->person = $person; + public function __construct(private Person $person) + { } /** diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index 2e3a3aaef..2776faf43 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodWorkEventListener { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index 96deac574..d01190ba4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -21,16 +21,8 @@ use function in_array; class AdministrativeLocationAggregator implements AggregatorInterface { - private LocationRepository $locationRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - LocationRepository $locationRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->locationRepository = $locationRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private LocationRepository $locationRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index 342958361..b2703836e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveAggregator implements AggregatorInterface { - private ClosingMotiveRepositoryInterface $motiveRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ClosingMotiveRepositoryInterface $motiveRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->motiveRepository = $motiveRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ClosingMotiveRepositoryInterface $motiveRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index e9b9e28fa..a4279fc05 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ConfidentialAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string @@ -56,16 +52,11 @@ class ConfidentialAggregator implements AggregatorInterface return 'Confidentiality'; } - switch ($value) { - case true: - return $this->translator->trans('is confidential'); - - case false: - return $this->translator->trans('is not confidential'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + true => $this->translator->trans('is confidential'), + false => $this->translator->trans('is not confidential'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index c336a8887..87e119419 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -21,16 +21,8 @@ use function in_array; class CreatorJobAggregator implements AggregatorInterface { - private UserJobRepository $jobRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - UserJobRepository $jobRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->jobRepository = $jobRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index 0dc66e81e..ce61739f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -28,11 +28,8 @@ final class DurationAggregator implements AggregatorInterface 'day', ]; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string @@ -42,26 +39,13 @@ final class DurationAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($data['precision']) { - case 'day': - $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'); - - break; - - case 'week': - $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'); - - break; - - case 'month': - $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 + - EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'); - - break; - - default: - throw new LogicException('precision not supported: ' . $data['precision']); - } + match ($data['precision']) { + 'day' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'), + 'week' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'), + 'month' => $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 + + EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'), + default => throw new LogicException('precision not supported: ' . $data['precision']), + }; $qb ->setParameter('now', new DateTimeImmutable('now')) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index 02f9f5cd9..aeb369b5a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string @@ -56,16 +52,11 @@ class EmergencyAggregator implements AggregatorInterface return 'Emergency'; } - switch ($value) { - case true: - return $this->translator->trans('is emergency'); - - case false: - return $this->translator->trans('is not emergency'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + true => $this->translator->trans('is emergency'), + false => $this->translator->trans('is not emergency'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index b6436efc0..47656c1d0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class EvaluationAggregator implements AggregatorInterface { - private EvaluationRepository $evaluationRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - EvaluationRepository $evaluationRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->evaluationRepository = $evaluationRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index 4ac96aac1..3395247de 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -29,20 +29,8 @@ use UnexpectedValueException; final class GeographicalUnitStatAggregator implements AggregatorInterface { - private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string @@ -134,36 +122,31 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'acp_geog_agg_unitname': - return static function ($value): string { - if ('_header' === $value) { - return 'acp_geog_agg_unitname'; - } + return match ($key) { + 'acp_geog_agg_unitname' => static function ($value): string { + if ('_header' === $value) { + return 'acp_geog_agg_unitname'; + } - if (null === $value || '' === $value) { - return ''; - } + if (null === $value || '' === $value) { + return ''; + } - return $value; - }; + return $value; + }, + 'acp_geog_agg_unitrefid' => static function ($value): string { + if ('_header' === $value) { + return 'acp_geog_agg_unitrefid'; + } - case 'acp_geog_agg_unitrefid': - return static function ($value): string { - if ('_header' === $value) { - return 'acp_geog_agg_unitrefid'; - } + if (null === $value) { + return ''; + } - if (null === $value) { - return ''; - } - - return $value; - }; - - default: - throw new UnexpectedValueException('this value should not happens'); - } + return $value; + }, + default => throw new UnexpectedValueException('this value should not happens'), + }; } public function getQueryKeys($data): array diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index a3618f40f..2d9adc801 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class IntensityAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string @@ -56,16 +52,11 @@ class IntensityAggregator implements AggregatorInterface return 'Intensity'; } - switch ($value) { - case 'occasional': - return $this->translator->trans('is occasional'); - - case 'regular': - return $this->translator->trans('is regular'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + 'occasional' => $this->translator->trans('is occasional'), + 'regular' => $this->translator->trans('is regular'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index 37d0c7b20..e6cb9cac6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -25,14 +25,11 @@ final class OriginAggregator implements AggregatorInterface { private EntityRepository $repository; - private TranslatableStringHelper $translatableStringHelper; - public function __construct( EntityManagerInterface $em, - TranslatableStringHelper $translatableStringHelper + private TranslatableStringHelper $translatableStringHelper ) { $this->repository = $em->getRepository(Origin::class); - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index a09097fd2..db12bbb0c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -27,20 +27,8 @@ final class ReferrerAggregator implements AggregatorInterface private const P = 'acp_ref_agg_date'; - private RollingDateConverterInterface $rollingDateConverter; - - private UserRender $userRender; - - private UserRepository $userRepository; - - public function __construct( - UserRepository $userRepository, - UserRender $userRender, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index ccbd21da1..6e788d714 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -26,20 +26,8 @@ class ReferrerScopeAggregator implements AggregatorInterface { private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name'; - private RollingDateConverterInterface $rollingDateConverter; - - private ScopeRepositoryInterface $scopeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ScopeRepositoryInterface $scopeRepository, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 7b5cf0edd..5555671d3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -20,12 +20,8 @@ use function in_array; final class RequestorAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator - ) { - $this->translator = $translator; + public function __construct(private TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index 8f34661bb..d3f7783f3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class ScopeAggregator implements AggregatorInterface { - private ScopeRepository $scopeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ScopeRepository $scopeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index 3bdd6549e..e088be7ce 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class SocialActionAggregator implements AggregatorInterface { - private SocialActionRender $actionRender; - - private SocialActionRepository $actionRepository; - - public function __construct( - SocialActionRender $actionRender, - SocialActionRepository $actionRepository - ) { - $this->actionRender = $actionRender; - $this->actionRepository = $actionRepository; + public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 12fa5a454..4ce7dfcd0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class SocialIssueAggregator implements AggregatorInterface { - private SocialIssueRender $issueRender; - - private SocialIssueRepository $issueRepository; - - public function __construct( - SocialIssueRepository $issueRepository, - SocialIssueRender $issueRender - ) { - $this->issueRepository = $issueRepository; - $this->issueRender = $issueRender; + public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index 84dbd4e69..4fb7a38b8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -28,16 +28,8 @@ final class StepAggregator implements AggregatorInterface private const P = 'acp_step_agg_date'; - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatorInterface $translator; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter, - TranslatorInterface $translator - ) { - $this->rollingDateConverter = $rollingDateConverter; - $this->translator = $translator; + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php index a8acdcf12..97a8b228e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class UserJobAggregator implements AggregatorInterface { - private UserJobRepository $jobRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - UserJobRepository $jobRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->jobRepository = $jobRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php index 2f4275c49..c8dd3b611 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php @@ -38,25 +38,12 @@ class ByEndDateAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($data['frequency']) { - case 'week': - $fmt = 'YYYY-IW'; - - break; - - case 'month': - $fmt = 'YYYY-MM'; - - break; - - case 'year': - $fmt = 'YYYY'; - - break; - - default: - throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); - } + $fmt = match ($data['frequency']) { + 'week' => 'YYYY-IW', + 'month' => 'YYYY-MM', + 'year' => 'YYYY', + default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])), + }; $qb->addSelect(sprintf("TO_CHAR(workeval.endDate, '%s') AS eval_by_end_date_aggregator", $fmt)); $qb->addGroupBy(' eval_by_end_date_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php index 9283fd9dc..07498f026 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php @@ -38,25 +38,12 @@ class ByMaxDateAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($data['frequency']) { - case 'week': - $fmt = 'YYYY-IW'; - - break; - - case 'month': - $fmt = 'YYYY-MM'; - - break; - - case 'year': - $fmt = 'YYYY'; - - break; - - default: - throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); - } + $fmt = match ($data['frequency']) { + 'week' => 'YYYY-IW', + 'month' => 'YYYY-MM', + 'year' => 'YYYY', + default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])), + }; $qb->addSelect(sprintf("TO_CHAR(workeval.maxDate, '%s') AS eval_by_max_date_aggregator", $fmt)); $qb->addGroupBy(' eval_by_max_date_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php index cd183b25e..d5317feb6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php @@ -38,25 +38,12 @@ class ByStartDateAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($data['frequency']) { - case 'week': - $fmt = 'YYYY-IW'; - - break; - - case 'month': - $fmt = 'YYYY-MM'; - - break; - - case 'year': - $fmt = 'YYYY'; - - break; - - default: - throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); - } + $fmt = match ($data['frequency']) { + 'week' => 'YYYY-IW', + 'month' => 'YYYY-MM', + 'year' => 'YYYY', + default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])), + }; $qb->addSelect(sprintf("TO_CHAR(workeval.startDate, '%s') AS eval_by_start_date_aggregator", $fmt)); $qb->addGroupBy(' eval_by_start_date_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index 0c13611cb..2201cd747 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationTypeAggregator implements AggregatorInterface { - private EvaluationRepository $evaluationRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - EvaluationRepository $evaluationRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->evaluationRepository = $evaluationRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php index e33bb326f..9bc91f099 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php @@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HavingEndDateAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string @@ -56,16 +53,11 @@ class HavingEndDateAggregator implements AggregatorInterface return 'export.aggregator.eval.by_end_date.Has end date ?'; } - switch ($value) { - case true: - return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified'); - - case false: - return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + true => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified'), + false => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index 0c9bc623f..7b4b3c646 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -24,16 +24,8 @@ use function in_array; class ChildrenNumberAggregator implements AggregatorInterface { - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->translator = $translator; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 52bcd88e5..1d38dddd4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -25,20 +25,8 @@ use function in_array; class CompositionAggregator implements AggregatorInterface { - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelper $translatableStringHelper; - - private HouseholdCompositionTypeRepository $typeRepository; - - public function __construct( - HouseholdCompositionTypeRepository $typeRepository, - TranslatableStringHelper $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->typeRepository = $typeRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private HouseholdCompositionTypeRepository $typeRepository, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 365a73704..88cf2363a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -22,11 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php index 80f0faa17..ccb4710e0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php @@ -27,20 +27,8 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface { private const PREFIX = 'acp_by_household_compo_agg'; - private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter, - HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->householdCompositionTypeRepository = $householdCompositionTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index 3d785b586..25b01b3f7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -27,20 +27,8 @@ use function in_array; final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface { - private CountryRepository $countriesRepository; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - CountryRepository $countriesRepository, - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->countriesRepository = $countriesRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index f76420047..60ab87fed 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -21,11 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class GenderAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php index ff72994ba..e86524670 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php @@ -26,20 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitAggregator implements AggregatorInterface { - private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string @@ -111,36 +99,31 @@ class GeographicalUnitAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'geog_unit_name': - return static function ($value): string { - if ('_header' === $value) { - return 'acp_geog_agg_unitname'; - } + return match ($key) { + 'geog_unit_name' => static function ($value): string { + if ('_header' === $value) { + return 'acp_geog_agg_unitname'; + } - if (null === $value) { - return ''; - } + if (null === $value) { + return ''; + } - return $value; - }; + return $value; + }, + 'geog_unit_key' => static function ($value): string { + if ('_header' === $value) { + return 'acp_geog_agg_unitrefid'; + } - case 'geog_unit_key': - return static function ($value): string { - if ('_header' === $value) { - return 'acp_geog_agg_unitrefid'; - } + if (null === $value) { + return ''; + } - if (null === $value) { - return ''; - } - - return $value; - }; - - default: - throw new LogicException('key not supported'); - } + return $value; + }, + default => throw new LogicException('key not supported'), + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index 107634803..48a08b190 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -29,24 +29,8 @@ use function in_array; final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface { - private PositionRepository $positionRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper, - PositionRepository $positionRepository, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->translator = $translator; - $this->positionRepository = $positionRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 08bde4bda..98049357a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -21,14 +21,8 @@ use function in_array; final class MaritalStatusAggregator implements AggregatorInterface { - private MaritalStatusRepository $maritalStatusRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(MaritalStatusRepository $maritalStatusRepository, TranslatableStringHelper $translatableStringHelper) + public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) { - $this->maritalStatusRepository = $maritalStatusRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index d7c4097af..14f5a5dd5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -25,20 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface { - private CountryRepository $countriesRepository; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - CountryRepository $countriesRepository, - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->countriesRepository = $countriesRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index c1fccb968..a1b384ffa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -24,24 +24,8 @@ use function in_array; final class ActionTypeAggregator implements AggregatorInterface { - private SocialActionRender $actionRender; - - private SocialActionRepository $socialActionRepository; - - private SocialIssueRender $socialIssueRender; - - private SocialIssueRepository $socialIssueRepository; - - public function __construct( - SocialActionRepository $socialActionRepository, - SocialActionRender $actionRender, - SocialIssueRender $socialIssueRender, - SocialIssueRepository $socialIssueRepository - ) { - $this->socialActionRepository = $socialActionRepository; - $this->actionRender = $actionRender; - $this->socialIssueRender = $socialIssueRender; - $this->socialIssueRepository = $socialIssueRepository; + public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) + { } public function addRole(): ?string @@ -78,36 +62,31 @@ final class ActionTypeAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'action_type_aggregator': - return function ($value): string { - if ('_header' === $value) { - return 'Social Action Type'; - } + return match ($key) { + 'action_type_aggregator' => function ($value): string { + if ('_header' === $value) { + return 'Social Action Type'; + } - if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) { - return ''; - } + if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) { + return ''; + } - return $this->actionRender->renderString($sa, []); - }; + return $this->actionRender->renderString($sa, []); + }, + 'social_action_type_aggregator' => function ($value): string { + if ('_header' === $value) { + return 'Social Issue'; + } - case 'social_action_type_aggregator': - return function ($value): string { - if ('_header' === $value) { - return 'Social Issue'; - } + if (null === $value || null === $si = $this->socialIssueRepository->find($value)) { + return ''; + } - if (null === $value || null === $si = $this->socialIssueRepository->find($value)) { - return ''; - } - - return $this->socialIssueRender->renderString($si, []); - }; - - default: - throw new LogicException('this key is not supported: ' . $key); - } + return $this->socialIssueRender->renderString($si, []); + }, + default => throw new LogicException('this key is not supported: ' . $key), + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php index 58fcb2874..30d272c15 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php @@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CurrentActionAggregator implements AggregatorInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string @@ -59,16 +56,11 @@ class CurrentActionAggregator implements AggregatorInterface return 'export.aggregator.course_work.by_current_action.Current action ?'; } - switch ($value) { - case true: - return $this->translator->trans('export.aggregator.course_work.by_current_action.Current action'); - - case false: - return $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } + return match ($value) { + true => $this->translator->trans('export.aggregator.course_work.by_current_action.Current action'), + false => $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action'), + default => throw new LogicException(sprintf('The value %s is not valid', $value)), + }; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index 8cc6a25da..a63580cf7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -21,14 +21,8 @@ use function in_array; final class GoalAggregator implements AggregatorInterface { - private GoalRepository $goalRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(GoalRepository $goalRepository, TranslatableStringHelper $translatableStringHelper) + public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) { - $this->goalRepository = $goalRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php index 17b263d7e..7d3610c71 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php @@ -23,20 +23,8 @@ use function in_array; class GoalResultAggregator implements AggregatorInterface { - private GoalRepository $goalRepository; - - private ResultRepository $resultRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ResultRepository $resultRepository, - GoalRepository $goalRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->resultRepository = $resultRepository; - $this->goalRepository = $goalRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ResultRepository $resultRepository, private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index cbf07091f..314149829 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class JobAggregator implements AggregatorInterface { - private UserJobRepository $jobRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - UserJobRepository $jobRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->jobRepository = $jobRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index 0fe53b707..a7adf6802 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class ReferrerAggregator implements AggregatorInterface { - private UserRender $userRender; - - private UserRepository $userRepository; - - public function __construct( - UserRepository $userRepository, - UserRender $userRender - ) { - $this->userRepository = $userRepository; - $this->userRender = $userRender; + public function __construct(private UserRepository $userRepository, private UserRender $userRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 2e46673da..c621b0899 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -21,14 +21,8 @@ use function in_array; final class ResultAggregator implements AggregatorInterface { - private ResultRepository $resultRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(ResultRepository $resultRepository, TranslatableStringHelper $translatableStringHelper) + public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) { - $this->resultRepository = $resultRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 243263b83..1a085828f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -21,16 +21,8 @@ use function in_array; final class ScopeAggregator implements AggregatorInterface { - private ScopeRepository $scopeRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ScopeRepository $scopeRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php index 122ee14d9..df89fc8d4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php @@ -26,12 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface; class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface { - protected EntityManagerInterface $em; - - public function __construct( - EntityManagerInterface $em - ) { - $this->em = $em; + public function __construct(protected EntityManagerInterface $em) + { } public function buildForm(FormBuilderInterface $builder): void diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 1613b63d3..74d4bb4ff 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -25,12 +25,8 @@ use Symfony\Component\Form\FormBuilderInterface; class CountEvaluation implements ExportInterface, GroupedExportInterface { - private EntityManagerInterface $entityManager; - - public function __construct( - EntityManagerInterface $em - ) { - $this->entityManager = $em; + public function __construct(private EntityManagerInterface $entityManager) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 0b693b9d8..778f19812 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -30,16 +30,8 @@ class CountHousehold implements ExportInterface, GroupedExportInterface { private const TR_PREFIX = 'export.export.nb_household_with_course.'; - private EntityManagerInterface $entityManager; - - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - EntityManagerInterface $em, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->entityManager = $em; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter) + { } public function buildForm(FormBuilderInterface $builder) @@ -71,16 +63,11 @@ class CountHousehold implements ExportInterface, GroupedExportInterface { return static function ($value) use ($key) { if ('_header' === $value) { - switch ($key) { - case 'household_export_result': - return self::TR_PREFIX . 'Count households'; - - case 'acp_export_result': - return self::TR_PREFIX . 'Count accompanying periods'; - - default: - throw new LogicException('Key not supported: ' . $key); - } + return match ($key) { + 'household_export_result' => self::TR_PREFIX . 'Count households', + 'acp_export_result' => self::TR_PREFIX . 'Count accompanying periods', + default => throw new LogicException('Key not supported: ' . $key), + }; } if (null === $value) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 60429ae55..9901af716 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -25,12 +25,8 @@ use Symfony\Component\Form\FormBuilderInterface; class CountPerson implements ExportInterface, GroupedExportInterface { - protected PersonRepository $personRepository; - - public function __construct( - PersonRepository $personRepository - ) { - $this->personRepository = $personRepository; + public function __construct(protected PersonRepository $personRepository) + { } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 045039930..57e92f818 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -78,56 +78,8 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface 'updatedBy', ]; - private ExportAddressHelper $addressHelper; - - private DateTimeHelper $dateTimeHelper; - - private EntityManagerInterface $entityManager; - - private PersonRenderInterface $personRender; - - private PersonRepository $personRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private SocialIssueRender $socialIssueRender; - - private SocialIssueRepository $socialIssueRepository; - - private ThirdPartyRender $thirdPartyRender; - - private ThirdPartyRepository $thirdPartyRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private UserHelper $userHelper; - - public function __construct( - ExportAddressHelper $addressHelper, - DateTimeHelper $dateTimeHelper, - EntityManagerInterface $entityManager, - PersonRenderInterface $personRender, - PersonRepository $personRepository, - ThirdPartyRepository $thirdPartyRepository, - ThirdPartyRender $thirdPartyRender, - SocialIssueRepository $socialIssueRepository, - SocialIssueRender $socialIssueRender, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter, - UserHelper $userHelper - ) { - $this->addressHelper = $addressHelper; - $this->dateTimeHelper = $dateTimeHelper; - $this->entityManager = $entityManager; - $this->personRender = $personRender; - $this->personRepository = $personRepository; - $this->socialIssueRender = $socialIssueRender; - $this->socialIssueRepository = $socialIssueRepository; - $this->thirdPartyRender = $thirdPartyRender; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; - $this->userHelper = $userHelper; + public function __construct(private ExportAddressHelper $addressHelper, private DateTimeHelper $dateTimeHelper, private EntityManagerInterface $entityManager, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender, private SocialIssueRepository $socialIssueRepository, private SocialIssueRender $socialIssueRender, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, private UserHelper $userHelper) + { } public function buildForm(FormBuilderInterface $builder) @@ -157,112 +109,91 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + if (str_starts_with($key, 'address_fields')) { return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); } - switch ($key) { - case 'stepSince': - case 'openingDate': - case 'closingDate': - case 'referrerSince': - case 'createdAt': - case 'updatedAt': - return $this->dateTimeHelper->getLabel('export.list.acp.' . $key); + return match ($key) { + 'stepSince', 'openingDate', 'closingDate', 'referrerSince', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acp.' . $key), + 'origin', 'closingMotive', 'job' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - case 'origin': - case 'closingMotive': - case 'job': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } + if (null === $value) { + return ''; + } - if (null === $value) { - return ''; - } + return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + }, + 'locationPersonName', 'requestorPerson' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); - }; + if (null === $value || null === $person = $this->personRepository->find($value)) { + return ''; + } - case 'locationPersonName': - case 'requestorPerson': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } + return $this->personRender->renderString($person, []); + }, + 'requestorThirdParty' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - if (null === $value || null === $person = $this->personRepository->find($value)) { - return ''; - } + if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) { + return ''; + } - return $this->personRender->renderString($person, []); - }; + return $this->thirdPartyRender->renderString($thirdparty, []); + }, + 'scopes' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - case 'requestorThirdParty': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } + if (null === $value) { + return ''; + } - if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) { - return ''; - } + return implode( + '|', + array_map( + fn ($s) => $this->translatableStringHelper->localize($s), + json_decode($value, true, 512, JSON_THROW_ON_ERROR) + ) + ); + }, + 'socialIssues' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - return $this->thirdPartyRender->renderString($thirdparty, []); - }; + if (null === $value) { + return ''; + } - case 'scopes': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } + return implode( + '|', + array_map( + fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []), + json_decode($value, true, 512, JSON_THROW_ON_ERROR) + ) + ); + }, + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } - if (null === $value) { - return ''; - } + if (null === $value) { + return ''; + } - return implode( - '|', - array_map( - fn ($s) => $this->translatableStringHelper->localize($s), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) - ) - ); - }; - - case 'socialIssues': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return implode( - '|', - array_map( - fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) - ) - ); - }; - - default: - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return $value; - }; - } + return $value; + }, + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php index 00fa8adb1..0625d1552 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php @@ -76,56 +76,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac 'updatedBy', ]; - private AggregateStringHelper $aggregateStringHelper; - - private DateTimeHelper $dateTimeHelper; - - private EntityManagerInterface $entityManager; - - private LabelPersonHelper $personHelper; - - private RollingDateConverterInterface $rollingDateConverter; - - private SocialActionRender $socialActionRender; - - private SocialActionRepository $socialActionRepository; - - private SocialIssueRender $socialIssueRender; - - private SocialIssueRepository $socialIssueRepository; - - private LabelThirdPartyHelper $thirdPartyHelper; - - private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper; - - private UserHelper $userHelper; - - public function __construct( - EntityManagerInterface $entityManager, - DateTimeHelper $dateTimeHelper, - UserHelper $userHelper, - LabelPersonHelper $personHelper, - LabelThirdPartyHelper $thirdPartyHelper, - TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, - SocialIssueRender $socialIssueRender, - SocialIssueRepository $socialIssueRepository, - SocialActionRender $socialActionRender, - RollingDateConverterInterface $rollingDateConverter, - AggregateStringHelper $aggregateStringHelper, - SocialActionRepository $socialActionRepository - ) { - $this->entityManager = $entityManager; - $this->dateTimeHelper = $dateTimeHelper; - $this->userHelper = $userHelper; - $this->personHelper = $personHelper; - $this->thirdPartyHelper = $thirdPartyHelper; - $this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper; - $this->socialIssueRender = $socialIssueRender; - $this->socialIssueRepository = $socialIssueRepository; - $this->socialActionRender = $socialActionRender; - $this->rollingDateConverter = $rollingDateConverter; - $this->aggregateStringHelper = $aggregateStringHelper; - $this->socialActionRepository = $socialActionRepository; + public function __construct(private EntityManagerInterface $entityManager, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private LabelThirdPartyHelper $thirdPartyHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private RollingDateConverterInterface $rollingDateConverter, private AggregateStringHelper $aggregateStringHelper, private SocialActionRepository $socialActionRepository) + { } public function buildForm(FormBuilderInterface $builder) @@ -156,89 +108,55 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function getLabels($key, array $values, $data) { - switch ($key) { - case 'startDate': - case 'endDate': - case 'createdAt': - case 'updatedAt': - return $this->dateTimeHelper->getLabel('export.list.acpw.' . $key); + return match ($key) { + 'startDate', 'endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acpw.' . $key), + 'socialAction' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.' . $key; + } - case 'socialAction': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acpw.' . $key; - } + if (null === $value) { + return ''; + } - if (null === $value) { - return ''; - } + return $this->socialActionRender->renderString( + $this->socialActionRepository->find($value), + [] + ); + }, + 'socialIssue' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.' . $key; + } - return $this->socialActionRender->renderString( - $this->socialActionRepository->find($value), - [] - ); - }; + if (null === $value) { + return ''; + } - case 'socialIssue': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acpw.' . $key; - } + return $this->socialIssueRender->renderString( + $this->socialIssueRepository->find($value), + [] + ); + }, + 'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key), + 'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key), + 'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.' . $key), + 'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'personsId', 'goalsId', 'goalResultsId', 'resultsId', 'evaluationsId' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'goalsTitle', 'goalResultsTitle', 'resultsTitle', 'evaluationsTitle' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.' . $key; + } - if (null === $value) { - return ''; - } + if (null === $value) { + return ''; + } - return $this->socialIssueRender->renderString( - $this->socialIssueRepository->find($value), - [] - ); - }; - - case 'createdBy': - case 'updatedBy': - case 'acp_user': - return $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key); - - case 'referrers': - //$date = $this->rollDateConverter->convert($data['calc_date'])->format('d/m/Y'); - return $this->userHelper->getLabel($key, $values, 'export.list.acpw.' . $key); - - case 'personsName': - return $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key); - - case 'handlingThierParty': - return $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.' . $key); - - case 'thirdParties': - return $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key); - - case 'personsId': - case 'goalsId': - case 'goalResultsId': - case 'resultsId': - case 'evaluationsId': - return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key); - - case 'goalsTitle': - case 'goalResultsTitle': - case 'resultsTitle': - case 'evaluationsTitle': - return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key); - - default: - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acpw.' . $key; - } - - if (null === $value) { - return ''; - } - - return $value; - }; - } + return $value; + }, + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index f0985436b..ebe3911a9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -68,52 +68,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface 'updatedBy', ]; - private AggregateStringHelper $aggregateStringHelper; - - private DateTimeHelper $dateTimeHelper; - - private EntityManagerInterface $entityManager; - - private LabelPersonHelper $personHelper; - - private RollingDateConverterInterface $rollingDateConverter; - - private SocialActionRender $socialActionRender; - - private SocialActionRepository $socialActionRepository; - - private SocialIssueRender $socialIssueRender; - - private SocialIssueRepository $socialIssueRepository; - - private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper; - - private UserHelper $userHelper; - - public function __construct( - EntityManagerInterface $entityManager, - SocialIssueRender $socialIssueRender, - SocialIssueRepository $socialIssueRepository, - SocialActionRender $socialActionRender, - SocialActionRepository $socialActionRepository, - UserHelper $userHelper, - LabelPersonHelper $personHelper, - DateTimeHelper $dateTimeHelper, - TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, - AggregateStringHelper $aggregateStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->entityManager = $entityManager; - $this->socialIssueRender = $socialIssueRender; - $this->socialIssueRepository = $socialIssueRepository; - $this->socialActionRender = $socialActionRender; - $this->socialActionRepository = $socialActionRepository; - $this->userHelper = $userHelper; - $this->personHelper = $personHelper; - $this->dateTimeHelper = $dateTimeHelper; - $this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper; - $this->aggregateStringHelper = $aggregateStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private EntityManagerInterface $entityManager, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private SocialActionRepository $socialActionRepository, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private DateTimeHelper $dateTimeHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private AggregateStringHelper $aggregateStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function buildForm(FormBuilderInterface $builder) @@ -144,79 +100,54 @@ class ListEvaluation implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - switch ($key) { - case 'startDate': - case 'endDate': - case 'maxDate': - case 'acpw_startDate': - case 'acpw_endDate': - case 'createdAt': - case 'updatedAt': - return $this->dateTimeHelper->getLabel('export.list.eval.' . $key); + return match ($key) { + 'startDate', 'endDate', 'maxDate', 'acpw_startDate', 'acpw_endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.eval.' . $key), + 'acpw_socialaction' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.eval.' . $key; + } - case 'acpw_socialaction': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.eval.' . $key; - } + if (null === $value || '' === $value) { + return ''; + } - if (null === $value || '' === $value) { - return ''; - } + return $this->socialActionRender->renderString( + $this->socialActionRepository->find($value), + [] + ); + }, + 'acpw_socialissue' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.eval.' . $key; + } - return $this->socialActionRender->renderString( - $this->socialActionRepository->find($value), - [] - ); - }; + if (null === $value || '' === $value) { + return ''; + } - case 'acpw_socialissue': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.eval.' . $key; - } + return $this->socialIssueRender->renderString( + $this->socialIssueRepository->find($value), + [] + ); + }, + 'createdBy', 'updatedBy', 'acpw_acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key), + 'acpw_referrers' => $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key), + 'acpw_persons_id' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key), + 'acpw_persons' => $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key), + 'eval_title' => $this->translatableStringExportLabelHelper + ->getLabel($key, $values, 'export.list.eval.' . $key), + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.eval.' . $key; + } - if (null === $value || '' === $value) { - return ''; - } + if (null === $value) { + return ''; + } - return $this->socialIssueRender->renderString( - $this->socialIssueRepository->find($value), - [] - ); - }; - - case 'createdBy': - case 'updatedBy': - case 'acpw_acp_user': - return $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key); - - case 'acpw_referrers': - return $this->userHelper->getLabel($key, $values, 'export.list.eval.' . $key); - - case 'acpw_persons_id': - return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key); - - case 'acpw_persons': - return $this->personHelper->getLabelMulti($key, $values, 'export.list.eval.' . $key); - - case 'eval_title': - return $this->translatableStringExportLabelHelper - ->getLabel($key, $values, 'export.list.eval.' . $key); - - default: - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.eval.' . $key; - } - - if (null === $value) { - return ''; - } - - return $value; - }; - } + return $value; + }, + }; } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php index 24d929c00..06d79d6fc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php @@ -45,28 +45,8 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface 'compositionType', ]; - private ExportAddressHelper $addressHelper; - - private AggregateStringHelper $aggregateStringHelper; - - private EntityManagerInterface $entityManager; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringExportLabelHelper $translatableStringHelper; - - public function __construct( - ExportAddressHelper $addressHelper, - AggregateStringHelper $aggregateStringHelper, - EntityManagerInterface $entityManager, - RollingDateConverterInterface $rollingDateConverter, - TranslatableStringExportLabelHelper $translatableStringHelper - ) { - $this->addressHelper = $addressHelper; - $this->aggregateStringHelper = $aggregateStringHelper; - $this->entityManager = $entityManager; - $this->rollingDateConverter = $rollingDateConverter; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ExportAddressHelper $addressHelper, private AggregateStringHelper $aggregateStringHelper, private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringExportLabelHelper $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder) @@ -97,28 +77,21 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + if (str_starts_with($key, 'address_fields')) { return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); } - switch ($key) { - case 'membersId': - case 'membersName': - return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key); + return match ($key) { + 'membersId', 'membersName' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key), + 'compositionType' => $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key), + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.household.' . $key; + } - case 'compositionType': - //dump($values); - return $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key); - - default: - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.household.' . $key; - } - - return (string) $value; - }; - } + return (string) $value; + }, + }; } public function getQueryKeys($data): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index 8145fd658..02c0722d4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -48,30 +48,10 @@ use function uniqid; */ class ListPerson implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface { - private ExportAddressHelper $addressHelper; - - private CustomFieldProvider $customFieldProvider; - - private EntityManagerInterface $entityManager; - - private ListPersonHelper $listPersonHelper; - private $slugs = []; - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ExportAddressHelper $addressHelper, - CustomFieldProvider $customFieldProvider, - ListPersonHelper $listPersonHelper, - EntityManagerInterface $em, - TranslatableStringHelper $translatableStringHelper - ) { - $this->addressHelper = $addressHelper; - $this->customFieldProvider = $customFieldProvider; - $this->listPersonHelper = $listPersonHelper; - $this->entityManager = $em; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ExportAddressHelper $addressHelper, private CustomFieldProvider $customFieldProvider, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager, private TranslatableStringHelper $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder) @@ -92,7 +72,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou 'label' => 'Fields to include in export', 'choice_attr' => static function (string $val): array { // add a 'data-display-target' for address fields - if (substr($val, 0, 7) === 'address' || 'center' === $val || 'household' === $val) { + if (str_starts_with($val, 'address') || 'center' === $val || 'household' === $val) { return ['data-display-target' => 'address_date']; } @@ -152,7 +132,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou continue; } - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + if (str_starts_with($key, 'address_fields')) { $fields = array_merge($fields, $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields')); continue; @@ -264,7 +244,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou // get the field starting with address_ $addressFields = array_filter( ListPersonHelper::FIELDS, - static fn (string $el): bool => substr($el, 0, 8) === 'address_' + static fn (string $el): bool => str_starts_with($el, 'address_') ); // check if there is one field starting with address in data @@ -285,11 +265,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou } /** - * @param mixed $slug - * * @return array An array with keys = 'slug', 'type', 'additionnalInfo' */ - private function extractInfosFromSlug($slug): array + private function extractInfosFromSlug(mixed $slug): array { return $this->slugs[$slug]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index e40ffccce..4181098b2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -47,25 +47,13 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat */ protected $entityManager; - /** - * @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface - */ - private $router; - - /** - * @var \Symfony\Component\Translation\TranslatorInterface - */ - private $translator; - public function __construct( EntityManagerInterface $em, - TranslatorInterface $translator, - UrlGeneratorInterface $router, + private TranslatorInterface $translator, + private UrlGeneratorInterface $router, $routeParameters ) { $this->entityManager = $em; - $this->translator = $translator; - $this->router = $router; $this->baseUrl = $routeParameters['scheme'] . '://' . $routeParameters['host']; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php index 7cb066e87..9676a9437 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php @@ -37,20 +37,8 @@ use function strlen; class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface { - private ExportAddressHelper $addressHelper; - - private EntityManagerInterface $entityManager; - - private ListPersonHelper $listPersonHelper; - - public function __construct( - ExportAddressHelper $addressHelper, - ListPersonHelper $listPersonHelper, - EntityManagerInterface $em - ) { - $this->addressHelper = $addressHelper; - $this->listPersonHelper = $listPersonHelper; - $this->entityManager = $em; + public function __construct(private ExportAddressHelper $addressHelper, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager) + { } public function buildForm(FormBuilderInterface $builder) @@ -65,7 +53,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac 'label' => 'Fields to include in export', 'choice_attr' => static function (string $val): array { // add a 'data-display-target' for address fields - if (substr($val, 0, 7) === 'address' || 'center' === $val || 'household' === $val) { + if (str_starts_with($val, 'address') || 'center' === $val || 'household' === $val) { return ['data-display-target' => 'address_date']; } @@ -121,7 +109,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac continue; } - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + if (str_starts_with($key, 'address_fields')) { $fields = array_merge($fields, $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields')); continue; @@ -201,7 +189,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac // get the field starting with address_ $addressFields = array_filter( ListPersonHelper::FIELDS, - static fn (string $el): bool => substr($el, 0, 8) === 'address_' + static fn (string $el): bool => str_starts_with($el, 'address_') ); // check if there is one field starting with address in data diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 31ca41cbb..1d0161b24 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -64,22 +64,13 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn { return static function ($value) use ($key) { if ('_header' === $value) { - switch ($key) { - case 'avg_export_result': - return 'export.export.acp_stats.avg_duration'; - - case 'count_acppart_export_result': - return 'export.export.acp_stats.count_participations'; - - case 'count_acp_export_result': - return 'export.export.acp_stats.count_acps'; - - case 'count_pers_export_result': - return 'export.export.acp_stats.count_persons'; - - default: - throw new LogicException('key not supported: ' . $key); - } + return match ($key) { + 'avg_export_result' => 'export.export.acp_stats.avg_duration', + 'count_acppart_export_result' => 'export.export.acp_stats.count_participations', + 'count_acp_export_result' => 'export.export.acp_stats.count_acps', + 'count_pers_export_result' => 'export.export.acp_stats.count_persons', + default => throw new LogicException('key not supported: ' . $key), + }; } if (null === $value) { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 3fa8d711f..3f5a25053 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOnDateFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index f713e8a97..ff1ac7653 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOneDayBetweenDatesFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index c74e309b2..d4e74d165 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -20,12 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index e57370f30..a8fb0b48e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 8fcd874fe..1803e8067 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -28,11 +28,8 @@ class ConfidentialFilter implements FilterInterface private const DEFAULT_CHOICE = false; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index f585cfafb..79412bb61 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -23,16 +23,8 @@ use function in_array; class CreatorJobFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - private UserJobRepositoryInterface $userJobRepository; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - UserJobRepositoryInterface $userJobRepository - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->userJobRepository = $userJobRepository; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index afdb717f0..b680299a1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = false; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index ab7f4257e..e4e895555 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -23,16 +23,8 @@ use function in_array; class EvaluationFilter implements FilterInterface { - private EvaluationRepositoryInterface $evaluationRepository; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - EvaluationRepositoryInterface $evaluationRepository, - TranslatableStringHelper $translatableStringHelper - ) { - $this->evaluationRepository = $evaluationRepository; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private EvaluationRepositoryInterface $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index d35565c80..31a449a35 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -32,24 +32,8 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository; - - private GeographicalUnitRepositoryInterface $geographicalUnitRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - GeographicalUnitRepositoryInterface $geographicalUnitRepository, - GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->geographicalUnitRepository = $geographicalUnitRepository; - $this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php index 4c682a56a..43503a6b9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php @@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class HasNoReferrerFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 615ace4c6..9ef7f012f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class HasTemporaryLocationFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string @@ -47,20 +43,11 @@ class HasTemporaryLocationFilter implements FilterInterface $this->rollingDateConverter->convert($data['calc_date']) ); - switch ($data['having_temporarily']) { - case true: - $qb->andWhere('acp_having_temporarily_location.addressLocation IS NOT NULL'); - - break; - - case false: - $qb->andWhere('acp_having_temporarily_location.personLocation IS NOT NULL'); - - break; - - default: - throw new LogicException('value not supported'); - } + match ($data['having_temporarily']) { + true => $qb->andWhere('acp_having_temporarily_location.addressLocation IS NOT NULL'), + false => $qb->andWhere('acp_having_temporarily_location.personLocation IS NOT NULL'), + default => throw new LogicException('value not supported'), + }; } public function applyOn(): string @@ -77,17 +64,10 @@ class HasTemporaryLocationFilter implements FilterInterface 'export.filter.course.having_temporarily.Having a temporarily location' => true, 'export.filter.course.having_temporarily.Having a person\'s location' => false, ], - 'choice_label' => static function ($choice) { - switch ($choice) { - case true: - return 'export.filter.course.having_temporarily.Having a temporarily location'; - - case false: - return 'export.filter.course.having_temporarily.Having a person\'s location'; - - default: - throw new LogicException('this choice is not supported'); - } + 'choice_label' => static fn ($choice) => match ($choice) { + true => 'export.filter.course.having_temporarily.Having a temporarily location', + false => 'export.filter.course.having_temporarily.Having a person\'s location', + default => throw new LogicException('this choice is not supported'), }, ]) ->add('calc_date', PickRollingDateType::class, [ @@ -98,16 +78,11 @@ class HasTemporaryLocationFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { - switch ($data['having_temporarily']) { - case true: - return ['export.filter.course.having_temporarily.Having a temporarily location', []]; - - case false: - return ['export.filter.course.having_temporarily.Having a person\'s location', []]; - - default: - throw new LogicException('value not supported'); - } + return match ($data['having_temporarily']) { + true => ['export.filter.course.having_temporarily.Having a temporarily location', []], + false => ['export.filter.course.having_temporarily.Having a person\'s location', []], + default => throw new LogicException('value not supported'), + }; } public function getTitle(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index b0c2205a0..1f215bce9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -28,11 +28,8 @@ class IntensityFilter implements FilterInterface private const DEFAULT_CHOICE = 'occasional'; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 07ca1de75..23823467f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class OpenBetweenDatesFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index 00febc640..f3b927f68 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class OriginFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 2a3e5d17e..ee79ca8f8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -29,12 +29,8 @@ class ReferrerFilter implements FilterInterface private const PU = 'acp_referrer_filter_users'; - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 3295a5b57..60fc9e5ec 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -33,16 +33,8 @@ final class RequestorFilter implements FilterInterface 'no requestor' => 'no_requestor', ]; - private EntityManagerInterface $em; - - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator, - EntityManagerInterface $em - ) { - $this->translator = $translator; - $this->em = $em; + public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index bc1f368da..fd4d4ac64 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -23,16 +23,8 @@ use function in_array; class SocialActionFilter implements FilterInterface { - private SocialActionRender $actionRender; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - SocialActionRender $actionRender - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->actionRender = $actionRender; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private SocialActionRender $actionRender) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index 917e129bf..ee9ebfc79 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -28,14 +28,11 @@ class SocialIssueFilter implements FilterInterface */ protected $translator; - private SocialIssueRender $socialIssueRender; - public function __construct( TranslatorInterface $translator, - SocialIssueRender $socialIssueRender + private SocialIssueRender $socialIssueRender ) { $this->translator = $translator; - $this->socialIssueRender = $socialIssueRender; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php index 240b093b5..e217cdab0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php @@ -37,19 +37,8 @@ class StepFilter implements FilterInterface 'Closed' => AccompanyingPeriod::STEP_CLOSED, ]; - private RollingDateConverterInterface $rollingDateConverter; - - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter, - TranslatorInterface $translator - ) { - $this->rollingDateConverter = $rollingDateConverter; - $this->translator = $translator; + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index 05d84d7b2..7e8a3ecc3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -34,20 +34,8 @@ class UserJobFilter implements FilterInterface private const PJ = 'acp_ujob_filter_job'; - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelper $translatableStringHelper; - - private UserJobRepositoryInterface $userJobRepository; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - UserJobRepositoryInterface $userJobRepository, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->userJobRepository = $userJobRepository; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php index bbffa4bca..58a935a0e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php @@ -35,24 +35,8 @@ class UserScopeFilter implements FilterInterface private const PS = 'acp_uscope_filter_scopes'; - private RollingDateConverterInterface $rollingDateConverter; - - private ScopeRepositoryInterface $scopeRepository; - - private Security $security; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - ScopeRepositoryInterface $scopeRepository, - Security $security, - TranslatableStringHelper $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->scopeRepository = $scopeRepository; - $this->security = $security; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private ScopeRepositoryInterface $scopeRepository, private Security $security, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php index de86604e6..553e58a39 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php @@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByEndDateFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php index 27518599c..7485020ce 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php @@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByStartDateFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index 6a0c71d55..1062b8a12 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; final class EvaluationTypeFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 4a65452a1..1ca3f3f99 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -25,11 +25,8 @@ class MaxDateFilter implements FilterInterface 'maxdate is not specified' => false, ]; - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private TranslatorInterface $translator) { - $this->translator = $translator; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 22761c158..dcf98f307 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -26,16 +26,8 @@ use function in_array; class CompositionFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php index 7580a37a3..b4001b3c4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php @@ -24,13 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index c05f97ca8..da3c4a7f2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -26,11 +26,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index 7ae22ddd8..46946e41e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -24,11 +24,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct(RollingDateConverterInterface $rollingDateConverter) + public function __construct(private RollingDateConverterInterface $rollingDateConverter) { - $this->rollingDateConverter = $rollingDateConverter; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php index 9b59549f1..63ee441af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php @@ -28,20 +28,8 @@ use Symfony\Component\Form\FormBuilderInterface; class ByHouseholdCompositionFilter implements FilterInterface { - private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, - RollingDateConverterInterface $rollingDateConverter, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->householdCompositionTypeRepository = $householdCompositionTypeRepository; - $this->rollingDateConverter = $rollingDateConverter; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index 384d6698a..7daf1c9e1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface; class DeadOrAliveFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php index 0ac4b3173..04675054f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php @@ -24,12 +24,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php index 79f5cb2d4..509bb3ab0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php @@ -26,24 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface { - private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository; - - private GeographicalUnitRepositoryInterface $geographicalUnitRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - GeographicalUnitRepositoryInterface $geographicalUnitRepository, - GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, - TranslatableStringHelperInterface $translatableStringHelper, - RollingDateConverterInterface $rollingDateConverter - ) { - $this->geographicalUnitRepository = $geographicalUnitRepository; - $this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index 47a75871c..279b693f6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -19,12 +19,8 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; class MaritalStatusFilter implements FilterInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index b1d77d60e..4463f433f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -26,14 +26,8 @@ class NationalityFilter implements ExportElementValidatedInterface, FilterInterface { - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct(TranslatableStringHelper $helper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $helper; } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index 21bb40947..4afc3fd71 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -27,16 +27,8 @@ use function in_array; class ResidentialAddressAtThirdpartyFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter, - TranslatableStringHelper $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index bd55c5b80..e6b55904e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -24,12 +24,8 @@ use function in_array; class ResidentialAddressAtUserFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php index c4644fc11..702b8a7b0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php @@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface; class WithoutHouseholdComposition implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 144bf3260..36b671d54 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -24,16 +24,8 @@ use function in_array; class JobFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper - ) { - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 315025722..f393354b1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -24,16 +24,8 @@ use function in_array; class ScopeFilter implements FilterInterface { - protected TranslatorInterface $translator; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper - ) { - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 11fd0ed9d..83fea8223 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -28,20 +28,8 @@ use function in_array; class SocialWorkTypeFilter implements FilterInterface { - private EntityManagerInterface $em; - - private SocialActionRender $socialActionRender; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct( - SocialActionRender $socialActionRender, - TranslatableStringHelper $translatableStringHelper, - EntityManagerInterface $em - ) { - $this->socialActionRender = $socialActionRender; - $this->translatableStringHelper = $translatableStringHelper; - $this->em = $em; + public function __construct(private SocialActionRender $socialActionRender, private TranslatableStringHelper $translatableStringHelper, private EntityManagerInterface $em) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php index fc196dd50..5afde9986 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php @@ -18,14 +18,8 @@ use const SORT_NUMERIC; class LabelPersonHelper { - private PersonRenderInterface $personRender; - - private PersonRepository $personRepository; - - public function __construct(PersonRepository $personRepository, PersonRenderInterface $personRender) + public function __construct(private PersonRepository $personRepository, private PersonRenderInterface $personRender) { - $this->personRepository = $personRepository; - $this->personRender = $personRender; } public function getLabelMulti(string $key, array $values, string $header): callable diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 77a1d9c86..600aaa60b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -73,44 +73,8 @@ class ListPersonHelper 'lifecycleUpdate', ]; - private ExportAddressHelper $addressHelper; - - private CenterRepositoryInterface $centerRepository; - - private CivilityRepositoryInterface $civilityRepository; - - private CountryRepository $countryRepository; - - private LanguageRepositoryInterface $languageRepository; - - private MaritalStatusRepositoryInterface $maritalStatusRepository; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - private UserRepositoryInterface $userRepository; - - public function __construct( - ExportAddressHelper $addressHelper, - CenterRepositoryInterface $centerRepository, - CivilityRepositoryInterface $civilityRepository, - CountryRepository $countryRepository, - LanguageRepositoryInterface $languageRepository, - MaritalStatusRepositoryInterface $maritalStatusRepository, - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator, - UserRepositoryInterface $userRepository - ) { - $this->addressHelper = $addressHelper; - $this->centerRepository = $centerRepository; - $this->civilityRepository = $civilityRepository; - $this->countryRepository = $countryRepository; - $this->languageRepository = $languageRepository; - $this->maritalStatusRepository = $maritalStatusRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; - $this->userRepository = $userRepository; + public function __construct(private ExportAddressHelper $addressHelper, private CenterRepositoryInterface $centerRepository, private CivilityRepositoryInterface $civilityRepository, private CountryRepository $countryRepository, private LanguageRepositoryInterface $languageRepository, private MaritalStatusRepositoryInterface $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) + { } /** @@ -237,7 +201,7 @@ class ListPersonHelper public function getLabels($key, array $values, $data): callable { - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + if (str_starts_with($key, 'address_fields')) { return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); } diff --git a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php index 03db7c156..05e720243 100644 --- a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php +++ b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php @@ -30,19 +30,15 @@ class PersonChoiceLoader implements ChoiceLoaderInterface protected array $lazyLoadedPersons = []; - protected PersonRepository $personRepository; - /** * PersonChoiceLoader constructor. * * @param EntityRepository $personRepository */ public function __construct( - PersonRepository $personRepository, + protected PersonRepository $personRepository, ?array $centers = null ) { - $this->personRepository = $personRepository; - if (null !== $centers) { $this->centers = $centers; } diff --git a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php index 5548d6c5e..8f1f0ba43 100644 --- a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php @@ -42,17 +42,11 @@ final class CreationPersonType extends AbstractType private bool $askCenters; - private ConfigPersonAltNamesHelper $configPersonAltNamesHelper; - - private EventDispatcherInterface $dispatcher; - public function __construct( - ConfigPersonAltNamesHelper $configPersonAltNamesHelper, - EventDispatcherInterface $dispatcher, + private ConfigPersonAltNamesHelper $configPersonAltNamesHelper, + private EventDispatcherInterface $dispatcher, ParameterBagInterface $parameterBag ) { - $this->configPersonAltNamesHelper = $configPersonAltNamesHelper; - $this->dispatcher = $dispatcher; $this->askCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php index a63b008c6..4dc2e1a73 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php @@ -22,14 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface; class HouseholdCompositionType extends AbstractType { - private HouseholdCompositionTypeRepository $householdCompositionTypeRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(HouseholdCompositionTypeRepository $householdCompositionTypeRepository, TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) { - $this->householdCompositionTypeRepository = $householdCompositionTypeRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 8427dec13..3790cb03a 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -29,20 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - private PersonRenderInterface $personRender; - - private ResourceKindRender $resourceKindRender; - - private ThirdPartyRender $thirdPartyRender; - - private TranslatorInterface $translator; - - public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator) + public function __construct(private ResourceKindRender $resourceKindRender, private PersonRenderInterface $personRender, private ThirdPartyRender $thirdPartyRender, private TranslatorInterface $translator) { - $this->resourceKindRender = $resourceKindRender; - $this->personRender = $personRender; - $this->thirdPartyRender = $thirdPartyRender; - $this->translator = $translator; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 927812929..db5635f97 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -57,23 +57,17 @@ class PersonType extends AbstractType */ protected $configAltNamesHelper; - protected TranslatableStringHelper $translatableStringHelper; - - private ParameterBagInterface $parameterBag; - /** * @param string[] $personFieldsConfiguration configuration of visibility of some fields */ public function __construct( array $personFieldsConfiguration, ConfigPersonAltNamesHelper $configAltNamesHelper, - TranslatableStringHelperInterface $translatableStringHelper, - ParameterBagInterface $parameterBag + protected TranslatableStringHelperInterface $translatableStringHelper, + private ParameterBagInterface $parameterBag ) { $this->config = $personFieldsConfiguration; $this->configAltNamesHelper = $configAltNamesHelper; - $this->translatableStringHelper = $translatableStringHelper; - $this->parameterBag = $parameterBag; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php index 0435b5573..cce3ca46d 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -23,12 +23,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class SocialIssueType extends AbstractType { - protected TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php b/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php index 240bcfbb4..49e23f7c6 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php @@ -78,10 +78,7 @@ class ClosingMotivePickerType extends AbstractType return 'closing_motive'; } - /** - * @return string|null - */ - public function getParent() + public function getParent(): ?string { return EntityType::class; } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php index e2f144b2a..0c7efe647 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php @@ -21,22 +21,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonAltNameType extends AbstractType { - /** - * @var ConfigPersonAltNamesHelper - */ - private $configHelper; - - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct( - ConfigPersonAltNamesHelper $configHelper, - TranslatableStringHelper $translatableStringHelper - ) { - $this->configHelper = $configHelper; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ConfigPersonAltNamesHelper $configHelper, private TranslatableStringHelper $translatableStringHelper) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index 1c31d2b64..db51d507a 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -24,14 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonPhoneType extends AbstractType { - private EntityManagerInterface $em; - - private PhonenumberHelper $phonenumberHelper; - - public function __construct(PhonenumberHelper $phonenumberHelper, EntityManagerInterface $em) + public function __construct(private PhonenumberHelper $phonenumberHelper, private EntityManagerInterface $em) { - $this->phonenumberHelper = $phonenumberHelper; - $this->em = $em; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php index 8ed0b7f37..4c3139c8e 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php @@ -26,20 +26,8 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickPersonDynamicType extends AbstractType { - private DenormalizerInterface $denormalizer; - - private NormalizerInterface $normalizer; - - private SerializerInterface $serializer; - - public function __construct( - DenormalizerInterface $denormalizer, - SerializerInterface $serializer, - NormalizerInterface $normalizer - ) { - $this->denormalizer = $denormalizer; - $this->serializer = $serializer; - $this->normalizer = $normalizer; + public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php index fd947e9cd..b2e3c6d9b 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php @@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialActionType extends AbstractType { - private SocialActionRender $actionRender; - - private SocialActionRepository $actionRepository; - - public function __construct( - SocialActionRender $actionRender, - SocialActionRepository $actionRepository - ) { - $this->actionRender = $actionRender; - $this->actionRepository = $actionRepository; + public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php index b560337ac..31cd44ab1 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php @@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialIssueType extends AbstractType { - private SocialIssueRender $issueRender; - - private SocialIssueRepository $issueRepository; - - public function __construct( - SocialIssueRender $issueRender, - SocialIssueRepository $issueRepository - ) { - $this->issueRender = $issueRender; - $this->issueRepository = $issueRepository; + public function __construct(private SocialIssueRender $issueRender, private SocialIssueRepository $issueRepository) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php index f057bc1d1..a4e6c46c9 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php @@ -28,14 +28,8 @@ use const SORT_STRING; */ class Select2MaritalStatusType extends AbstractType { - private EntityManagerInterface $em; - - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper, EntityManagerInterface $em) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EntityManagerInterface $em) { - $this->translatableStringHelper = $translatableStringHelper; - $this->em = $em; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index 2b2564091..92f1bba5c 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -34,25 +34,16 @@ class MembersEditor public const VALIDATION_GROUP_CREATED = 'household_memberships_created'; - private EventDispatcherInterface $eventDispatcher; - private array $events = []; - private ?Household $household = null; - private array $membershipsAffected = []; private array $oldMembershipsHashes = []; private array $persistables = []; - private ValidatorInterface $validator; - - public function __construct(ValidatorInterface $validator, ?Household $household, EventDispatcherInterface $eventDispatcher) + public function __construct(private ValidatorInterface $validator, private ?\Chill\PersonBundle\Entity\Household\Household $household, private EventDispatcherInterface $eventDispatcher) { - $this->validator = $validator; - $this->household = $household; - $this->eventDispatcher = $eventDispatcher; } public function addMovement(DateTimeImmutable $date, Person $person, ?Position $position, ?bool $holder = false, ?string $comment = null): self diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php index 07a917d6b..9fae0dc82 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php @@ -17,16 +17,8 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class MembersEditorFactory { - private EventDispatcherInterface $eventDispatcher; - - private ValidatorInterface $validator; - - public function __construct( - EventDispatcherInterface $eventDispatcher, - ValidatorInterface $validator - ) { - $this->validator = $validator; - $this->eventDispatcher = $eventDispatcher; + public function __construct(private EventDispatcherInterface $eventDispatcher, private ValidatorInterface $validator) + { } public function createEditor(?Household $household = null): MembersEditor diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php index c956f78b6..79cd19db9 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -25,20 +25,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - protected Registry $registry; - - protected Security $security; - /** * @var TranslatorInterface */ protected $translator; - public function __construct(TranslatorInterface $translator, Registry $registry, Security $security) + public function __construct(TranslatorInterface $translator, protected Registry $registry, protected Security $security) { $this->translator = $translator; - $this->registry = $registry; - $this->security = $security; } public function buildMenu($menuId, MenuItem $menu, array $parameters): void diff --git a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php index 39ac557fb..dde404de0 100644 --- a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php @@ -38,27 +38,17 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface */ protected $showAccompanyingPeriod; - protected TranslatorInterface $translator; - - private ResidentialAddressRepository $residentialAddressRepo; - - private Security $security; - public function __construct( ParameterBagInterface $parameterBag, - Security $security, - TranslatorInterface $translator, - ResidentialAddressRepository $residentialAddressRepo + private Security $security, + protected TranslatorInterface $translator, + private ResidentialAddressRepository $residentialAddressRepo ) { $this->showAccompanyingPeriod = $parameterBag->get('chill_person.accompanying_period'); - $this->security = $security; - $this->translator = $translator; - $this->residentialAddressRepo = $residentialAddressRepo; } /** * @param $menuId - * @param MenuItem $menu * @param array{person: Person} $parameters * @return void */ diff --git a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php index 396d67912..acbdd6d3c 100644 --- a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php @@ -25,20 +25,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SectionMenuBuilder implements LocalMenuBuilderInterface { - protected ParameterBagInterface $parameterBag; - - protected TranslatorInterface $translator; - - private Security $security; - /** * SectionMenuBuilder constructor. */ - public function __construct(ParameterBagInterface $parameterBag, Security $security, TranslatorInterface $translator) + public function __construct(protected ParameterBagInterface $parameterBag, private Security $security, protected TranslatorInterface $translator) { - $this->parameterBag = $parameterBag; - $this->security = $security; - $this->translator = $translator; } /** diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php index 486209453..85e18633d 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php @@ -18,11 +18,8 @@ use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; final class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository) + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) { - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; } public function getTemplate(Notification $notification, array $options = []): string diff --git a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php index eb22a671d..957461b55 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php @@ -38,14 +38,8 @@ class AccompanyingPeriodPrivacyEvent extends Event { public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; - protected array $args; - - protected AccompanyingPeriod $period; - - public function __construct($period, $args = []) + public function __construct(protected $period, protected $args = []) { - $this->period = $period; - $this->args = $args; } public function getArgs(): array diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php index b691c4e89..27861944c 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php @@ -46,16 +46,6 @@ class PrivacyEvent extends Event { public const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event'; - /** - * @var array - */ - private $args; - - /** - * @var Person - */ - private $person; - /** * @var array */ @@ -64,10 +54,8 @@ class PrivacyEvent extends Event /** * PrivacyEvent constructor. */ - public function __construct(Person $person, array $args = ['action' => 'show']) + public function __construct(private Person $person, private array $args = ['action' => 'show']) { - $this->person = $person; - $this->args = $args; } public function addPerson(Person $person) diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index bf2d34aae..85c382a49 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -25,14 +25,11 @@ use Doctrine\Persistence\ObjectRepository; final class AccompanyingPeriodWorkRepository implements ObjectRepository { - private EntityManagerInterface $em; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $em) { - $this->em = $entityManager; - $this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class); + $this->repository = $em->getRepository(AccompanyingPeriodWork::class); } public function countByAccompanyingPeriod(AccompanyingPeriod $period): int diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php index 6422c7e0e..7983596c7 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php @@ -18,13 +18,10 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder; final class ClosingMotiveRepository implements ClosingMotiveRepositoryInterface { - private EntityManagerInterface $entityManager; - private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(private EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; $this->repository = $entityManager->getRepository(ClosingMotive::class); } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index 0aaabd05f..2b70da0a1 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -35,24 +35,8 @@ use function count; final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private AuthorizationHelper $authorizationHelper; - - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private Security $security; - - public function __construct( - AccompanyingPeriodRepository $accompanyingPeriodRepository, - Security $security, - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher - ) { - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private Security $security, private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php index a8cc9d069..33a17dfa1 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php @@ -22,17 +22,8 @@ use Symfony\Component\Security\Core\Security; final class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryInterface { - private AuthorizationHelper $authorizationHelper; - - private EntityManagerInterface $em; - - private Security $security; - - public function __construct(EntityManagerInterface $em, AuthorizationHelper $authorizationHelper, Security $security) + public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) { - $this->em = $em; - $this->authorizationHelper = $authorizationHelper; - $this->security = $security; } public function addACL(QueryBuilder $qb, string $alias = 'h'): QueryBuilder diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 30c79147c..dd82b6b96 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -34,24 +34,8 @@ use function implode; final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private CountryRepository $countryRepository; - - private EntityManagerInterface $em; - - private Security $security; - - public function __construct( - Security $security, - EntityManagerInterface $em, - CountryRepository $countryRepository, - AuthorizationHelperInterface $authorizationHelper - ) { - $this->security = $security; - $this->em = $em; - $this->countryRepository = $countryRepository; - $this->authorizationHelper = $authorizationHelper; + public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) + { } public function buildAuthorizedQuery( diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index dabc79475..05b55dd23 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -45,28 +45,8 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf 'birthdate-after', 'gender', 'nationality', 'phonenumber', 'city', ]; - private ExtractDateFromPattern $extractDateFromPattern; - - private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern; - - private PaginatorFactory $paginatorFactory; - - private PersonACLAwareRepositoryInterface $personACLAwareRepository; - - private EngineInterface $templating; - - public function __construct( - EngineInterface $templating, - ExtractDateFromPattern $extractDateFromPattern, - ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, - PaginatorFactory $paginatorFactory, - PersonACLAwareRepositoryInterface $personACLAwareRepository - ) { - $this->templating = $templating; - $this->extractDateFromPattern = $extractDateFromPattern; - $this->extractPhonenumberFromPattern = $extractPhonenumberFromPattern; - $this->paginatorFactory = $paginatorFactory; - $this->personACLAwareRepository = $personACLAwareRepository; + public function __construct(private EngineInterface $templating, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private PaginatorFactory $paginatorFactory, private PersonACLAwareRepositoryInterface $personACLAwareRepository) + { } public function buildForm(FormBuilderInterface $builder) @@ -121,7 +101,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf foreach (['firstname', 'lastname', 'gender', 'city'] as $key) { $string .= !isset($data[$key]) ? '' : $key . ':' . // add quote if contains spaces - (strpos($data[$key], ' ') !== false ? '"' . $data[$key] . '"' : $data[$key]) + (str_contains($data[$key], ' ') ? '"' . $data[$key] . '"' : $data[$key]) . ' '; } diff --git a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php index 819554252..5dcb3e7b3 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php @@ -26,32 +26,8 @@ use function in_array; class SearchHouseholdApiProvider implements SearchApiInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private ExtractDateFromPattern $extractDateFromPattern; - - private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern; - - private HouseholdRepository $householdRepository; - - private PersonACLAwareRepositoryInterface $personACLAwareRepository; - - private Security $security; - - public function __construct( - HouseholdRepository $householdRepository, - PersonACLAwareRepositoryInterface $personACLAwareRepository, - Security $security, - AuthorizationHelperInterface $authorizationHelper, - ExtractDateFromPattern $extractDateFromPattern, - ExtractPhonenumberFromPattern $extractPhonenumberFromPattern - ) { - $this->householdRepository = $householdRepository; - $this->personACLAwareRepository = $personACLAwareRepository; - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; - $this->extractDateFromPattern = $extractDateFromPattern; - $this->extractPhonenumberFromPattern = $extractPhonenumberFromPattern; + public function __construct(private HouseholdRepository $householdRepository, private PersonACLAwareRepositoryInterface $personACLAwareRepository, private Security $security, private AuthorizationHelperInterface $authorizationHelper, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) + { } public function getResult(string $key, array $metadata, float $pertinence) diff --git a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php index cbf77910b..9e2e9d6f5 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php @@ -26,32 +26,8 @@ use function in_array; class SearchPersonApiProvider implements SearchApiInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private ExtractDateFromPattern $extractDateFromPattern; - - private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern; - - private PersonACLAwareRepositoryInterface $personACLAwareRepository; - - private PersonRepository $personRepository; - - private Security $security; - - public function __construct( - PersonRepository $personRepository, - PersonACLAwareRepositoryInterface $personACLAwareRepository, - Security $security, - AuthorizationHelperInterface $authorizationHelper, - ExtractDateFromPattern $extractDateFromPattern, - ExtractPhonenumberFromPattern $extractPhonenumberFromPattern - ) { - $this->personRepository = $personRepository; - $this->personACLAwareRepository = $personACLAwareRepository; - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; - $this->extractDateFromPattern = $extractDateFromPattern; - $this->extractPhonenumberFromPattern = $extractPhonenumberFromPattern; + public function __construct(private PersonRepository $personRepository, private PersonACLAwareRepositoryInterface $personACLAwareRepository, private Security $security, private AuthorizationHelperInterface $authorizationHelper, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) + { } public function getResult(string $key, array $metadata, float $pertinence) diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index c77c0758e..4da00c5fa 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -37,10 +37,6 @@ class SimilarPersonMatcher */ protected $em; - protected PersonNotDuplicateRepository $personNotDuplicateRepository; - - protected PersonRenderInterface $personRender; - /** * @var TokenStorageInterface */ @@ -50,14 +46,12 @@ class SimilarPersonMatcher EntityManagerInterface $em, AuthorizationHelper $authorizationHelper, TokenStorageInterface $tokenStorage, - PersonNotDuplicateRepository $personNotDuplicateRepository, - PersonRenderInterface $personRender + protected PersonNotDuplicateRepository $personNotDuplicateRepository, + protected PersonRenderInterface $personRender ) { $this->em = $em; $this->authorizationHelper = $authorizationHelper; $this->tokenStorage = $tokenStorage; - $this->personNotDuplicateRepository = $personNotDuplicateRepository; - $this->personRender = $personRender; } public function matchPerson( diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php index 1174bc2a0..e8a06a8b3 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php @@ -23,11 +23,8 @@ class AccompanyingPeriodCommentVoter extends Voter public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT'; - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } protected function supports($attribute, $subject) @@ -37,16 +34,10 @@ class AccompanyingPeriodCommentVoter extends Voter protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { - /** @var Comment $subject */ - switch ($attribute) { - case self::EDIT: - return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()); - - case self::DELETE: - return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()); - - default: - throw new UnexpectedValueException("This attribute {$attribute} is not supported"); - } + return match ($attribute) { + self::EDIT => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()), + self::DELETE => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()), + default => throw new UnexpectedValueException("This attribute {$attribute} is not supported"), + }; } } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php index 9ffd90efa..432c142fe 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php @@ -21,11 +21,8 @@ class AccompanyingPeriodResourceVoter extends Voter { public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_RESOURCE_EDIT'; - private AccessDecisionManagerInterface $accessDecisionManager; - - public function __construct(AccessDecisionManagerInterface $accessDecisionManager) + public function __construct(private AccessDecisionManagerInterface $accessDecisionManager) { - $this->accessDecisionManager = $accessDecisionManager; } protected function supports($attribute, $subject) @@ -35,17 +32,13 @@ class AccompanyingPeriodResourceVoter extends Voter protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { - /** @var \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource $subject */ - switch ($attribute) { - case self::EDIT: - return $this->accessDecisionManager->decide( - $token, - [AccompanyingPeriodVoter::EDIT], - $subject->getAccompanyingPeriod() - ); - - default: - throw new UnexpectedValueException("attribute not supported: {$attribute}"); - } + return match ($attribute) { + self::EDIT => $this->accessDecisionManager->decide( + $token, + [AccompanyingPeriodVoter::EDIT], + $subject->getAccompanyingPeriod() + ), + default => throw new UnexpectedValueException("attribute not supported: {$attribute}"), + }; } } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index ea32326a4..817873738 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -106,15 +106,12 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH */ public const TOGGLE_INTENSITY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_INTENSITY'; - private Security $security; - private VoterHelperInterface $voterHelper; public function __construct( - Security $security, + private Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->security = $security; $this->voterHelper = $voterHelperFactory ->generate(self::class) ->addCheckFor(null, [self::CREATE, self::REASSIGN_BULK]) diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php index 98de820da..8591a044f 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php @@ -26,11 +26,8 @@ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter { public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_DOCUMENT_SHOW'; - private AccessDecisionManagerInterface $accessDecisionManager; - - public function __construct(AccessDecisionManagerInterface $accessDecisionManager) + public function __construct(private AccessDecisionManagerInterface $accessDecisionManager) { - $this->accessDecisionManager = $accessDecisionManager; } protected function supports($attribute, $subject) @@ -47,16 +44,13 @@ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter */ protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { - switch ($attribute) { - case self::SEE: - return $this->accessDecisionManager->decide( - $token, - [AccompanyingPeriodWorkEvaluationVoter::SEE], - $subject->getAccompanyingPeriodWorkEvaluation() - ); - - default: - throw new UnexpectedValueException("The attribute {$attribute} is not supported"); - } + return match ($attribute) { + self::SEE => $this->accessDecisionManager->decide( + $token, + [AccompanyingPeriodWorkEvaluationVoter::SEE], + $subject->getAccompanyingPeriodWorkEvaluation() + ), + default => throw new UnexpectedValueException("The attribute {$attribute} is not supported"), + }; } } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php index cfa867266..955d199ff 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php @@ -30,11 +30,8 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI public const STATS = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_STATS'; - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } protected function supports($attribute, $subject) @@ -49,15 +46,10 @@ class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterI */ protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { - switch ($attribute) { - case self::STATS: - return $this->security->isGranted(AccompanyingPeriodVoter::STATS, $subject); - - case self::SEE: - return $this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $subject->getAccompanyingPeriodWork()); - - default: - throw new UnexpectedValueException("attribute {$attribute} is not supported"); - } + return match ($attribute) { + self::STATS => $this->security->isGranted(AccompanyingPeriodVoter::STATS, $subject), + self::SEE => $this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $subject->getAccompanyingPeriodWork()), + default => throw new UnexpectedValueException("attribute {$attribute} is not supported"), + }; } } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php index 84f31c202..43a99e7e1 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php @@ -42,15 +42,12 @@ class AccompanyingPeriodWorkVoter extends Voter implements ProvideRoleHierarchyI public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE'; - private Security $security; - private VoterHelperInterface $voterHelper; public function __construct( - Security $security, + private Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { - $this->security = $security; $this->voterHelper = $voterHelperFactory ->generate(self::class) ->addCheckFor(null, [self::CREATE]) @@ -98,34 +95,22 @@ class AccompanyingPeriodWorkVoter extends Voter implements ProvideRoleHierarchyI protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { if ($subject instanceof AccompanyingPeriodWork) { - switch ($attribute) { - case self::SEE: - return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod()); - - case self::CREATE: - case self::UPDATE: - case self::DELETE: - return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()); - - default: - throw new UnexpectedValueException("attribute {$attribute} is not supported"); - } + return match ($attribute) { + self::SEE => $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject->getAccompanyingPeriod()), + self::CREATE, self::UPDATE, self::DELETE => $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()), + default => throw new UnexpectedValueException("attribute {$attribute} is not supported"), + }; } elseif ($subject instanceof AccompanyingPeriod) { - switch ($attribute) { - case self::SEE: - return $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject); - - case self::CREATE: - return $this->security->isGranted(AccompanyingPeriodVoter::CREATE, $subject); - - default: - throw new UnexpectedValueException(sprintf( - "attribute {$attribute} is not supported on instance %s", - AccompanyingPeriod::class - )); - } + return match ($attribute) { + self::SEE => $this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $subject), + self::CREATE => $this->security->isGranted(AccompanyingPeriodVoter::CREATE, $subject), + default => throw new UnexpectedValueException(sprintf( + "attribute {$attribute} is not supported on instance %s", + AccompanyingPeriod::class + )), + }; } - throw new UnexpectedValueException(sprintf("attribute {$attribute} on instance %s is not supported", get_class($subject))); + throw new UnexpectedValueException(sprintf("attribute {$attribute} on instance %s is not supported", $subject::class)); } } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php index 6ba1ac1a9..74eee07f6 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php @@ -45,11 +45,8 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi private VoterHelperInterface $helper; - private Security $security; - - public function __construct(Security $security, VoterHelperFactoryInterface $voterHelperFactory) + public function __construct(private Security $security, VoterHelperFactoryInterface $voterHelperFactory) { - $this->security = $security; $this->helper = $voterHelperFactory ->generate(self::class) ->addCheckFor(Center::class, [self::STATS]) @@ -80,19 +77,12 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { - switch ($attribute) { - case self::SEE: - return $this->checkAssociatedMembersRole($subject, PersonVoter::SEE); - - case self::EDIT: - return $this->checkAssociatedMembersRole($subject, PersonVoter::UPDATE); - - case self::STATS: - return $this->voteOnAttribute($attribute, $subject, $token); - - default: - throw new UnexpectedValueException('attribute not supported'); - } + return match ($attribute) { + self::SEE => $this->checkAssociatedMembersRole($subject, PersonVoter::SEE), + self::EDIT => $this->checkAssociatedMembersRole($subject, PersonVoter::UPDATE), + self::STATS => $this->voteOnAttribute($attribute, $subject, $token), + default => throw new UnexpectedValueException('attribute not supported'), + }; } private function checkAssociatedMembersRole(Household $household, string $attribute): bool diff --git a/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php b/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php index 1244f921f..8b649f8f0 100644 --- a/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php +++ b/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php @@ -17,13 +17,10 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; class AuthorizedCenterOnPersonCreation implements AuthorizedCenterOnPersonCreationInterface { - private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser; - private bool $showCenters; - public function __construct(AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, ParameterBagInterface $parameterBag) + public function __construct(private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, ParameterBagInterface $parameterBag) { - $this->authorizationHelperForCurrentUser = $authorizationHelperForCurrentUser; $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index bc13dec66..0bb3d68b6 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -74,28 +74,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'pinnedComment' => AccompanyingPeriod\Comment::class, ]; - private ClosingMotiveRender $closingMotiveRender; - - private ScopeResolverDispatcher $scopeResolverDispatcher; - - private SocialIssueRender $socialIssueRender; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper, - SocialIssueRender $socialIssueRender, - ClosingMotiveRender $closingMotiveRender, - ScopeResolverDispatcher $scopeResolverDispatcher - ) { - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; - $this->socialIssueRender = $socialIssueRender; - $this->closingMotiveRender = $closingMotiveRender; - $this->scopeResolverDispatcher = $scopeResolverDispatcher; + public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private SocialIssueRender $socialIssueRender, private ClosingMotiveRender $closingMotiveRender, private ScopeResolverDispatcher $scopeResolverDispatcher) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index 665671145..c2a723274 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -32,11 +32,8 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface use ObjectToPopulateTrait; - private ResourceRepository $repository; - - public function __construct(ResourceRepository $repository) + public function __construct(private ResourceRepository $repository) { - $this->repository = $repository; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php index 4d9cfceca..e0697a6fd 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php @@ -40,16 +40,8 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte public const GROUP_EDIT = 'accompanying_period_work:edit'; - private EntityManagerInterface $em; - - private AccompanyingPeriodWorkRepository $workRepository; - - public function __construct( - AccompanyingPeriodWorkRepository $workRepository, - EntityManagerInterface $em - ) { - $this->workRepository = $workRepository; - $this->em = $em; + public function __construct(private AccompanyingPeriodWorkRepository $workRepository, private EntityManagerInterface $em) + { } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php index fb87df96c..7850cc1c8 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php @@ -26,17 +26,8 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware private const SKIP = 'accompanying_period_work_evaluation_document_skip'; - private EntityWorkflowRepository $entityWorkflowRepository; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct(EntityWorkflowRepository $entityWorkflowRepository, MetadataExtractor $metadataExtractor, Registry $registry) + public function __construct(private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor, private Registry $registry) { - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->metadataExtractor = $metadataExtractor; - $this->registry = $registry; } public function normalize($object, ?string $format = null, array $context = []): array diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index a0268ae31..512dc6370 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -27,17 +27,8 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz private const IGNORE_EVALUATION = 'evaluation:ignore'; - private EntityWorkflowRepository $entityWorkflowRepository; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct(Registry $registry, EntityWorkflowRepository $entityWorkflowRepository, MetadataExtractor $metadataExtractor) + public function __construct(private Registry $registry, private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor) { - $this->registry = $registry; - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->metadataExtractor = $metadataExtractor; } /** diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php index 18c716fd7..12652ce2a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php @@ -30,27 +30,16 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac private const IGNORE_WORK = 'ignore:work'; - private EntityWorkflowRepository $entityWorkflowRepository; - - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct(Registry $registry, EntityWorkflowRepository $entityWorkflowRepository, MetadataExtractor $metadataExtractor) + public function __construct(private Registry $registry, private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor) { - $this->registry = $registry; - $this->entityWorkflowRepository = $entityWorkflowRepository; - $this->metadataExtractor = $metadataExtractor; } /** * @param AccompanyingPeriodWork $object * * @throws ExceptionInterface - * - * @return array|ArrayObject|bool|float|int|string|null */ - public function normalize($object, ?string $format = null, array $context = []) + 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, diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index 740ea808c..6185c018d 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -31,11 +31,8 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize { use DenormalizerAwareTrait; - private MembersEditorFactory $factory; - - public function __construct(MembersEditorFactory $factory) + public function __construct(private MembersEditorFactory $factory) { - $this->factory = $factory; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 7b500e6bb..390d938d9 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -47,35 +47,15 @@ class PersonDocGenNormalizer implements private const CIRCULAR_KEY = 'person:circular'; - private PersonRenderInterface $personRender; - - private RelationshipRepository $relationshipRepository; - - private SummaryBudgetInterface $summaryBudget; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - PersonRenderInterface $personRender, - RelationshipRepository $relationshipRepository, - TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper, - SummaryBudgetInterface $summaryBudget - ) { - $this->personRender = $personRender; - $this->relationshipRepository = $relationshipRepository; - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; - $this->summaryBudget = $summaryBudget; + public function __construct(private PersonRenderInterface $personRender, private RelationshipRepository $relationshipRepository, private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private SummaryBudgetInterface $summaryBudget) + { } public function normalize($person, $format = null, array $context = []) { try { $context = $this->addCircularToContext($person, $context); - } catch (CircularReferenceException $circularReferenceException) { + } catch (CircularReferenceException) { return [ 'isNull' => true, 'isCircular' => true, diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 2cadd0c75..57f666f05 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -47,28 +47,14 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar use ObjectToPopulateTrait; - private CenterResolverManagerInterface $centerResolverManager; - - private PhoneNumberHelperInterface $phoneNumberHelper; - - private ChillEntityRenderExtension $render; - - private PersonRepository $repository; - - private ResidentialAddressRepository $residentialAddressRepository; - public function __construct( - ChillEntityRenderExtension $render, /* TODO: replace by PersonRenderInterface, as sthis is the only one required */ - PersonRepository $repository, - CenterResolverManagerInterface $centerResolverManager, - ResidentialAddressRepository $residentialAddressRepository, - PhoneNumberHelperInterface $phoneNumberHelper /* TODO maybe not necessayr any more */ + private ChillEntityRenderExtension $render, + /* TODO: replace by PersonRenderInterface, as sthis is the only one required */ + private PersonRepository $repository, + private CenterResolverManagerInterface $centerResolverManager, + private ResidentialAddressRepository $residentialAddressRepository, + private PhoneNumberHelperInterface $phoneNumberHelper ) { - $this->render = $render; - $this->repository = $repository; - $this->centerResolverManager = $centerResolverManager; - $this->residentialAddressRepository = $residentialAddressRepository; - $this->phoneNumberHelper = $phoneNumberHelper; } public function denormalize($data, $type, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php index 0e4633580..42bccba06 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php @@ -22,11 +22,8 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N { use NormalizerAwareTrait; - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct(TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } /** diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php index c7d214b04..494c82735 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php @@ -21,11 +21,8 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - private SocialActionRender $render; - - public function __construct(SocialActionRender $render) + public function __construct(private SocialActionRender $render) { - $this->render = $render; } public function normalize($socialAction, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php index 32b1635c4..7c8c8b226 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php @@ -21,11 +21,8 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz { use NormalizerAwareTrait; - private SocialIssueRender $render; - - public function __construct(SocialIssueRender $render) + public function __construct(private SocialIssueRender $render) { - $this->render = $render; } public function normalize($socialIssue, $format = null, array $context = []) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php index 14b50403a..b5cbeda07 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php @@ -27,14 +27,8 @@ class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerA private const IGNORE_ENTITY_WORKFLOW = 'ignore:entity_workflow'; - private MetadataExtractor $metadataExtractor; - - private Registry $registry; - - public function __construct(Registry $registry, MetadataExtractor $metadataExtractor) + public function __construct(private Registry $registry, private MetadataExtractor $metadataExtractor) { - $this->registry = $registry; - $this->metadataExtractor = $metadataExtractor; } /** diff --git a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php index a5663050a..745568ed7 100644 --- a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php +++ b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php @@ -22,14 +22,8 @@ use Psr\Log\LoggerInterface; class OldDraftAccompanyingPeriodRemover implements OldDraftAccompanyingPeriodRemoverInterface { - private EntityManagerInterface $em; - - private LoggerInterface $logger; - - public function __construct(EntityManagerInterface $em, LoggerInterface $logger) + public function __construct(private EntityManagerInterface $em, private LoggerInterface $logger) { - $this->em = $em; - $this->logger = $logger; } public function remove(DateInterval $interval): void diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index a42765c12..f4c161a98 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -46,40 +46,8 @@ class AccompanyingPeriodContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - private BaseContextData $baseContextData; - - private DocumentCategoryRepository $documentCategoryRepository; - - private EntityManagerInterface $em; - - private NormalizerInterface $normalizer; - - private PersonRenderInterface $personRender; - - private PersonRepository $personRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - DocumentCategoryRepository $documentCategoryRepository, - NormalizerInterface $normalizer, - TranslatableStringHelperInterface $translatableStringHelper, - EntityManagerInterface $em, - PersonRenderInterface $personRender, - PersonRepository $personRepository, - TranslatorInterface $translator, - BaseContextData $baseContextData - ) { - $this->documentCategoryRepository = $documentCategoryRepository; - $this->normalizer = $normalizer; - $this->translatableStringHelper = $translatableStringHelper; - $this->em = $em; - $this->personRender = $personRender; - $this->personRepository = $personRepository; - $this->translator = $translator; - $this->baseContextData = $baseContextData; + public function __construct(private DocumentCategoryRepository $documentCategoryRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper, private EntityManagerInterface $em, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private TranslatorInterface $translator, private BaseContextData $baseContextData) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php index ad1952596..0bc61d19f 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php @@ -29,16 +29,8 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ class AccompanyingPeriodWorkContext implements DocGeneratorContextWithPublicFormInterface { - private NormalizerInterface $normalizer; - - private AccompanyingPeriodContext $periodContext; - - public function __construct( - AccompanyingPeriodContext $periodContext, - NormalizerInterface $normalizer - ) { - $this->periodContext = $periodContext; - $this->normalizer = $normalizer; + public function __construct(private AccompanyingPeriodContext $periodContext, private NormalizerInterface $normalizer) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index 34b339822..209251cd0 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -33,28 +33,8 @@ class AccompanyingPeriodWorkEvaluationContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - private AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext; - - private EntityManagerInterface $em; - - private EvaluationRepository $evaluationRepository; - - private NormalizerInterface $normalizer; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, - EntityManagerInterface $em, - EvaluationRepository $evaluationRepository, - NormalizerInterface $normalizer, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->accompanyingPeriodWorkContext = $accompanyingPeriodWorkContext; - $this->em = $em; - $this->evaluationRepository = $evaluationRepository; - $this->normalizer = $normalizer; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, private EntityManagerInterface $em, private EvaluationRepository $evaluationRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php index 1fdfd23d9..ecbbe28db 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php @@ -45,52 +45,22 @@ use function count; final class PersonContext implements PersonContextInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private BaseContextData $baseContextData; - - private CenterResolverManagerInterface $centerResolverManager; - - private DocumentCategoryRepository $documentCategoryRepository; - - private EntityManagerInterface $em; - - private NormalizerInterface $normalizer; - - private ScopeRepositoryInterface $scopeRepository; - - private Security $security; - private bool $showScopes; - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - public function __construct( - AuthorizationHelperInterface $authorizationHelper, - BaseContextData $baseContextData, - CenterResolverManagerInterface $centerResolverManager, - DocumentCategoryRepository $documentCategoryRepository, - EntityManagerInterface $em, - NormalizerInterface $normalizer, + private AuthorizationHelperInterface $authorizationHelper, + private BaseContextData $baseContextData, + private CenterResolverManagerInterface $centerResolverManager, + private DocumentCategoryRepository $documentCategoryRepository, + private EntityManagerInterface $em, + private NormalizerInterface $normalizer, ParameterBagInterface $parameterBag, - ScopeRepositoryInterface $scopeRepository, - Security $security, - TranslatorInterface $translator, - TranslatableStringHelperInterface $translatableStringHelper + private ScopeRepositoryInterface $scopeRepository, + private Security $security, + private TranslatorInterface $translator, + private TranslatableStringHelperInterface $translatableStringHelper ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverManager = $centerResolverManager; - $this->baseContextData = $baseContextData; - $this->documentCategoryRepository = $documentCategoryRepository; - $this->em = $em; - $this->normalizer = $normalizer; - $this->scopeRepository = $scopeRepository; - $this->security = $security; $this->showScopes = $parameterBag->get('chill_main')['acl']['form_show_scopes']; - $this->translator = $translator; - $this->translatableStringHelper = $translatableStringHelper; } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php index 53f8064a3..c8e15be12 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php @@ -27,20 +27,8 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ class PersonContextWithThirdParty implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - private NormalizerInterface $normalizer; - - private PersonContextInterface $personContext; - - private ThirdPartyRepository $thirdPartyRepository; - - public function __construct( - PersonContextInterface $personContext, - NormalizerInterface $normalizer, - ThirdPartyRepository $thirdPartyRepository - ) { - $this->personContext = $personContext; - $this->normalizer = $normalizer; - $this->thirdPartyRepository = $thirdPartyRepository; + public function __construct(private PersonContextInterface $personContext, private NormalizerInterface $normalizer, private ThirdPartyRepository $thirdPartyRepository) + { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index 3d7b60254..017c90b73 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -30,32 +30,8 @@ use function count; final class SocialWorkMetadata implements SocialWorkMetadataInterface { - private EntityManagerInterface $entityManager; - - private EvaluationRepository $evaluationRepository; - - private GoalRepository $goalRepository; - - private ResultRepository $resultRepository; - - private SocialActionRepository $socialActionRepository; - - private SocialIssueRepository $socialIssueRepository; - - public function __construct( - SocialIssueRepository $socialIssueRepository, - SocialActionRepository $socialActionRepository, - GoalRepository $goalRepository, - ResultRepository $resultRepository, - EvaluationRepository $evaluationRepository, - EntityManagerInterface $entityManager - ) { - $this->socialIssueRepository = $socialIssueRepository; - $this->socialActionRepository = $socialActionRepository; - $this->goalRepository = $goalRepository; - $this->resultRepository = $resultRepository; - $this->evaluationRepository = $evaluationRepository; - $this->entityManager = $entityManager; + public function __construct(private SocialIssueRepository $socialIssueRepository, private SocialActionRepository $socialActionRepository, private GoalRepository $goalRepository, private ResultRepository $resultRepository, private EvaluationRepository $evaluationRepository, private EntityManagerInterface $entityManager) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php index 0064a53d5..8ebc89c04 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php @@ -27,14 +27,8 @@ class ClosingMotiveRender implements ChillEntityRenderInterface use BoxUtilsChillEntityRenderTrait; private const SEPARATOR = ' > '; - /** - * @var TranslatableStringHelper - */ - private $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 05d9b3009..8d50f03ac 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -27,20 +27,9 @@ use function array_key_exists; class PersonRender implements PersonRenderInterface { use BoxUtilsChillEntityRenderTrait; - private ConfigPersonAltNamesHelper $configAltNamesHelper; - private EngineInterface $engine; - - private TranslatorInterface $translator; - - public function __construct( - ConfigPersonAltNamesHelper $configAltNamesHelper, - EngineInterface $engine, - TranslatorInterface $translator - ) { - $this->configAltNamesHelper = $configAltNamesHelper; - $this->engine = $engine; - $this->translator = $translator; + public function __construct(private ConfigPersonAltNamesHelper $configAltNamesHelper, private EngineInterface $engine, private TranslatorInterface $translator) + { } public function renderBox($person, array $options): string diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php index 61c674b76..925c174cc 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php @@ -20,11 +20,8 @@ use Chill\PersonBundle\Entity\Person\PersonResourceKind; */ final class ResourceKindRender implements ChillEntityRenderInterface { - private TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(private TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $translatableStringHelper; } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php index dd8083878..2d8b1ea92 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php @@ -47,20 +47,8 @@ class SocialActionRender implements ChillEntityRenderInterface */ public const SHOW_AND_CHILDREN = 'show_and_children'; - private EngineInterface $engine; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - EngineInterface $engine, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->engine = $engine; - $this->translator = $translator; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) + { } public function renderBox($socialAction, array $options): string diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index f3962535b..381f80ef9 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -40,20 +40,8 @@ final class SocialIssueRender implements ChillEntityRenderInterface */ public const SHOW_AND_CHILDREN = 'show_and_children'; - private EngineInterface $engine; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - TranslatableStringHelper $translatableStringHelper, - EngineInterface $engine, - TranslatorInterface $translator - ) { - $this->translatableStringHelper = $translatableStringHelper; - $this->engine = $engine; - $this->translator = $translator; + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) + { } public function renderBox($socialIssue, array $options): string diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php index 8ac092647..68100a1b3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListenerTest.php @@ -115,14 +115,8 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T protected function generateClass(AccompanyingPeriod $period, Collection $socialIssues): AccompanyingPeriodLinkedWithSocialIssuesEntityInterface { return new class ($period, $socialIssues) implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface { - public Collection $socialIssues; - - public AccompanyingPeriod $period; - - public function __construct($period, $socialIssues) + public function __construct(public $period, public $socialIssues) { - $this->period = $period; - $this->socialIssues = $socialIssues; } public function getAccompanyingPeriod(): AccompanyingPeriod diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php index ac722f2f6..560928bff 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php @@ -472,11 +472,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase /** * @dataProvider dataGenerateRandomRequestorValidData - * - * @param mixed $personId - * @param mixed $thirdPartyId */ - public function testCommentWithValidData(AccompanyingPeriod $period, $personId, $thirdPartyId) + public function testCommentWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId) { $this->markTestIncomplete('fix test with validation'); $em = self::$container->get(EntityManagerInterface::class); @@ -550,11 +547,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase /** * @dataProvider dataGenerateRandomRequestorValidData - * - * @param mixed $personId - * @param mixed $thirdPartyId */ - public function testRequestorWithValidData(AccompanyingPeriod $period, $personId, $thirdPartyId) + public function testRequestorWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId) { $this->markTestIncomplete('fix test with validation'); $em = self::$container->get(EntityManagerInterface::class); @@ -634,11 +628,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase /** * @dataProvider dataGenerateRandomRequestorValidData - * - * @param mixed $personId - * @param mixed $thirdPartyId */ - public function testResourceWithValidData(AccompanyingPeriod $period, $personId, $thirdPartyId) + public function testResourceWithValidData(AccompanyingPeriod $period, mixed $personId, mixed $thirdPartyId) { $this->markTestIncomplete('fix test with validation'); $em = self::$container->get(EntityManagerInterface::class); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php index b475cca4c..a7d98bd97 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php @@ -75,11 +75,8 @@ final class AccompanyingCourseControllerTest extends WebTestCase /** * @dataProvider dataGenerateRandomUsers - * - * @param mixed $personId0 - * @param mixed $personId1 */ - public function testWithNewUsers($personId0, $personId1) + public function testWithNewUsers(mixed $personId0, mixed $personId1) { $this->client->request('GET', '/fr/person/parcours/new', [ 'person_id' => [ diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php index 772fee3b1..5cc3d0643 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdControllerTest.php @@ -64,10 +64,8 @@ final class HouseholdControllerTest extends WebTestCase /** * @dataProvider generateValidHouseholdIds - * - * @param mixed $householdId */ - public function testAddresses($householdId) + public function testAddresses(mixed $householdId) { $this->client->request( Request::METHOD_GET, @@ -79,10 +77,8 @@ final class HouseholdControllerTest extends WebTestCase /** * @dataProvider generateValidHouseholdIds - * - * @param mixed $householdId */ - public function testAddressMove($householdId) + public function testAddressMove(mixed $householdId) { $this->client->request( Request::METHOD_GET, @@ -96,10 +92,8 @@ final class HouseholdControllerTest extends WebTestCase /** * @dataProvider generateValidHouseholdIds - * - * @param mixed $householdId */ - public function testEditMetadata($householdId) + public function testEditMetadata(mixed $householdId) { $crawler = $this->client->request( Request::METHOD_GET, @@ -126,10 +120,8 @@ final class HouseholdControllerTest extends WebTestCase /** * @dataProvider generateValidHouseholdIds - * - * @param mixed $householdId */ - public function testSummary($householdId) + public function testSummary(mixed $householdId) { $this->client->request( Request::METHOD_GET, diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php index 56000c3e0..4986d5b9a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php @@ -110,10 +110,8 @@ final class HouseholdMemberControllerTest extends WebTestCase /** * @dataProvider provideValidDataEditMember - * - * @param mixed $memberId */ - public function testEditMember($memberId) + public function testEditMember(mixed $memberId) { $client = $this->getClientAuthenticated(); @@ -134,12 +132,8 @@ final class HouseholdMemberControllerTest extends WebTestCase /** * @dataProvider provideValidDataMove - * - * @param mixed $personId - * @param mixed $householdId - * @param mixed $positionId */ - public function testLeaveWithoutHousehold($personId, $householdId, $positionId, DateTimeInterface $date) + public function testLeaveWithoutHousehold(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date) { $client = $this->getClientAuthenticated(); @@ -186,12 +180,8 @@ final class HouseholdMemberControllerTest extends WebTestCase /** * @dataProvider provideValidDataMove - * - * @param mixed $personId - * @param mixed $householdId - * @param mixed $positionId */ - public function testMoveMember($personId, $householdId, $positionId, DateTimeInterface $date) + public function testMoveMember(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date) { $client = $this->getClientAuthenticated(); @@ -237,12 +227,8 @@ final class HouseholdMemberControllerTest extends WebTestCase /** * @dataProvider provideValidDataMove - * - * @param mixed $personId - * @param mixed $householdId - * @param mixed $positionId */ - public function testMoveMemberToNewHousehold($personId, $householdId, $positionId, DateTimeInterface $date) + public function testMoveMemberToNewHousehold(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date) { $client = $this->getClientAuthenticated(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php index 0de312d84..cb91d2ccf 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php @@ -71,10 +71,8 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterA - * - * @param mixed $personId */ - public function testPersonAddressSuggestion($personId): void + public function testPersonAddressSuggestion(mixed $personId): void { $client = $this->getClientAuthenticated(); @@ -85,10 +83,8 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterB - * - * @param mixed $personId */ - public function testPersonAddressSuggestionUnauthorized($personId): void + public function testPersonAddressSuggestionUnauthorized(mixed $personId): void { $client = $this->getClientAuthenticated(); @@ -100,10 +96,8 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterA - * - * @param mixed $personId */ - public function testPersonGet($personId): void + public function testPersonGet(mixed $personId): void { $client = $this->getClientAuthenticated(); @@ -122,10 +116,8 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterB - * - * @param mixed $personId */ - public function testPersonGetUnauthorized($personId): void + public function testPersonGetUnauthorized(mixed $personId): void { $client = $this->getClientAuthenticated(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php index 6f92c864b..0e7b2c9f1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php @@ -141,7 +141,7 @@ final class PersonControllerCreateTest extends WebTestCase * @param int|string $personId The is of the person * @depends testValidForm */ - public function testPersonViewAccessible($personId) + public function testPersonViewAccessible(int|string $personId) { $client = $this->client; $client->request('GET', '/fr/person/' . $personId . '/general'); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php index d6fb7a8da..7851c782d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/RelationshipApiControllerTest.php @@ -103,10 +103,8 @@ final class RelationshipApiControllerTest extends WebTestCase /** * @dataProvider personProvider - * - * @param mixed $personId */ - public function testGetRelationshipByPerson($personId) + public function testGetRelationshipByPerson(mixed $personId) { $this->client->request(Request::METHOD_GET, sprintf('/api/1.0/relations/relationship/by-person/%d.json', $personId)); @@ -116,13 +114,8 @@ final class RelationshipApiControllerTest extends WebTestCase /** * @dataProvider relationProvider - * - * @param mixed $fromPersonId - * @param mixed $toPersonId - * @param mixed $relationId - * @param mixed $isReverse */ - public function testPostRelationship($fromPersonId, $toPersonId, $relationId, $isReverse): void + public function testPostRelationship(mixed $fromPersonId, mixed $toPersonId, mixed $relationId, mixed $isReverse): void { $this->client->request( Request::METHOD_POST, diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php index 724777c83..974dc0ed9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -46,11 +46,8 @@ final class PersonCreateEventTest extends TestCase /** * @dataProvider generateAltNames - * - * @param mixed $altname - * @param mixed $altnameExpected */ - public function testAltNamesOnPrePersist($altname, $altnameExpected) + public function testAltNamesOnPrePersist(mixed $altname, mixed $altnameExpected) { $listener = new PersonEventListener(); @@ -65,13 +62,8 @@ final class PersonCreateEventTest extends TestCase /** * @dataProvider generateNames - * - * @param mixed $firstname - * @param mixed $firstnameExpected - * @param mixed $lastname - * @param mixed $lastnameExpected */ - public function testOnPrePersist($firstname, $firstnameExpected, $lastname, $lastnameExpected) + public function testOnPrePersist(mixed $firstname, mixed $firstnameExpected, mixed $lastname, mixed $lastnameExpected) { $listener = new PersonEventListener(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php b/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php index 9d200beee..64143e7db 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php @@ -225,11 +225,9 @@ final class PersonSearchTest extends WebTestCase } /** - * @param mixed $username - * * @return \Symfony\Component\BrowserKit\Client */ - private function getAuthenticatedClient($username = 'center a_social') + private function getAuthenticatedClient(mixed $username = 'center a_social') { return self::createClient([], [ 'PHP_AUTH_USER' => $username, diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php index f7a05f7ce..90ceddb04 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php @@ -108,10 +108,8 @@ final class PersonDocGenNormalizerTest extends KernelTestCase /** * @dataProvider dataGeneratorNormalizationNullOrNotNullHaveSameKeys - * - * @param mixed $context */ - public function testNormalizationNullOrNotNullHaveSameKeys($context) + public function testNormalizationNullOrNotNullHaveSameKeys(mixed $context) { $period = new Person(); $notNullData = $this->buildPersonNormalizer()->normalize($period, 'docgen', $context); @@ -126,11 +124,8 @@ final class PersonDocGenNormalizerTest extends KernelTestCase /** * @dataProvider generateData - * - * @param mixed $expected - * @param mixed $msg */ - public function testNormalize(?Person $person, $expected, $msg) + public function testNormalize(?Person $person, mixed $expected, mixed $msg) { $normalized = $this->normalizer->normalize($person, 'docgen', [ 'docgen:expects' => Person::class, @@ -229,11 +224,8 @@ final class PersonDocGenNormalizerTest extends KernelTestCase * serializers. * * @dataProvider generateData - * - * @param mixed $expected - * @param mixed $msg */ - public function testNormalizeUsingNormalizer(?Person $person, $expected, $msg) + public function testNormalizeUsingNormalizer(?Person $person, mixed $expected, mixed $msg) { $normalizer = $this->buildNormalizer(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php index ebc6d4b40..be368e28c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php @@ -58,10 +58,8 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase /** * @dataProvider provideDataPersonWithAccompanyingPeriod - * - * @param mixed $personId */ - public function testEntriesAreShown($personId) + public function testEntriesAreShown(mixed $personId) { $this->markTestSkipped('page does not work'); diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php index de9769175..ac7530fca 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/Household/MaxHolderValidatorTest.php @@ -61,10 +61,8 @@ final class MaxHolderValidatorTest extends ConstraintValidatorTestCase /** * @dataProvider provideInvalidHousehold - * - * @param mixed $parameters */ - public function testHouseholdInvalid(Household $household, $parameters) + public function testHouseholdInvalid(Household $household, mixed $parameters) { $constraint = $this->getConstraint(); diff --git a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php index fe2947f60..2e11a4f4f 100644 --- a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php @@ -35,17 +35,8 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt { private const SUPPORTED_CONTEXTS = ['person', 'center']; - protected EntityManager $em; - - private AuthorizationHelper $authorizationHelper; - - private Security $security; - - public function __construct(EntityManager $em, Security $security, AuthorizationHelper $authorizationHelper) + public function __construct(protected EntityManager $em, private Security $security, private AuthorizationHelper $authorizationHelper) { - $this->em = $em; - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; } public function getEntities(array $ids) @@ -125,12 +116,10 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt * return the expected response for TimelineProviderInterface::getEntityTemplate. * * @param string $template the template for rendering - * @param mixed $entity * @param string $context - * * @return array */ - protected function getBasicEntityTemplate($template, $entity, $context, array $args) + protected function getBasicEntityTemplate($template, mixed $entity, $context, array $args) { return [ 'template' => $template, diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php index ed0337f1f..f7d533d0e 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php @@ -25,17 +25,8 @@ use function in_array; class AccompanyingPeriodValidityValidator extends ConstraintValidator { - private ActivityRepository $activityRepository; - - private SocialIssueRender $socialIssueRender; - - private TokenStorageInterface $token; - - public function __construct(ActivityRepository $activityRepository, SocialIssueRender $socialIssueRender, TokenStorageInterface $token) + public function __construct(private ActivityRepository $activityRepository, private SocialIssueRender $socialIssueRender, private TokenStorageInterface $token) { - $this->activityRepository = $activityRepository; - $this->socialIssueRender = $socialIssueRender; - $this->token = $token; } public function validate($period, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php index df5b88fc6..50ef5059c 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php @@ -20,11 +20,8 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class LocationValidityValidator extends ConstraintValidator { - private PersonRenderInterface $render; - - public function __construct(PersonRenderInterface $render) + public function __construct(private PersonRenderInterface $render) { - $this->render = $render; } public function validate($period, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index 67ee00756..2589a1751 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -26,14 +26,8 @@ class ParticipationOverlapValidator extends ConstraintValidator { private const MAX_PARTICIPATION = 1; - private PersonRenderInterface $personRender; - - private ThirdPartyRender $thirdpartyRender; - - public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(private PersonRenderInterface $personRender, private ThirdPartyRender $thirdpartyRender) { - $this->personRender = $personRender; - $this->thirdpartyRender = $thirdPartyRender; } public function validate($participations, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index 5813945ab..a9d339286 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -24,14 +24,8 @@ use function in_array; class ResourceDuplicateCheckValidator extends ConstraintValidator { - private PersonRenderInterface $personRender; - - private ThirdPartyRender $thirdpartyRender; - - public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(private PersonRenderInterface $personRender, private ThirdPartyRender $thirdpartyRender) { - $this->personRender = $personRender; - $this->thirdpartyRender = $thirdPartyRender; } public function validate($resources, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index a57b47325..edabface7 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -26,11 +26,8 @@ use function count; */ class HouseholdMembershipSequentialValidator extends ConstraintValidator { - private PersonRenderInterface $render; - - public function __construct(PersonRenderInterface $render) + public function __construct(private PersonRenderInterface $render) { - $this->render = $render; } public function validate($person, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php index 7845e33e6..51b3db76f 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php @@ -23,11 +23,8 @@ use function is_object; class BirthdateValidator extends ConstraintValidator { - private $interval_spec; - - public function __construct($interval_spec = null) + public function __construct(private $interval_spec = null) { - $this->interval_spec = $interval_spec; } public function validate($value, Constraint $constraint) @@ -38,7 +35,7 @@ class BirthdateValidator extends ConstraintValidator if (!$value instanceof DateTime) { throw new LogicException('The input should a be a \DateTime interface,' - . (is_object($value) ? get_class($value) : gettype($value))); + . (get_debug_type($value))); } $limitDate = $this->getLimitDate(); diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php index 278f80962..48fab3787 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php @@ -22,12 +22,9 @@ class PersonHasCenterValidator extends ConstraintValidator { private bool $centerRequired; - private CenterResolverManagerInterface $centerResolverManager; - - public function __construct(ParameterBagInterface $parameterBag, CenterResolverManagerInterface $centerResolverManager) + public function __construct(ParameterBagInterface $parameterBag, private CenterResolverManagerInterface $centerResolverManager) { $this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required']; - $this->centerResolverManager = $centerResolverManager; } public function validate($person, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php index 10e651b56..bec92b9c0 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php @@ -20,11 +20,8 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class RelationshipNoDuplicateValidator extends ConstraintValidator { - private RelationshipRepository $relationshipRepository; - - public function __construct(RelationshipRepository $relationshipRepository) + public function __construct(private RelationshipRepository $relationshipRepository) { - $this->relationshipRepository = $relationshipRepository; } public function validate($value, Constraint $constraint) diff --git a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php index f2ea66653..0db3eb429 100644 --- a/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php +++ b/src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php @@ -39,26 +39,10 @@ use function count; */ class PersonListWidget implements WidgetInterface { - protected AuthorizationHelperInterface $authorizationHelper; - - protected EntityManagerInterface $entityManager; - - protected PersonRepository $personRepository; - - protected TokenStorageInterface $tokenStorage; - protected UserInterface $user; - public function __construct( - PersonRepository $personRepostory, - EntityManagerInterface $em, - AuthorizationHelperInterface $authorizationHelper, - TokenStorageInterface $tokenStorage - ) { - $this->personRepository = $personRepostory; - $this->authorizationHelper = $authorizationHelper; - $this->tokenStorage = $tokenStorage; - $this->entityManager = $em; + public function __construct(protected PersonRepository $personRepository, protected EntityManagerInterface $entityManager, protected AuthorizationHelperInterface $authorizationHelper, protected TokenStorageInterface $tokenStorage) + { } /** diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php index 500daab6f..c224cb166 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php @@ -21,20 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityWorkflowHandlerInterface { - private AccompanyingPeriodWorkEvaluationDocumentRepository $repository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - AccompanyingPeriodWorkEvaluationDocumentRepository $repository, - TranslatableStringHelperInterface $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->repository = $repository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + { } public function getDeletionRoles(): array diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php index db67ef045..b5869c35f 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php @@ -22,20 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowHandlerInterface { - private AccompanyingPeriodWorkEvaluationRepository $repository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - AccompanyingPeriodWorkEvaluationRepository $repository, - TranslatableStringHelperInterface $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->repository = $repository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private AccompanyingPeriodWorkEvaluationRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + { } public function getDeletionRoles(): array diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index 3cdf23f88..203fd60d2 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -23,20 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInterface { - private AccompanyingPeriodWorkRepository $repository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - AccompanyingPeriodWorkRepository $repository, - TranslatableStringHelperInterface $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->repository = $repository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private AccompanyingPeriodWorkRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + { } public function getDeletionRoles(): array diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php index da39aedec..864ad8c62 100644 --- a/src/Bundle/ChillReportBundle/Controller/ReportController.php +++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php @@ -135,7 +135,7 @@ class ReportController extends AbstractController * * @return Response The web page. */ - public function editAction($person_id, $report_id) + public function editAction(int|string $person_id, int|string $report_id) { $em = $this->getDoctrine()->getManager(); @@ -542,11 +542,10 @@ class ReportController extends AbstractController * Creates a form to create a Report entity. * * @param Report $entity The entity - * @param mixed $cFGroup * * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(Report $entity, Person $person, $cFGroup) + private function createCreateForm(Report $entity, Person $person, mixed $cFGroup) { return $this->createForm(ReportType::class, $entity, [ 'action' => $this->generateUrl( diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index db4646eed..ae35e9eac 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -168,7 +168,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or * * @return string|string[] the array of slug if multiple, a single slug otherwise */ - private function getRandomChoice(CustomField $field) + private function getRandomChoice(CustomField $field): string|array { $choices = $field->getOptions()['choices']; $multiple = $field->getOptions()['multiple']; diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index 9adae0097..dbaa1abea 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -49,12 +49,6 @@ use function uniqid; class ReportList implements ExportElementValidatedInterface, ListInterface { - protected CustomFieldProvider $customFieldProvider; - - protected CustomFieldsGroup $customfieldsGroup; - - protected EntityManagerInterface $em; - protected array $fields = [ 'person_id', 'person_firstName', 'person_lastName', 'person_birthdate', 'person_placeOfBirth', 'person_gender', 'person_memo', 'person_email', 'person_phonenumber', @@ -66,22 +60,8 @@ class ReportList implements ExportElementValidatedInterface, ListInterface protected array $slugs = []; - protected TranslatableStringHelper $translatableStringHelper; - - protected TranslatorInterface $translator; - - public function __construct( - CustomFieldsGroup $customfieldsGroup, - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator, - CustomFieldProvider $customFieldProvider, - EntityManagerInterface $em - ) { - $this->customfieldsGroup = $customfieldsGroup; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; - $this->customFieldProvider = $customFieldProvider; - $this->em = $em; + public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em) + { } public function buildForm(FormBuilderInterface $builder) @@ -102,26 +82,19 @@ class ReportList implements ExportElementValidatedInterface, ListInterface 'label' => 'Fields to include in export', 'choice_attr' => static function ($val, $key, $index) { // add a 'data-display-target' for address fields - if (substr($val, 0, 8) === 'address_') { + if (str_starts_with($val, 'address_')) { return ['data-display-target' => 'address_date']; } return []; }, - 'choice_label' => function (string $key, string $label): string { - switch (substr($key, 0, 7)) { - case 'person_': - return $this->translator->trans(substr($key, 7, strlen($key) - 7)) . - ' (' . $this->translator->trans('Person') . ')'; - - case 'report_': - return $this->translator->trans(ucfirst(substr($key, 7, strlen($key) - 7))) . - ' (' . $this->translator->trans('Report') . ')'; - - default: - return $label . - ' (' . $this->translator->trans("Report's question") . ')'; - } + 'choice_label' => fn (string $key, string $label): string => match (substr($key, 0, 7)) { + 'person_' => $this->translator->trans(substr($key, 7, strlen($key) - 7)) . + ' (' . $this->translator->trans('Person') . ')', + 'report_' => $this->translator->trans(ucfirst(substr($key, 7, strlen($key) - 7))) . + ' (' . $this->translator->trans('Report') . ')', + default => $label . + ' (' . $this->translator->trans("Report's question") . ')', }, 'constraints' => [new Callback([ 'callback' => static function ($selected, ExecutionContextInterface $context) { @@ -391,21 +364,13 @@ class ReportList implements ExportElementValidatedInterface, ListInterface $prefix = substr($f, 0, 7); $suffix = substr($f, 7); - switch ($prefix) { - case 'person_': - $qb->addSelect(sprintf('person.%s as %s', $suffix, $f)); - - break; - - case 'report_': - $qb->addSelect(sprintf('report.%s as %s', $suffix, $f)); - - break; - - default: - throw new LogicException("this prefix {$prefix} should " - . "not be encountered. Full field: {$f}"); - } + match ($prefix) { + 'person_' => $qb->addSelect(sprintf('person.%s as %s', $suffix, $f)), + 'report_' => $qb->addSelect(sprintf('report.%s as %s', $suffix, $f)), + // no break + default => throw new LogicException("this prefix {$prefix} should " + . "not be encountered. Full field: {$f}"), + }; } } @@ -470,7 +435,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface // get the field starting with address_ $addressFields = array_filter( $this->fields, - static fn (string $el): bool => substr($el, 0, 8) === 'address_' + static fn (string $el): bool => str_starts_with($el, 'address_') ); // check if there is one field starting with address in data diff --git a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php index 79bad4f52..6117d2f48 100644 --- a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php +++ b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php @@ -19,12 +19,8 @@ use Doctrine\ORM\Query\Expr; class ReportDateFilter implements FilterInterface { - private RollingDateConverterInterface $rollingDateConverter; - - public function __construct( - RollingDateConverterInterface $rollingDateConverter - ) { - $this->rollingDateConverter = $rollingDateConverter; + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { } public function addRole(): ?string diff --git a/src/Bundle/ChillReportBundle/Search/ReportSearch.php b/src/Bundle/ChillReportBundle/Search/ReportSearch.php index b08e01ee5..8fbc24e16 100644 --- a/src/Bundle/ChillReportBundle/Search/ReportSearch.php +++ b/src/Bundle/ChillReportBundle/Search/ReportSearch.php @@ -31,29 +31,16 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface { use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - /** - * @var EntityManagerInterface - */ - private $em; - - /** - * @var AuthorizationHelper - */ - private $helper; - /** * @var \Chill\MainBundle\Entity\User */ private $user; public function __construct( - EntityManagerInterface $em, - AuthorizationHelper $helper, + private EntityManagerInterface $em, + private AuthorizationHelper $helper, TokenStorageInterface $tokenStorage ) { - $this->em = $em; - $this->helper = $helper; - if (!$tokenStorage->getToken()->getUser() instanceof \Chill\MainBundle\Entity\User) { throw new RuntimeException('an user must be associated with token'); } diff --git a/src/Bundle/ChillReportBundle/Tests/Search/ReportSearchTest.php b/src/Bundle/ChillReportBundle/Tests/Search/ReportSearchTest.php index 294eccd03..dc20b1704 100644 --- a/src/Bundle/ChillReportBundle/Tests/Search/ReportSearchTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Search/ReportSearchTest.php @@ -103,11 +103,9 @@ final class ReportSearchTest extends WebTestCase } /** - * @param mixed $username - * * @return \Symfony\Component\BrowserKit\Client */ - private function getAuthenticatedClient($username = 'center a_social') + private function getAuthenticatedClient(mixed $username = 'center a_social') { return self::createClient([], [ 'PHP_AUTH_USER' => $username, diff --git a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php index 0e28fffa9..d2e856131 100644 --- a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php +++ b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php @@ -35,28 +35,8 @@ use function strtr; */ class TimelineReportProvider implements TimelineProviderInterface { - protected CustomFieldsHelper $customFieldsHelper; - - protected EntityManager $em; - - protected AuthorizationHelper $helper; - - protected bool $showEmptyValues; - - private Security $security; - - public function __construct( - EntityManager $em, - AuthorizationHelper $helper, - Security $security, - CustomFieldsHelper $customFieldsHelper, - $showEmptyValues - ) { - $this->em = $em; - $this->helper = $helper; - $this->security = $security; - $this->customFieldsHelper = $customFieldsHelper; - $this->showEmptyValues = $showEmptyValues; + public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) + { } public function fetchQuery($context, array $args) @@ -212,16 +192,11 @@ class TimelineReportProvider implements TimelineProviderInterface private function getWhereClause(string $context, array $args): array { - switch ($context) { - case 'person': - return $this->getWhereClauseForPerson($context, $args); - - case 'center': - return $this->getWhereClauseForCenter($context, $args); - - default: - throw new UnexpectedValueException("This context {$context} is not implemented"); - } + return match ($context) { + 'person' => $this->getWhereClauseForPerson($context, $args), + 'center' => $this->getWhereClauseForCenter($context, $args), + default => throw new UnexpectedValueException("This context {$context} is not implemented"), + }; } private function getWhereClauseForCenter(string $context, array $args): array diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 2ba9488b6..ec523ad43 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -47,40 +47,8 @@ use function array_merge; final class SingleTaskController extends AbstractController { - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private EventDispatcherInterface $eventDispatcher; - - private FilterOrderHelperFactoryInterface $filterOrderHelperFactory; - - private LoggerInterface $logger; - - private PaginatorFactory $paginatorFactory; - - private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository; - - private TimelineBuilder $timelineBuilder; - - private TranslatorInterface $translator; - - public function __construct( - CenterResolverDispatcherInterface $centerResolverDispatcher, - PaginatorFactory $paginatorFactory, - SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher, - TimelineBuilder $timelineBuilder, - LoggerInterface $logger, - FilterOrderHelperFactoryInterface $filterOrderHelperFactory - ) { - $this->eventDispatcher = $eventDispatcher; - $this->timelineBuilder = $timelineBuilder; - $this->logger = $logger; - $this->translator = $translator; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->paginatorFactory = $paginatorFactory; - $this->singleTaskAclAwareRepository = $singleTaskAclAwareRepository; - $this->filterOrderHelperFactory = $filterOrderHelperFactory; + public function __construct(private CenterResolverDispatcherInterface $centerResolverDispatcher, private PaginatorFactory $paginatorFactory, private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository, private TranslatorInterface $translator, private EventDispatcherInterface $eventDispatcher, private TimelineBuilder $timelineBuilder, private LoggerInterface $logger, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory) + { } /** @@ -88,10 +56,8 @@ final class SingleTaskController extends AbstractController * "/{_locale}/task/single-task/{id}/delete", * name="chill_task_single_task_delete" * ) - * - * @param mixed $id */ - public function deleteAction(Request $request, $id) + public function deleteAction(Request $request, mixed $id) { $course = null; $em = $this->getDoctrine()->getManager(); @@ -593,24 +559,19 @@ final class SingleTaskController extends AbstractController } } - switch ($entityType) { - case 'person': - return $this->render('@ChillTask/SingleTask/Person/new.html.twig', [ - 'form' => $form->createView(), - 'task' => $task, - 'person' => $task->getPerson(), - ]); - - case 'course': - return $this->render('@ChillTask/SingleTask/AccompanyingCourse/new.html.twig', [ - 'form' => $form->createView(), - 'task' => $task, - 'accompanyingCourse' => $task->getCourse(), - ]); - - default: - throw new LogicException('entity context not supported'); - } + return match ($entityType) { + 'person' => $this->render('@ChillTask/SingleTask/Person/new.html.twig', [ + 'form' => $form->createView(), + 'task' => $task, + 'person' => $task->getPerson(), + ]), + 'course' => $this->render('@ChillTask/SingleTask/AccompanyingCourse/new.html.twig', [ + 'form' => $form->createView(), + 'task' => $task, + 'accompanyingCourse' => $task->getCourse(), + ]), + default => throw new LogicException('entity context not supported'), + }; } /** @@ -687,7 +648,7 @@ final class SingleTaskController extends AbstractController * Creates a form to delete a Task entity by id. * @param mixed $id */ - private function createDeleteForm($id): FormInterface + private function createDeleteForm(mixed $id): FormInterface { return $this->createFormBuilder() ->setAction($this->generateUrl( diff --git a/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php b/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php index 1acfe0562..ac88a1d3a 100644 --- a/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php +++ b/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php @@ -30,11 +30,6 @@ class UIEvent extends Event */ protected $form; - /** - * @var string - */ - protected $kind; - /** * @var Response|null */ @@ -50,16 +45,15 @@ class UIEvent extends Event */ protected $transition; - public function __construct($kind, AbstractTask $task) + /** + * @param string $kind + */ + public function __construct(protected $kind, AbstractTask $task) { - $this->kind = $kind; $this->task = $task; } - /** - * @return FormInterface|null - */ - public function getForm() + public function getForm(): ?\Symfony\Component\Form\FormInterface { return $this->form; } diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php index 2af71810d..1fb0dda1f 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php @@ -230,11 +230,10 @@ class SingleTaskListType extends AbstractType /** * Return a list of user having a task assigned. * - * @param mixed $options * * @return User[] */ - protected function getUsersAssigneedToTask($options) + protected function getUsersAssigneedToTask(mixed $options) { $qb = $this->em->createQueryBuilder(); $user = $this->tokenStorage->getToken()->getUser(); diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php index d27a2aa06..4378696d0 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php @@ -28,20 +28,8 @@ use Symfony\Component\Security\Core\Role\Role; class SingleTaskType extends AbstractType { - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private ParameterBagInterface $parameterBag; - - private ScopeResolverDispatcher $scopeResolverDispatcher; - - public function __construct( - ParameterBagInterface $parameterBag, - CenterResolverDispatcherInterface $centerResolverDispatcher, - ScopeResolverDispatcher $scopeResolverDispatcher - ) { - $this->parameterBag = $parameterBag; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->scopeResolverDispatcher = $scopeResolverDispatcher; + public function __construct(private ParameterBagInterface $parameterBag, private CenterResolverDispatcherInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher) + { } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php index 2ecd2f5de..ef0ae2428 100644 --- a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php @@ -59,25 +59,12 @@ class MenuBuilder implements LocalMenuBuilderInterface public function buildMenu($menuId, MenuItem $menu, array $parameters) { - switch ($menuId) { - case 'person': - $this->buildPersonMenu($menu, $parameters); - - break; - - case 'accompanyingCourse': - $this->buildAccompanyingCourseMenu($menu, $parameters); - - break; - - case 'section': - $menu->setExtras('icons'); - - break; - - default: - throw new LogicException("this menuid {$menuId} is not implemented"); - } + match ($menuId) { + 'person' => $this->buildPersonMenu($menu, $parameters), + 'accompanyingCourse' => $this->buildAccompanyingCourseMenu($menu, $parameters), + 'section' => $menu->setExtras('icons'), + default => throw new LogicException("this menuid {$menuId} is not implemented"), + }; } public function buildPersonMenu($menu, $parameters) diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index 0efc16085..8c95aa9ee 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -29,24 +29,8 @@ use function substr; final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface { - private AuthorizationHelperInterface $authorizationHelper; - - private CenterResolverManagerInterface $centerResolverDispatcher; - - private EntityManagerInterface $em; - - private Security $security; - - public function __construct( - CenterResolverManagerInterface $centerResolverDispatcher, - EntityManagerInterface $em, - Security $security, - AuthorizationHelperInterface $authorizationHelper - ) { - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->em = $em; - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; + public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper) + { } public function buildBaseQuery( @@ -119,7 +103,7 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository break; - case substr($flag, 0, 6) === 'state_': + case str_starts_with($flag, 'state_'): $state = substr($flag, 6); $orXState ->add( diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index f6ae64592..eac97c8e2 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -18,16 +18,6 @@ class AuthorizationEvent extends Event { public const VOTE = 'chill_task.vote'; - /** - * @var string - */ - protected $attribute; - - /** - * @var \Chill\PersonBundle\Entity\Person|Chill\TaskBundle\Entity\AbstractTask|null - */ - protected $subject; - /** * @var TokenInterface */ @@ -38,13 +28,15 @@ class AuthorizationEvent extends Event */ protected $vote; + /** + * @param string $attribute + * @param \Chill\PersonBundle\Entity\Person|\Chill\TaskBundle\Entity\AbstractTask|null $subject + */ public function __construct( - $subject, - $attribute, + protected \Chill\PersonBundle\Entity\Person|\Chill\TaskBundle\Security\Authorization\Chill\TaskBundle\Entity\AbstractTask|null $subject, + protected $attribute, TokenInterface $token ) { - $this->subject = $subject; - $this->attribute = $attribute; $this->token = $token; } diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php index f21249453..6031f64d1 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php @@ -48,24 +48,14 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy public const UPDATE = 'CHILL_TASK_TASK_UPDATE'; - private AccessDecisionManagerInterface $accessDecisionManager; - - private EventDispatcherInterface $eventDispatcher; - - private LoggerInterface $logger; - private VoterHelperInterface $voter; public function __construct( - AccessDecisionManagerInterface $accessDecisionManager, - EventDispatcherInterface $eventDispatcher, - LoggerInterface $logger, + private AccessDecisionManagerInterface $accessDecisionManager, + private EventDispatcherInterface $eventDispatcher, + private LoggerInterface $logger, VoterHelperFactoryInterface $voterFactory ) { - $this->accessDecisionManager = $accessDecisionManager; - $this->eventDispatcher = $eventDispatcher; - $this->logger = $logger; - $this->voter = $voterFactory ->generate(AbstractTask::class) ->addCheckFor(AbstractTask::class, self::ROLES) diff --git a/src/Bundle/ChillTaskBundle/Tests/Controller/SingleTaskControllerTest.php b/src/Bundle/ChillTaskBundle/Tests/Controller/SingleTaskControllerTest.php index 2ff7092f0..80f213a92 100644 --- a/src/Bundle/ChillTaskBundle/Tests/Controller/SingleTaskControllerTest.php +++ b/src/Bundle/ChillTaskBundle/Tests/Controller/SingleTaskControllerTest.php @@ -76,11 +76,9 @@ final class SingleTaskControllerTest extends WebTestCase } /** - * @param mixed $centerName - * * @return \Chill\PersonBundle\Entity\Person */ - protected function getRandomPerson($centerName) + protected function getRandomPerson(mixed $centerName) { $em = self::$kernel ->getContainer() diff --git a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php index aa8776aa2..4efe57c7c 100644 --- a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php +++ b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php @@ -40,24 +40,8 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface { public const TYPE = 'chill_task.transition'; - protected AuthorizationHelper $authorizationHelper; - - protected EntityManagerInterface $em; - - protected Registry $registry; - - protected Security $security; - - public function __construct( - EntityManagerInterface $em, - Registry $registry, - AuthorizationHelper $authorizationHelper, - Security $security - ) { - $this->em = $em; - $this->registry = $registry; - $this->authorizationHelper = $authorizationHelper; - $this->security = $security; + public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security) + { } public function fetchQuery($context, $args) @@ -65,20 +49,11 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface $metadata = $this->em ->getClassMetadata(SingleTaskPlaceEvent::class); - switch ($context) { - case 'person': - [ $where, $parameters ] = $this->getWhereClauseForPerson($args['person']); - - break; - - case 'center': - [ $where, $parameters ] = $this->getWhereClauseForCenter($args['centers']); - - break; - - default: - throw new UnexpectedValueException("context {$context} is not supported"); - } + [ $where, $parameters ] = match ($context) { + 'person' => $this->getWhereClauseForPerson($args['person']), + 'center' => $this->getWhereClauseForCenter($args['centers']), + default => throw new UnexpectedValueException("context {$context} is not supported"), + }; return TimelineSingleQuery::fromArray([ 'id' => sprintf('%s.%s.%s', $metadata->getSchemaName(), $metadata->getTableName(), $metadata->getColumnName('id')), diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index bc7a9effd..da806a750 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -32,31 +32,16 @@ use function array_merge; final class ThirdPartyController extends CRUDController { - protected AuthorizationHelper $authorizationHelper; - - protected PaginatorFactory $paginatorFactory; - - protected RequestStack $requestStack; - - protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository; - - protected TranslatorInterface $translator; - private bool $askCenter; public function __construct( - AuthorizationHelper $authorizationHelper, - TranslatorInterface $translator, - PaginatorFactory $paginatorFactory, - RequestStack $requestStack, - ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository, + protected AuthorizationHelper $authorizationHelper, + protected TranslatorInterface $translator, + protected PaginatorFactory $paginatorFactory, + protected RequestStack $requestStack, + protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository, ParameterBagInterface $parameterBag ) { - $this->authorizationHelper = $authorizationHelper; - $this->translator = $translator; - $this->paginatorFactory = $paginatorFactory; - $this->requestStack = $requestStack; - $this->thirdPartyACLAwareRepository = $thirdPartyACLAwareRepository; $this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 09b8ba516..b8ea8126c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -88,7 +88,7 @@ use function spl_object_hash; * "thirdparty": ThirdParty::class * }) */ -class ThirdParty implements TrackCreationInterface, TrackUpdateInterface +class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Stringable { public const KIND_CHILD = 'child'; @@ -293,7 +293,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } @@ -437,10 +437,8 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * Get comment. - * - * @return string|null */ - public function getComment() + public function getComment(): ?string { return $this->comment; } @@ -488,9 +486,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface return $this->parent; } - /** - * @return string - */ public function getProfession(): string { return $this->profession; @@ -506,10 +501,8 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * Get type. - * - * @return array|null */ - public function getThirdPartyTypes() + public function getThirdPartyTypes(): ?array { return $this->thirdPartyTypes ?? []; } @@ -649,8 +642,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @param string $acronym - * - * @return $this */ public function setAcronym(?string $acronym = null): ThirdParty { @@ -701,9 +692,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface return $this; } - /** - * @return $this - */ public function setCivility(?Civility $civility): ThirdParty { $this->civility = $civility; @@ -714,11 +702,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * Set comment. * - * @param string|null $comment * * @return ThirdParty */ - public function setComment($comment = null) + public function setComment(?string $comment = null) { $this->comment = $comment; @@ -754,11 +741,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * Set email. * - * @param string|null $email * * @return ThirdParty */ - public function setEmail($email = null) + public function setEmail(?string $email = null) { $this->email = trim((string) $email); @@ -796,9 +782,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface return $this; } - /** - * @return $this - */ public function setParent(?ThirdParty $parent): ThirdParty { $this->parent = $parent; diff --git a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php index 2e7a20840..61fb03226 100644 --- a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php +++ b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php @@ -18,14 +18,8 @@ use const SORT_NUMERIC; class LabelThirdPartyHelper { - private ThirdPartyRender $thirdPartyRender; - - private ThirdPartyRepository $thirdPartyRepository; - - public function __construct(ThirdPartyRender $thirdPartyRender, ThirdPartyRepository $thirdPartyRepository) + public function __construct(private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository) { - $this->thirdPartyRender = $thirdPartyRender; - $this->thirdPartyRepository = $thirdPartyRepository; } public function getLabel(string $key, array $values, string $header): callable diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index b1446a543..91e915e09 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -38,31 +38,16 @@ use function array_key_exists; class ThirdPartyType extends AbstractType { - protected AuthorizationHelper $authorizationHelper; - - protected EntityManagerInterface $om; - - protected TokenStorageInterface $tokenStorage; - - protected TranslatableStringHelper $translatableStringHelper; - - protected ThirdPartyTypeManager $typesManager; - private bool $askCenter; public function __construct( - AuthorizationHelper $authorizationHelper, - TokenStorageInterface $tokenStorage, - ThirdPartyTypeManager $typesManager, - TranslatableStringHelper $translatableStringHelper, - EntityManagerInterface $om, + protected AuthorizationHelper $authorizationHelper, + protected TokenStorageInterface $tokenStorage, + protected ThirdPartyTypeManager $typesManager, + protected TranslatableStringHelper $translatableStringHelper, + protected EntityManagerInterface $om, ParameterBagInterface $parameterBag ) { - $this->authorizationHelper = $authorizationHelper; - $this->tokenStorage = $tokenStorage; - $this->typesManager = $typesManager; - $this->translatableStringHelper = $translatableStringHelper; - $this->om = $om; $this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php index 26cb0ae2e..a02785545 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php @@ -30,24 +30,8 @@ class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractTyp { private const PREFIX_TYPE = 'chill_3party.key_label.'; - private ThirdPartyCategoryRepository $thirdPartyCategoryRepository; - - private ThirdPartyTypeManager $thirdPartyTypeManager; - - private TranslatableStringHelper $translatableStringHelper; - - private TranslatorInterface $translator; - - public function __construct( - ThirdPartyCategoryRepository $thirdPartyCategoryRepository, - ThirdPartyTypeManager $thirdPartyTypeManager, - TranslatableStringHelper $translatableStringHelper, - TranslatorInterface $translator - ) { - $this->thirdPartyCategoryRepository = $thirdPartyCategoryRepository; - $this->thirdPartyTypeManager = $thirdPartyTypeManager; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; + public function __construct(private ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private ThirdPartyTypeManager $thirdPartyTypeManager, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php index eb9e7e5ea..8ae1702ce 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php @@ -26,17 +26,8 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickThirdpartyDynamicType extends AbstractType { - private DenormalizerInterface $denormalizer; - - private NormalizerInterface $normalizer; - - private SerializerInterface $serializer; - - public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer) + public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) { - $this->denormalizer = $denormalizer; - $this->serializer = $serializer; - $this->normalizer = $normalizer; } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php index 9200bc6ed..283622e56 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php @@ -17,17 +17,8 @@ use Symfony\Component\Security\Core\Security; final class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface { - private AuthorizationHelper $authorizationHelper; - - private Security $security; - - private ThirdPartyRepository $thirdPartyRepository; - - public function __construct(Security $security, AuthorizationHelper $authorizationHelper, ThirdPartyRepository $thirdPartyRepository) + public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository) { - $this->security = $security; - $this->authorizationHelper = $authorizationHelper; - $this->thirdPartyRepository = $thirdPartyRepository; } public function buildQuery(?string $filterString = null): QueryBuilder diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 86c0fa9db..8b0a26849 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -49,11 +49,8 @@ FROM rows, searches */ class ThirdPartyApiSearch implements SearchApiInterface { - private ThirdPartyRepository $thirdPartyRepository; - - public function __construct(ThirdPartyRepository $thirdPartyRepository) + public function __construct(private ThirdPartyRepository $thirdPartyRepository) { - $this->thirdPartyRepository = $thirdPartyRepository; } public function getResult(string $key, array $metadata, float $pertinence) diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php index 2c7948a2d..0421d0f34 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php @@ -48,20 +48,17 @@ class ThirdPartySearch implements SearchInterface */ protected $tokenStorage; - private ThirdPartyRepository $thirdPartyRepository; - public function __construct( EntityManagerInterface $em, TokenStorageInterface $tokenStorage, AuthorizationHelper $authorizationHelper, PaginatorFactory $paginatorFactory, - ThirdPartyRepository $thirdPartyRepository + private ThirdPartyRepository $thirdPartyRepository ) { $this->em = $em; $this->tokenStorage = $tokenStorage; $this->authorizationHelper = $authorizationHelper; $this->paginatorFactory = $paginatorFactory; - $this->thirdPartyRepository = $thirdPartyRepository; } public function getOrder(): int diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index 7b2721511..b3f898a76 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -24,16 +24,8 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf { use NormalizerAwareTrait; - private ThirdPartyRender $thirdPartyRender; - - private TranslatableStringHelperInterface $translatableStringHelper; - - public function __construct( - ThirdPartyRender $thirdPartyRender, - TranslatableStringHelperInterface $translatableStringHelper - ) { - $this->thirdPartyRender = $thirdPartyRender; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(private ThirdPartyRender $thirdPartyRender, private TranslatableStringHelperInterface $translatableStringHelper) + { } public function normalize($thirdParty, $format = null, array $context = []) diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index ece12f5c9..4432c5045 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -24,16 +24,9 @@ use Symfony\Component\Templating\EngineInterface; class ThirdPartyRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - protected EngineInterface $engine; - protected TranslatableStringHelper $translatableStringHelper; - - public function __construct( - EngineInterface $engine, - TranslatableStringHelper $translatableStringHelper - ) { - $this->engine = $engine; - $this->translatableStringHelper = $translatableStringHelper; + public function __construct(protected EngineInterface $engine, protected TranslatableStringHelper $translatableStringHelper) + { } public function renderBox($entity, array $options): string diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php index b3697aafd..d7e90e46a 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php @@ -37,32 +37,17 @@ class Convert private string $collaboraDomain; - private HttpClientInterface $httpClient; - - private LoggerInterface $logger; - - private RequestStack $requestStack; - - private Security $security; - - private StoredObjectManagerInterface $storedObjectManager; - /** * @param StoredObjectManager $storedObjectManager */ public function __construct( - HttpClientInterface $httpClient, - RequestStack $requestStack, - Security $security, - StoredObjectManagerInterface $storedObjectManager, - LoggerInterface $logger, + private HttpClientInterface $httpClient, + private RequestStack $requestStack, + private Security $security, + private StoredObjectManagerInterface $storedObjectManager, + private LoggerInterface $logger, ParameterBagInterface $parameters ) { - $this->httpClient = $httpClient; - $this->requestStack = $requestStack; - $this->security = $security; - $this->storedObjectManager = $storedObjectManager; - $this->logger = $logger; $this->collaboraDomain = $parameters->get('wopi')['server']; } diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php index ab4276ec4..ec10cc973 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php @@ -38,48 +38,8 @@ use Twig\Environment; */ final class Editor { - private DocumentManagerInterface $documentManager; - - private EngineInterface $engine; - - private JWTTokenManagerInterface $JWTTokenManager; - - private Psr17Interface $psr17; - - private ResponderInterface $responder; - - private RouterInterface $router; - - private Security $security; - - private ConfigurationInterface $wopiConfiguration; - - private DiscoveryInterface $wopiDiscovery; - - private NormalizerInterface $normalizer; - - public function __construct( - ConfigurationInterface $wopiConfiguration, - DiscoveryInterface $wopiDiscovery, - DocumentManagerInterface $documentManager, - EngineInterface $engine, - JWTTokenManagerInterface $JWTTokenManager, - NormalizerInterface $normalizer, - ResponderInterface $responder, - Security $security, - Psr17Interface $psr17, - RouterInterface $router - ) { - $this->documentManager = $documentManager; - $this->engine = $engine; - $this->JWTTokenManager = $JWTTokenManager; - $this->normalizer = $normalizer; - $this->wopiConfiguration = $wopiConfiguration; - $this->wopiDiscovery = $wopiDiscovery; - $this->responder = $responder; - $this->security = $security; - $this->psr17 = $psr17; - $this->router = $router; + public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private EngineInterface $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) + { } public function __invoke(string $fileId, Request $request): Response diff --git a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php index 78033e111..af22cf952 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php @@ -22,20 +22,8 @@ use Twig\Environment; final class Responder implements ResponderInterface { - private SerializerInterface $serializer; - - private Environment $twig; - - private UrlGeneratorInterface $urlGenerator; - - public function __construct( - Environment $twig, - UrlGeneratorInterface $urlGenerator, - SerializerInterface $serializer - ) { - $this->twig = $twig; - $this->urlGenerator = $urlGenerator; - $this->serializer = $serializer; + public function __construct(private Environment $twig, private UrlGeneratorInterface $urlGenerator, private SerializerInterface $serializer) + { } public function file( diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php index 24ea00982..08cdec97e 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php @@ -19,14 +19,8 @@ use Symfony\Component\Security\Core\Security; class AuthorizationManager implements \ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface { - private Security $security; - - private JWTTokenManagerInterface $tokenManager; - - public function __construct(JWTTokenManagerInterface $tokenManager, Security $security) + public function __construct(private JWTTokenManagerInterface $tokenManager, private Security $security) { - $this->tokenManager = $tokenManager; - $this->security = $security; } public function isRestrictedWebViewOnly(string $accessToken, Document $document, RequestInterface $request): bool diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php index fce25de58..358831f87 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php @@ -26,11 +26,8 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface */ private const LOCK_GRACEFUL_DURATION_TIME = 3; - private ChillRedis $redis; - - public function __construct(ChillRedis $redis) + public function __construct(private ChillRedis $redis) { - $this->redis = $redis; } public function deleteLock(Document $document, RequestInterface $request): bool diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php index ce75cafa8..6084d4785 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php @@ -34,33 +34,18 @@ use function strlen; final class ChillDocumentManager implements DocumentManagerInterface { - private DocumentLockManagerInterface $documentLockManager; - - private EntityManagerInterface $entityManager; - - private Psr17Interface $psr17; - private RequestInterface $request; - private StoredObjectManagerInterface $storedObjectManager; - - private StoredObjectRepository $storedObjectRepository; - public function __construct( - DocumentLockManagerInterface $documentLockManager, - EntityManagerInterface $entityManager, + private DocumentLockManagerInterface $documentLockManager, + private EntityManagerInterface $entityManager, HttpMessageFactoryInterface $httpMessageFactory, - Psr17Interface $psr17, + private Psr17Interface $psr17, RequestStack $requestStack, - StoredObjectManagerInterface $storedObjectManager, - StoredObjectRepository $storedObjectRepository + private StoredObjectManagerInterface $storedObjectManager, + private StoredObjectRepository $storedObjectRepository ) { - $this->documentLockManager = $documentLockManager; - $this->entityManager = $entityManager; - $this->psr17 = $psr17; $this->request = $httpMessageFactory->createRequest($requestStack->getCurrentRequest()); - $this->storedObjectManager = $storedObjectManager; - $this->storedObjectRepository = $storedObjectRepository; } public function create(array $data): Document diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php index 82dbadf7b..88f863cd1 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php @@ -17,12 +17,8 @@ use Psr\Http\Message\ResponseInterface; final class ChillWopi implements WopiInterface { - private WopiInterface $wopi; - - public function __construct( - WopiInterface $wopi - ) { - $this->wopi = $wopi; + public function __construct(private WopiInterface $wopi) + { } public function checkFileInfo( diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php index 3fb3b544e..96ed5c651 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php @@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security; class UserManager implements \ChampsLibres\WopiBundle\Contracts\UserManagerInterface { - private Security $security; - - public function __construct(Security $security) + public function __construct(private Security $security) { - $this->security = $security; } public function getUserFriendlyName(string $accessToken, string $fileId, RequestInterface $request): ?string From 9027cbd196b4988cb058a07805c90bbf49f14808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 17 Apr 2023 15:25:09 +0200 Subject: [PATCH 003/750] DX: rector config: up to PHP8 [ci-skip][wip] --- rector.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/rector.php b/rector.php index ec9a0c684..5e304c8b4 100644 --- a/rector.php +++ b/rector.php @@ -21,7 +21,7 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_74 + LevelSetList::UP_TO_PHP_80 ]); // skip some path... @@ -36,25 +36,25 @@ return static function (RectorConfig $rectorConfig): void { \Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class, // remove all PHP80 rules, in order to activate them one by one - \Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class, - \Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, - \Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class, - \Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class, - \Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector::class, - \Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class, - \Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector::class, - \Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class, - \Rector\Php80\Rector\Ternary\GetDebugTypeRector::class, - \Rector\Php80\Rector\FunctionLike\MixedTypeRector::class, - \Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector::class, - \Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class, - \Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class, - \Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class, - \Rector\Php80\Rector\NotIdentical\StrContainsRector::class, - \Rector\Php80\Rector\Identical\StrEndsWithRector::class, - \Rector\Php80\Rector\Identical\StrStartsWithRector::class, - \Rector\Php80\Rector\Class_\StringableForToStringRector::class, - \Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class, - \Rector\Php80\Rector\FunctionLike\UnionTypesRector::class +// \Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class, +// \Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, +// \Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class, +// \Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class, +// \Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector::class, +// \Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class, +// \Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector::class, +// \Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class, +// \Rector\Php80\Rector\Ternary\GetDebugTypeRector::class, +// \Rector\Php80\Rector\FunctionLike\MixedTypeRector::class, +// \Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector::class, +// \Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class, +// \Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class, +// \Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class, +// \Rector\Php80\Rector\NotIdentical\StrContainsRector::class, +// \Rector\Php80\Rector\Identical\StrEndsWithRector::class, +// \Rector\Php80\Rector\Identical\StrStartsWithRector::class, +// \Rector\Php80\Rector\Class_\StringableForToStringRector::class, +// \Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class, +// \Rector\Php80\Rector\FunctionLike\UnionTypesRector::class ]); }; From c35994203d7022c215b3b897ebb7ae0ec60c5285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Apr 2023 22:55:01 +0200 Subject: [PATCH 004/750] fix phpstan issues --- .../Export/Export/ListActivityHelper.php | 1 - .../Controller/CustomFieldController.php | 3 --- .../CustomFields/CustomFieldLongChoice.php | 9 ++++++-- .../CRUD/Controller/ApiController.php | 2 ++ .../Authorization/AuthorizationHelper.php | 4 ++-- .../PasswordRecover/PasswordRecoverEvent.php | 22 +++++-------------- .../RollingDate/RollingDateConverter.php | 1 - .../Form/ChoiceLoader/PersonChoiceLoader.php | 5 ----- .../DataFixtures/ORM/LoadReports.php | 2 ++ .../Authorization/AuthorizationEvent.php | 18 +++++---------- 10 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index 5af351b28..43c9f4688 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -113,7 +113,6 @@ class ListActivityHelper 'usersIds' => self::MSG_KEY . 'users ids', 'thirdPartiesIds' => self::MSG_KEY . 'third parties ids', 'personsIds' => self::MSG_KEY . 'persons ids', - default => throw new LogicException('key not supported'), }; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index bc7bcfd65..a188ed277 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -162,9 +162,6 @@ class CustomFieldController extends AbstractController /** * Creates a form to create a CustomField entity. * - * @param CustomField $entity The entity - * @param string - * * @return \Symfony\Component\Form\Form The form */ private function createCreateForm(CustomField $entity, mixed $type) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 23f7b36bb..aa73af462 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -15,6 +15,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField; use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option; use Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository; use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer; +use Chill\FamilyMembersBundle\Templating\Twig; use Chill\MainBundle\Form\Type\Select2ChoiceType; use Chill\MainBundle\Templating\TranslatableStringHelper; use LogicException; @@ -22,6 +23,7 @@ use Symfony\Bridge\Twig\TwigEngine; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Templating\EngineInterface; use function get_class; use function gettype; use function is_object; @@ -30,8 +32,11 @@ class CustomFieldLongChoice extends AbstractCustomField { public const KEY = 'key'; - public function __construct(private OptionRepository $optionRepository, private TranslatableStringHelper $translatableStringHelper, private TwigEngine $templating) - { + public function __construct( + private OptionRepository $optionRepository, + private TranslatableStringHelper $translatableStringHelper, + private EngineInterface $templating, + ) { } public function buildForm(FormBuilderInterface $builder, CustomField $customField) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index c18dfd542..41a37d7ca 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -258,7 +258,9 @@ class ApiController extends AbstractCRUDController } match ($request->getMethod()) { + /* @phpstan-ignore-next-line */ Request::METHOD_DELETE => $entity->{'remove' . ucfirst($property)}($postedData), + /* @phpstan-ignore-next-line */ Request::METHOD_POST => $entity->{'add' . ucfirst($property)}($postedData), default => throw new BadRequestHttpException('this method is not supported'), }; diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index 2ba3865b7..c431c4492 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -209,9 +209,9 @@ class AuthorizationHelper implements AuthorizationHelperInterface throw new UnexpectedValueException( sprintf( - 'The entity given is not an instance of %s, %s given', + 'The entity given is not an instance of %s or an array of centers, %s given', Center::class, - $center::class + gettype($center) ) ); } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php index 8bc23b54a..5c8a01e1d 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php @@ -23,25 +23,15 @@ class PasswordRecoverEvent extends Event public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token'; /** - * @var bool - */ - protected $safelyGenerated; - - /** - * @var User - */ - protected $user; - - /** - * @param type $token - * @param User $user - * @param type $ip * @param bool $safelyGenerated true if generated safely (from console command, etc.) */ - public function __construct(protected $token = null, ?User $user = null, protected $ip = null, bool $safelyGenerated = false) + public function __construct( + private ?string $token = null, + private ?User $user = null, + private $ip = null, + private bool $safelyGenerated = false, + ) { - $this->user = $user; - $this->safelyGenerated = $safelyGenerated; } public function getIp() diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php index 0b9d5e4cd..da59e9e2b 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDateConverter.php @@ -87,7 +87,6 @@ class RollingDateConverter implements RollingDateConverterInterface 4, 5, 6 => '04', 7, 8, 9 => '07', 10, 11, 12 => '10', - default => throw new LogicException('this month is not valid: ' . $date->format('n')), }; return DateTimeImmutable::createFromFormat( diff --git a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php index 05e720243..684914618 100644 --- a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php +++ b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php @@ -30,11 +30,6 @@ class PersonChoiceLoader implements ChoiceLoaderInterface protected array $lazyLoadedPersons = []; - /** - * PersonChoiceLoader constructor. - * - * @param EntityRepository $personRepository - */ public function __construct( protected PersonRepository $personRepository, ?array $centers = null diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index ae35e9eac..2dcf69c50 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -211,6 +211,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or return $result; } } + + throw new \LogicException("should not happens"); } /** diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index eac97c8e2..1607ec56c 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -11,6 +11,8 @@ declare(strict_types=1); namespace Chill\TaskBundle\Security\Authorization; +use Chill\PersonBundle\Entity\Person; +use Chill\TaskBundle\Entity\AbstractTask; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; @@ -18,26 +20,16 @@ class AuthorizationEvent extends Event { public const VOTE = 'chill_task.vote'; - /** - * @var TokenInterface - */ - protected $token; - /** * @var bool */ protected $vote; - /** - * @param string $attribute - * @param \Chill\PersonBundle\Entity\Person|\Chill\TaskBundle\Entity\AbstractTask|null $subject - */ public function __construct( - protected \Chill\PersonBundle\Entity\Person|\Chill\TaskBundle\Security\Authorization\Chill\TaskBundle\Entity\AbstractTask|null $subject, - protected $attribute, - TokenInterface $token + private Person|AbstractTask|null $subject, + private string $attribute, + private TokenInterface $token ) { - $this->token = $token; } public function getAttribute() From 7e194198616f08670202002c7c8a3842d86e3351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Apr 2023 23:03:36 +0200 Subject: [PATCH 005/750] fixes for last rebase and fixes for runtime --- .../CustomFieldsGroupController.php | 4 +-- .../Config/ConfigRepository.php | 4 +-- .../Controller/FamilyMemberController.php | 11 ++---- .../ChillMainExtension.php | 2 +- .../ChillMainBundle/Notification/Mailer.php | 34 ++----------------- .../PasswordRecover/RecoverPasswordHelper.php | 22 ++---------- .../Resolver/ScopeResolverDispatcher.php | 2 +- .../Controller/SingleTaskController.php | 1 - 8 files changed, 11 insertions(+), 69 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 68ccb9904..2ae552b01 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -36,7 +36,7 @@ class CustomFieldsGroupController extends AbstractController /** * CustomFieldsGroupController constructor. */ - public function __construct(private CustomFieldProvider $customfieldProvider, private TranslatorInterface $translator) + public function __construct(private CustomFieldProvider $customFieldProvider, private TranslatorInterface $translator) { } @@ -283,7 +283,7 @@ class CustomFieldsGroupController extends AbstractController { $fieldChoices = []; - foreach ($this->customfieldProvider->getAllFields() + foreach ($this->customFieldProvider->getAllFields() as $key => $customType) { $fieldChoices[$key] = $customType->getName(); } diff --git a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php index c361984f0..7fc9c6c47 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php +++ b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php @@ -27,10 +27,8 @@ class ConfigRepository /** * @param mixed[] $links - * @param mixed $professionnalSituations - * @param mixed $familialSituations */ - public function __construct(protected $links, $professionnalSituations, $familialSituations) + public function __construct(protected $links, mixed $professionnalSituations, mixed $familialSituations) { $this->professionalSituations = $professionnalSituations ?? []; $this->familialSituations = $familialSituations ?? []; diff --git a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php index 5892ddbc4..34a83dfcb 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php +++ b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php @@ -28,15 +28,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class FamilyMemberController extends AbstractController { - private FamilyMemberRepository $familyMemberRepository; - - public function __construct( - private EntityManagerInterface $em, - protected TranslatorInterface $translator, - protected LoggerInterface $chillMainLogger, - FamilyMemberRepository $familyMemberRepository - ) { - $this->familyMemberRepository = $familyMemberRepository; + public function __construct(private EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger, private FamilyMemberRepository $familyMemberRepository) + { } /** diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 2da35e7ef..dd74b2c09 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -93,7 +93,7 @@ class ChillMainExtension extends Extension implements $this->widgetFactories[] = $factory; } - public function getConfiguration(array $config, ContainerBuilder $container): \Chill\MainBundle\DependencyInjection\Configuration|object|\Symfony\Component\Config\Definition\ConfigurationInterface|null + public function getConfiguration(array $config, ContainerBuilder $container): \Chill\MainBundle\DependencyInjection\Configuration { return new Configuration($this->widgetFactories, $container); } diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index d0a449787..b65d29c8d 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -34,44 +34,14 @@ use function call_user_func; */ class Mailer { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var RouterInterface - */ - private $router; - - /** - * @var TranslatorInterface - */ - private $translator; - - private EngineInterface $twig; - - private MailerInterface $mailer; - /** * Mailer constructor. * * @param $routeParameters * @param mixed[] $routeParameters */ - public function __construct( - MailerInterface $mailer, - LoggerInterface $logger, - EngineInterface $twig, - RouterInterface $router, - TranslatorInterface $translator, - protected $routeParameters - ) { - $this->logger = $logger; - $this->twig = $twig; - $this->mailer = $mailer; - $this->router = $router; - $this->translator = $translator; + public function __construct(private MailerInterface $mailer, private LoggerInterface $logger, private EngineInterface $twig, private RouterInterface $router, private TranslatorInterface $translator, protected $routeParameters) + { } /** diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php index 42881e291..4598f6199 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php @@ -24,26 +24,8 @@ class RecoverPasswordHelper { public const RECOVER_PASSWORD_ROUTE = 'password_recover'; - private MailerInterface $mailer; - - /** - * @var TokenManager - */ - private $tokenManager; - - /** - * @var UrlGeneratorInterface - */ - private $urlGenerator; - - public function __construct( - TokenManager $tokenManager, - UrlGeneratorInterface $urlGenerator, - MailerInterface $mailer, - ) { - $this->tokenManager = $tokenManager; - $this->urlGenerator = $urlGenerator; - $this->mailer = $mailer; + public function __construct(private TokenManager $tokenManager, private UrlGeneratorInterface $urlGenerator, private MailerInterface $mailer) + { } /** diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index 1c40ad282..151754ae7 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -39,7 +39,7 @@ final class ScopeResolverDispatcher * * @return iterable|Scope|Scope[] */ - public function resolveScope($entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|array + public function resolveScope($entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope { foreach ($this->resolvers as $resolver) { if ($resolver->supports($entity, $options)) { diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index ec523ad43..a1085657a 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -646,7 +646,6 @@ final class SingleTaskController extends AbstractController /** * Creates a form to delete a Task entity by id. - * @param mixed $id */ private function createDeleteForm(mixed $id): FormInterface { From 24c33b306b5c01c654e71b91d1e078717555d9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Apr 2023 23:16:13 +0200 Subject: [PATCH 006/750] Fix: urgent fix for EntityToJsonTransformer The throw on error flag imposes us to propose a valid json string for decoding --- .../Form/Type/DataTransformer/EntityToJsonTransformer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php index 109e83b14..9ab91222c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -31,6 +31,10 @@ class EntityToJsonTransformer implements DataTransformerInterface public function reverseTransform($value) { + if ("" === $value) { + return null; + } + $denormalized = json_decode($value, true, 512, JSON_THROW_ON_ERROR); if ($this->multiple) { @@ -44,10 +48,6 @@ class EntityToJsonTransformer implements DataTransformerInterface ); } - if ('' === $value) { - return null; - } - return $this->denormalizeOne($denormalized); } From 1c7d90a6efbc1a099d6dc5a0df369fbcc44f629d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Apr 2023 23:17:41 +0200 Subject: [PATCH 007/750] fixes from a first test --- .../CustomFields/CustomFieldChoice.php | 8 +------- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- .../Security/Authorization/AuthorizationEvent.php | 3 ++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 88ef15e3e..8add4b995 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -370,14 +370,8 @@ 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. - * - * @param array|string $value - * - * @throws LogicException if the case is not covered by this - * - * @return mixed */ - private function guessValue(array|string $value) + private function guessValue(array|string|null $value) { if (null === $value) { return null; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 15970471a..f4c36e7b7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -952,7 +952,7 @@ class AccompanyingPeriod implements /** * @Groups({"read"}) */ - public function getRequestor(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty + public function getRequestor(): Person|ThirdParty|null { return $this->requestorPerson ?? $this->requestorThirdParty; } diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index 1607ec56c..d7ccc0db9 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\TaskBundle\Security\Authorization; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; use Chill\TaskBundle\Entity\AbstractTask; use Symfony\Component\EventDispatcher\Event; @@ -26,7 +27,7 @@ class AuthorizationEvent extends Event protected $vote; public function __construct( - private Person|AbstractTask|null $subject, + private Person|AbstractTask|AccompanyingPeriod|null $subject, private string $attribute, private TokenInterface $token ) { From 07c681fcec5df8c4065e7b48aff389b6e198825f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Apr 2023 23:19:05 +0200 Subject: [PATCH 008/750] DX: update rector config --- rector.php | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/rector.php b/rector.php index 5e304c8b4..55de05fcd 100644 --- a/rector.php +++ b/rector.php @@ -34,27 +34,5 @@ return static function (RectorConfig $rectorConfig): void { // must merge MR500 and review a typing of "ArrayCollection" in entities \Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class, - - // remove all PHP80 rules, in order to activate them one by one -// \Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class, -// \Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, -// \Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class, -// \Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class, -// \Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector::class, -// \Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class, -// \Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector::class, -// \Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class, -// \Rector\Php80\Rector\Ternary\GetDebugTypeRector::class, -// \Rector\Php80\Rector\FunctionLike\MixedTypeRector::class, -// \Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector::class, -// \Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class, -// \Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class, -// \Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class, -// \Rector\Php80\Rector\NotIdentical\StrContainsRector::class, -// \Rector\Php80\Rector\Identical\StrEndsWithRector::class, -// \Rector\Php80\Rector\Identical\StrStartsWithRector::class, -// \Rector\Php80\Rector\Class_\StringableForToStringRector::class, -// \Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class, -// \Rector\Php80\Rector\FunctionLike\UnionTypesRector::class ]); }; From 737f5f927510fb550a34a2c509ee4d1f2e5c58b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 1 May 2023 21:22:56 +0200 Subject: [PATCH 009/750] fixes --- .../Controller/ActivityController.php | 18 ++++++++++++- .../Entity/ActivityReason.php | 27 ++++--------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3ea61c0cf..69d3f3312 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -47,7 +47,23 @@ use function array_key_exists; final class ActivityController extends AbstractController { - public function __construct(private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private ActivityTypeCategoryRepository $activityTypeCategoryRepository, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private LocationRepository $locationRepository, private ActivityRepository $activityRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private EntityManagerInterface $entityManager, private EventDispatcherInterface $eventDispatcher, private LoggerInterface $logger, private SerializerInterface $serializer, private UserRepositoryInterface $userRepository, private CenterResolverManagerInterface $centerResolver, private TranslatorInterface $translator) + public function __construct( + private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, + private ActivityTypeRepositoryInterface $activityTypeRepository, + private ActivityTypeCategoryRepository $activityTypeCategoryRepository, + private PersonRepository $personRepository, + private ThirdPartyRepository $thirdPartyRepository, + private LocationRepository $locationRepository, + private ActivityRepository $activityRepository, + private AccompanyingPeriodRepository $accompanyingPeriodRepository, + private EntityManagerInterface $entityManager, + private EventDispatcherInterface $eventDispatcher, + private LoggerInterface $logger, + private SerializerInterface $serializer, + private UserRepositoryInterface $userRepository, + private CenterResolverManagerInterface $centerResolver, + private TranslatorInterface $translator, + ) { } diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index 9d1e88409..99504f469 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM; class ActivityReason { /** - * @var bool * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @var ActivityReasonCategory @@ -34,7 +33,7 @@ class ActivityReason * targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory", * inversedBy="reasons") */ - private $category; + private ?ActivityReasonCategory $category = null; /** * @var int @@ -43,13 +42,13 @@ class ActivityReason * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ - private $id; + private ?int $id = null; /** * @var array * @ORM\Column(type="json") */ - private $name; + private array $name; /** * Get active. @@ -81,25 +80,9 @@ class ActivityReason /** * Get name. - * - * @param mixed|null $locale */ - public function getName($locale = null): array|string + public function getName(): array { - if ($locale) { - if (isset($this->name[$locale])) { - return $this->name[$locale]; - } - - foreach ($this->name as $name) { - if (!empty($name)) { - return $name; - } - } - - return ''; - } - return $this->name; } From 81e8928344511f9e27b6d3dbd360620c6857e5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 1 May 2023 21:39:27 +0200 Subject: [PATCH 010/750] DX: configure rector up to php82 --- rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rector.php b/rector.php index 55de05fcd..00147e460 100644 --- a/rector.php +++ b/rector.php @@ -21,7 +21,7 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80 + LevelSetList::UP_TO_PHP_82 ]); // skip some path... From 6d63177ff4769fb60c5bf5ec85f283498536477c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 1 May 2023 21:39:45 +0200 Subject: [PATCH 011/750] apply rules rector up to php82 --- .../widgets/ChillMainConfiguration.php | 2 +- .../Controller/ActivityController.php | 33 +++++++-------- .../Controller/ActivityReasonController.php | 2 +- .../DataFixtures/ORM/LoadActivity.php | 2 +- .../ChillActivityBundle/Entity/Activity.php | 4 +- .../Entity/ActivityType.php | 6 +-- .../EntityListener/ActivityEntityListener.php | 2 +- .../ACPAggregators/ByCreatorAggregator.php | 2 +- .../BySocialActionAggregator.php | 2 +- .../BySocialIssueAggregator.php | 2 +- .../ACPAggregators/ByThirdpartyAggregator.php | 2 +- .../ACPAggregators/CreatorScopeAggregator.php | 2 +- .../ACPAggregators/DateAggregator.php | 2 +- .../ACPAggregators/LocationTypeAggregator.php | 2 +- .../Aggregator/ActivityTypeAggregator.php | 2 +- .../Aggregator/ActivityUserAggregator.php | 4 +- .../Aggregator/ActivityUsersAggregator.php | 2 +- .../Aggregator/ActivityUsersJobAggregator.php | 2 +- .../ActivityUsersScopeAggregator.php | 2 +- .../Aggregator/SentReceivedAggregator.php | 2 +- .../Export/Declarations.php | 6 +-- .../Export/LinkedToACP/ListActivity.php | 2 +- .../Export/LinkedToPerson/ListActivity.php | 2 +- .../LinkedToPerson/StatActivityDuration.php | 4 +- .../Export/Export/ListActivityHelper.php | 4 +- .../Filter/ACPFilters/ActivityTypeFilter.php | 2 +- .../Filter/ACPFilters/ByCreatorFilter.php | 2 +- .../ACPFilters/BySocialActionFilter.php | 2 +- .../Filter/ACPFilters/BySocialIssueFilter.php | 2 +- .../Filter/ACPFilters/EmergencyFilter.php | 2 +- .../Filter/ACPFilters/LocationTypeFilter.php | 2 +- .../Filter/ACPFilters/SentReceivedFilter.php | 2 +- .../Export/Filter/ACPFilters/UserFilter.php | 2 +- .../Filter/ACPFilters/UserScopeFilter.php | 2 +- .../Export/Filter/ActivityDateFilter.php | 2 +- .../Export/Filter/ActivityUsersFilter.php | 2 +- .../Export/Filter/UsersJobFilter.php | 2 +- .../Export/Filter/UsersScopeFilter.php | 2 +- .../Form/ActivityTypeType.php | 2 +- .../Form/Type/PickActivityReasonType.php | 2 +- ...TranslatableActivityReasonCategoryType.php | 2 +- .../Menu/AdminMenuBuilder.php | 2 +- .../ActivityNotificationHandler.php | 2 +- .../Repository/ActivityACLAwareRepository.php | 2 +- .../Repository/ActivityPresenceRepository.php | 2 +- .../Repository/ActivityReasonRepository.php | 2 +- .../Repository/ActivityTypeRepository.php | 2 +- .../Authorization/ActivityStatsVoter.php | 4 +- .../Security/Authorization/ActivityVoter.php | 16 +++---- .../Service/DocGenerator/ActivityContext.php | 2 +- ...tActivitiesByAccompanyingPeriodContext.php | 2 +- .../Controller/ActivityControllerTest.php | 2 +- .../ActivityReasonCategoryControllerTest.php | 2 +- .../ActivityReasonControllerTest.php | 2 +- .../Controller/ActivityTypeControllerTest.php | 2 +- .../Type/TranslatableActivityReasonTest.php | 2 +- .../Tests/Timeline/TimelineProviderTest.php | 2 +- .../Constraints/ActivityValidity.php | 4 +- .../Controller/AsideActivityController.php | 2 +- .../DataFixtures/ORM/LoadAsideActivity.php | 2 +- .../Aggregator/ByActivityTypeAggregator.php | 2 +- .../Export/Aggregator/ByUserJobAggregator.php | 2 +- .../Aggregator/ByUserScopeAggregator.php | 2 +- .../src/Export/Declarations.php | 2 +- .../Export/AvgAsideActivityDuration.php | 2 +- .../src/Export/Export/CountAsideActivity.php | 2 +- .../src/Export/Export/ListAsideActivity.php | 2 +- .../Export/SumAsideActivityDuration.php | 2 +- .../Export/Filter/ByActivityTypeFilter.php | 2 +- .../src/Export/Filter/ByDateFilter.php | 2 +- .../src/Export/Filter/ByUserFilter.php | 2 +- .../src/Export/Filter/ByUserJobFilter.php | 2 +- .../src/Export/Filter/ByUserScopeFilter.php | 2 +- .../src/Form/AsideActivityCategoryType.php | 2 +- .../src/Form/AsideActivityFormType.php | 10 +---- .../Type/PickAsideActivityCategoryType.php | 2 +- .../src/Menu/AdminMenuBuilder.php | 2 +- .../AsideActivityCategoryRepository.php | 2 +- .../src/Security/AsideActivityVoter.php | 4 +- .../src/Templating/Entity/CategoryRender.php | 2 +- .../Calculator/CalculatorResult.php | 6 +-- .../Controller/ElementController.php | 2 +- .../ChillBudgetBundle/Entity/Charge.php | 10 ++--- .../ChillBudgetBundle/Form/ChargeType.php | 2 +- .../ChillBudgetBundle/Form/ResourceType.php | 2 +- .../Menu/AdminMenuBuilder.php | 2 +- .../Repository/ChargeKindRepository.php | 2 +- .../Repository/ResourceKindRepository.php | 2 +- .../Authorization/BudgetElementVoter.php | 10 ++--- .../Service/Summary/SummaryBudget.php | 2 +- .../Templating/BudgetElementTypeRender.php | 2 +- .../Service/Summary/SummaryBudgetTest.php | 4 +- .../AzureGrantAdminConsentAndAcquireToken.php | 2 +- .../MapAndSubscribeUserCalendarCommand.php | 10 ++--- .../SendShortMessageOnEligibleCalendar.php | 2 +- .../SendTestShortMessageOnCalendarCommand.php | 12 +++--- .../Controller/CalendarAPIController.php | 2 +- .../Controller/CalendarController.php | 2 +- .../Controller/CalendarDocController.php | 4 +- .../Controller/CalendarRangeAPIController.php | 2 +- .../Controller/InviteApiController.php | 2 +- .../RemoteCalendarConnectAzureController.php | 2 +- .../RemoteCalendarMSGraphSyncController.php | 2 +- .../RemoteCalendarProxyController.php | 2 +- .../DataFixtures/ORM/LoadCalendarRange.php | 2 +- .../ChillCalendarBundle/Entity/Calendar.php | 12 +++--- .../Entity/CancelReason.php | 6 +-- .../ChillCalendarBundle/Entity/Invite.php | 10 ++--- .../Event/ListenToActivityCreate.php | 2 +- .../Export/Aggregator/AgentAggregator.php | 2 +- .../Aggregator/CancelReasonAggregator.php | 2 +- .../Export/Aggregator/JobAggregator.php | 2 +- .../Export/Aggregator/LocationAggregator.php | 2 +- .../Aggregator/LocationTypeAggregator.php | 2 +- .../Export/Aggregator/ScopeAggregator.php | 2 +- .../Export/Aggregator/UrgencyAggregator.php | 2 +- .../Export/Declarations.php | 2 +- .../Export/Export/CountCalendars.php | 2 +- .../Export/Export/StatCalendarAvgDuration.php | 2 +- .../Export/Export/StatCalendarSumDuration.php | 2 +- .../Export/Filter/AgentFilter.php | 2 +- .../Export/Filter/BetweenDatesFilter.php | 2 +- .../Export/Filter/CalendarRangeFilter.php | 2 +- .../Export/Filter/JobFilter.php | 2 +- .../Export/Filter/ScopeFilter.php | 2 +- .../ChillCalendarBundle/Form/CalendarType.php | 2 +- .../Menu/AccompanyingCourseMenuBuilder.php | 2 +- .../Menu/PersonMenuBuilder.php | 2 +- .../Menu/UserMenuBuilder.php | 2 +- .../Doctrine/CalendarEntityListener.php | 2 +- .../Doctrine/CalendarRangeEntityListener.php | 2 +- .../CalendarRangeRemoveToRemoteHandler.php | 2 +- .../Handler/CalendarRangeToRemoteHandler.php | 2 +- .../Handler/CalendarRemoveHandler.php | 2 +- .../Handler/CalendarToRemoteHandler.php | 2 +- .../Messenger/Handler/InviteUpdateHandler.php | 2 +- .../MSGraphChangeNotificationHandler.php | 2 +- .../Messenger/Message/CalendarMessage.php | 10 ++--- .../Message/CalendarRangeMessage.php | 8 ++-- .../Message/CalendarRangeRemovedMessage.php | 6 +-- .../Message/CalendarRemovedMessage.php | 6 +-- .../Messenger/Message/InviteUpdateMessage.php | 4 +- .../MSGraphChangeNotificationMessage.php | 2 +- .../Connector/MSGraph/AddressConverter.php | 2 +- .../EventsOnUserSubscriptionCreator.php | 2 +- .../Connector/MSGraph/LocationConverter.php | 2 +- .../MSGraph/MSGraphUserRepository.php | 2 +- .../Connector/MSGraph/MachineHttpClient.php | 4 +- .../Connector/MSGraph/MachineTokenStorage.php | 2 +- .../Connector/MSGraph/MapCalendarToUser.php | 10 ++--- .../MSGraph/OnBehalfOfUserHttpClient.php | 4 +- .../MSGraph/OnBehalfOfUserTokenStorage.php | 4 +- .../MSGraph/RemoteEventConverter.php | 18 ++++---- .../RemoteToLocalSync/CalendarRangeSyncer.php | 2 +- .../RemoteToLocalSync/CalendarSyncer.php | 4 +- .../MSGraphRemoteCalendarConnector.php | 2 +- .../Repository/CalendarACLAwareRepository.php | 2 +- .../Repository/CalendarDocRepository.php | 2 +- .../Repository/CalendarRangeRepository.php | 4 +- .../Repository/CalendarRepository.php | 4 +- .../Repository/InviteRepository.php | 2 +- .../Security/Voter/CalendarDocVoter.php | 6 +-- .../Security/Voter/CalendarVoter.php | 16 +++---- .../Security/Voter/InviteVoter.php | 2 +- .../Service/DocGenerator/CalendarContext.php | 2 +- .../BulkCalendarShortMessageSender.php | 2 +- .../CalendarForShortMessageProvider.php | 2 +- .../DefaultShortMessageForCalendarBuilder.php | 2 +- .../Tests/Form/CalendarTypeTest.php | 2 +- .../Command/CreateFieldsOnGroupCommand.php | 10 ++--- .../CustomFieldsGroupController.php | 2 +- .../CustomFields/CustomFieldChoice.php | 14 +++---- .../CustomFields/CustomFieldDate.php | 10 ++--- .../CustomFields/CustomFieldLongChoice.php | 8 ++-- .../CustomFields/CustomFieldNumber.php | 10 ++--- .../CustomFields/CustomFieldText.php | 10 ++--- .../CustomFields/CustomFieldTitle.php | 12 +++--- .../Entity/CustomField.php | 4 +- .../Form/CustomFieldType.php | 2 +- .../Form/CustomFieldsGroupType.php | 4 +- .../CustomFieldDataTransformer.php | 2 +- .../CustomFieldsGroupToIdTransformer.php | 2 +- .../JsonCustomFieldToArrayTransformer.php | 18 ++++---- .../Form/Type/CustomFieldType.php | 2 +- .../Form/Type/LinkedCustomFieldsType.php | 4 +- .../Service/CustomFieldsHelper.php | 2 +- .../Twig/CustomFieldRenderingTwig.php | 17 ++------ .../Twig/CustomFieldsGroupRenderingTwig.php | 5 +-- .../Context/ContextManager.php | 2 +- .../AdminDocGeneratorTemplateController.php | 2 +- .../DocGeneratorTemplateController.php | 2 +- .../Form/DocGeneratorTemplateType.php | 2 +- .../Exception/TemplateException.php | 2 +- .../GeneratorDriver/RelatorioDriver.php | 6 +-- .../Menu/AdminMenuBuilder.php | 2 +- .../DocGeneratorTemplateRepository.php | 4 +- .../Helper/NormalizeNullValueHelper.php | 2 +- .../Normalizer/DocGenObjectNormalizer.php | 6 +-- .../Service/Context/BaseContextData.php | 2 +- .../Service/Generator/Generator.php | 2 +- .../Service/Generator/GeneratorException.php | 2 +- .../Service/Messenger/OnGenerationFails.php | 2 +- .../Messenger/RequestGenerationHandler.php | 4 +- .../Messenger/RequestGenerationMessage.php | 12 +++--- .../Normalizer/DocGenObjectNormalizerTest.php | 4 +- .../DocumentAccompanyingCourseController.php | 2 +- .../Controller/DocumentPersonController.php | 2 +- .../Controller/StoredObjectApiController.php | 2 +- .../Entity/StoredObject.php | 6 +-- .../Form/DocumentCategoryType.php | 2 +- .../Form/PersonDocumentType.php | 2 +- .../Form/StoredObjectType.php | 14 +++---- .../ChillDocStoreBundle/Menu/MenuBuilder.php | 2 +- .../AccompanyingCourseDocumentRepository.php | 4 +- .../Repository/DocumentCategoryRepository.php | 4 +- .../PersonDocumentACLAwareRepository.php | 2 +- .../Repository/StoredObjectRepository.php | 2 +- .../AccompanyingCourseDocumentVoter.php | 10 ++--- .../Authorization/PersonDocumentVoter.php | 10 ++--- .../Normalizer/StoredObjectDenormalizer.php | 2 +- .../Service/StoredObjectManager.php | 2 +- .../WopiEditTwigExtensionRuntime.php | 4 +- ...ompanyingCourseDocumentWorkflowHandler.php | 4 +- .../Controller/ParticipationController.php | 6 +-- src/Bundle/ChillEventBundle/Entity/Event.php | 2 +- .../ChillEventBundle/Search/EventSearch.php | 10 ++--- .../Security/Authorization/EventVoter.php | 10 ++--- .../Authorization/ParticipationVoter.php | 10 ++--- .../Tests/Controller/EventControllerTest.php | 2 +- .../Controller/EventTypeControllerTest.php | 2 +- .../Tests/Controller/RoleControllerTest.php | 2 +- .../Tests/Controller/StatusControllerTest.php | 2 +- .../Tests/Search/EventSearchTest.php | 2 +- .../Controller/FamilyMemberController.php | 2 +- .../Form/FamilyMemberType.php | 2 +- .../Security/Voter/FamilyMemberVoter.php | 10 ++--- .../Templating/Twig.php | 10 ++--- .../CRUD/Resolver/Resolver.php | 6 +-- .../CRUD/Templating/TwigCRUDResolver.php | 4 +- .../Command/ChillImportUsersCommand.php | 4 +- .../ChillUserSendRenewPasswordCodeCommand.php | 4 +- .../Command/ExecuteCronJobCommand.php | 2 +- .../LoadAddressesBEFromBestAddressCommand.php | 4 +- .../LoadAddressesFRFromBANOCommand.php | 2 +- .../Command/LoadAndUpdateLanguagesCommand.php | 6 +-- .../Command/LoadCountriesCommand.php | 2 +- .../Command/LoadPostalCodeFR.php | 2 +- .../Command/LoadPostalCodesCommand.php | 6 +-- .../Command/SetPasswordCommand.php | 2 +- .../AddressReferenceAPIController.php | 4 +- .../AddressToReferenceMatcherController.php | 2 +- .../Controller/ExportController.php | 4 +- ...GeographicalUnitByAddressApiController.php | 2 +- .../Controller/NotificationApiController.php | 2 +- .../Controller/NotificationController.php | 2 +- .../Controller/PermissionApiController.php | 2 +- .../Controller/PermissionsGroupController.php | 2 +- .../Controller/PostalCodeAPIController.php | 4 +- .../Controller/SavedExportController.php | 2 +- .../Controller/SearchController.php | 2 +- .../Controller/TimelineCenterController.php | 2 +- .../Controller/UserController.php | 4 +- .../Controller/WorkflowApiController.php | 2 +- .../Controller/WorkflowController.php | 2 +- .../ChillMainBundle/Cron/CronManager.php | 2 +- .../DataFixtures/ORM/LoadUsers.php | 2 +- .../CompilerPass/ShortMessageCompilerPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../Event/TrackCreateUpdateSubscriber.php | 2 +- .../ChillMainBundle/Doctrine/Model/Point.php | 2 +- .../Doctrine/Type/NativeDateIntervalType.php | 8 ++-- .../Doctrine/Type/PointType.php | 2 +- src/Bundle/ChillMainBundle/Entity/Address.php | 6 +-- .../Entity/CronJobExecution.php | 4 +- .../ChillMainBundle/Entity/LocationType.php | 10 ++--- .../ChillMainBundle/Export/ExportManager.php | 6 +-- .../Export/Helper/DateTimeHelper.php | 2 +- .../Export/Helper/ExportAddressHelper.php | 24 +++++------ .../TranslatableStringExportLabelHelper.php | 2 +- .../Export/Helper/UserHelper.php | 2 +- .../DataMapper/PrivateCommentDataMapper.php | 2 +- .../Form/DataMapper/ScopePickerDataMapper.php | 2 +- .../IdToEntityDataTransformer.php | 4 +- .../Form/Event/CustomizeFormEvent.php | 2 +- .../ChillMainBundle/Form/LocationFormType.php | 2 +- .../Form/PermissionsGroupType.php | 2 +- .../Form/Type/ChillPhoneNumberType.php | 4 +- .../Form/Type/ComposedRoleScopeType.php | 2 +- .../AddressToIdDataTransformer.php | 2 +- .../DataTransformer/CenterTransformer.php | 4 +- .../EntityToJsonTransformer.php | 4 +- .../MultipleObjectsToIdTransformer.php | 2 +- .../DataTransformer/ObjectToIdTransformer.php | 2 +- .../PostalCodeToIdTransformer.php | 2 +- .../Type/DataTransformer/ScopeTransformer.php | 2 +- .../Form/Type/Export/ExportType.php | 8 ++-- .../Form/Type/Export/FilterType.php | 2 +- .../Form/Type/Export/PickCenterType.php | 8 ++-- .../Form/Type/Listing/FilterOrderType.php | 2 +- .../Form/Type/PickAddressType.php | 2 +- .../Form/Type/PickCivilityType.php | 2 +- .../Form/Type/PickLocationTypeType.php | 2 +- .../Form/Type/PickPostalCodeType.php | 2 +- .../Form/Type/PickRollingDateType.php | 2 +- .../Form/Type/PickUserDynamicType.php | 2 +- .../Form/Type/PickUserLocationType.php | 2 +- .../Form/Type/ScopePickerType.php | 2 +- .../Form/Type/Select2CountryType.php | 2 +- .../Form/Type/Select2LanguageType.php | 2 +- .../Form/Type/TranslatableStringFormType.php | 2 +- .../Form/Type/UserPickerType.php | 2 +- src/Bundle/ChillMainBundle/Form/UserType.php | 2 +- .../ChillMainBundle/Form/WorkflowStepType.php | 2 +- .../Counter/NotificationByUserCounter.php | 2 +- .../Notification/Email/NotificationMailer.php | 2 +- ...NotificationOnTerminateEventSubscriber.php | 2 +- .../ChillMainBundle/Notification/Mailer.php | 2 +- .../NotificationHandlerManager.php | 2 +- .../Notification/NotificationPresence.php | 2 +- .../NotificationTwigExtensionRuntime.php | 2 +- .../Pagination/ChillItemsPerPageTwig.php | 2 +- .../Pagination/ChillPaginationTwig.php | 6 +-- .../Pagination/PaginatorFactory.php | 10 ++--- .../Phonenumber/PhonenumberHelper.php | 12 +++--- .../Phonenumber/Templating.php | 2 +- .../Redis/RedisConnectionFactory.php | 8 ++-- .../Repository/AddressReferenceRepository.php | 4 +- .../Repository/AddressRepository.php | 2 +- .../Repository/CenterRepository.php | 2 +- .../Repository/CivilityRepository.php | 2 +- .../Repository/CountryRepository.php | 2 +- .../Repository/CronJobExecutionRepository.php | 2 +- .../GeographicalUnitLayerLayerRepository.php | 2 +- .../Repository/GeographicalUnitRepository.php | 2 +- .../Repository/GroupCenterRepository.php | 2 +- .../Repository/LanguageRepository.php | 2 +- .../Repository/NotificationRepository.php | 4 +- .../Repository/PermissionsGroupRepository.php | 2 +- .../Repository/PostalCodeRepository.php | 4 +- .../Repository/RegroupmentRepository.php | 2 +- .../Repository/RoleScopeRepository.php | 2 +- .../Repository/SavedExportRepository.php | 2 +- .../Repository/ScopeRepository.php | 2 +- .../Repository/UserACLAwareRepository.php | 2 +- .../Repository/UserJobRepository.php | 2 +- .../Repository/UserRepository.php | 2 +- .../Workflow/EntityWorkflowRepository.php | 2 +- .../Workflow/EntityWorkflowStepRepository.php | 2 +- .../Routing/Loader/ChillRoutesLoader.php | 2 +- .../Routing/MenuBuilder/UserMenuBuilder.php | 2 +- .../ChillMainBundle/Routing/MenuComposer.php | 2 +- .../ChillMainBundle/Routing/MenuTwig.php | 4 +- .../ChillMainBundle/Search/AbstractSearch.php | 4 +- .../Search/Entity/SearchUserApiProvider.php | 2 +- .../ChillMainBundle/Search/Model/Result.php | 2 +- .../ChillMainBundle/Search/SearchApi.php | 2 +- .../Search/SearchApiNoQueryException.php | 6 +-- .../Search/SearchApiResult.php | 4 +- .../ChillMainBundle/Search/SearchProvider.php | 8 ++-- .../Utils/ExtractPhonenumberFromPattern.php | 2 +- .../Search/Utils/SearchExtractionResult.php | 2 +- .../Authorization/AuthorizationHelper.php | 2 +- .../AuthorizationHelperForCurrentUser.php | 2 +- .../Authorization/ChillExportVoter.php | 4 +- .../Authorization/DefaultVoterHelper.php | 2 +- .../DefaultVoterHelperGenerator.php | 2 +- .../Authorization/EntityWorkflowVoter.php | 10 ++--- .../Authorization/SavedExportVoter.php | 6 +-- .../WorkflowEntityDeletionVoter.php | 2 +- .../PasswordRecover/PasswordRecoverEvent.php | 15 ++++--- .../PasswordRecover/PasswordRecoverLocker.php | 14 +++---- .../PasswordRecover/PasswordRecoverVoter.php | 4 +- .../PasswordRecover/RecoverPasswordHelper.php | 4 +- .../Security/PasswordRecover/TokenManager.php | 12 +++--- .../Resolver/CenterResolverDispatcher.php | 2 +- .../Resolver/CenterResolverManager.php | 2 +- .../Resolver/ResolverTwigExtension.php | 8 ++-- .../Resolver/ScopeResolverDispatcher.php | 2 +- .../Serializer/Model/Collection.php | 2 +- .../Normalizer/AddressNormalizer.php | 2 +- .../Normalizer/CenterNormalizer.php | 2 +- .../CommentEmbeddableDocGenNormalizer.php | 2 +- .../Serializer/Normalizer/DateNormalizer.php | 2 +- .../DiscriminatedObjectDenormalizer.php | 4 +- .../DoctrineExistingEntityNormalizer.php | 2 +- .../Normalizer/EntityWorkflowNormalizer.php | 2 +- .../EntityWorkflowStepNormalizer.php | 2 +- .../Normalizer/NotificationNormalizer.php | 2 +- .../Normalizer/PhonenumberNormalizer.php | 4 +- .../PrivateCommentEmbeddableNormalizer.php | 2 +- .../Serializer/Normalizer/UserNormalizer.php | 13 ++---- ...eographicalUnitMaterializedViewCronJob.php | 2 +- .../AddressReferenceBEFromBestAddress.php | 2 +- .../Import/AddressReferenceBaseImporter.php | 2 +- .../Import/AddressReferenceFromBano.php | 2 +- .../Import/AddressToReferenceMatcher.php | 2 +- .../Import/GeographicalUnitBaseImporter.php | 2 +- .../Import/PostalCodeBEFromBestAddress.php | 6 +-- .../Service/Import/PostalCodeBaseImporter.php | 2 +- .../Import/PostalCodeFRFromOpenData.php | 10 ++--- .../Service/Mailer/ChillMailer.php | 2 +- .../Service/RollingDate/RollingDate.php | 42 ++++++++----------- .../Service/ShortMessage/ShortMessage.php | 4 +- .../ShortMessage/ShortMessageHandler.php | 2 +- .../ShortMessage/ShortMessageTransporter.php | 2 +- .../ShortMessageOvh/OvhShortMessageSender.php | 10 ++--- .../Templating/CSVCellTwig.php | 2 +- .../ChillMarkdownRenderExtension.php | 2 +- .../Templating/ChillTwigHelper.php | 2 +- .../Templating/ChillTwigRoutingHelper.php | 8 ++-- .../Templating/Entity/AddressRender.php | 4 +- .../Entity/ChillEntityRenderExtension.php | 4 +- .../Templating/Entity/CommentRender.php | 2 +- .../Templating/Entity/UserRender.php | 4 +- .../Events/DelegatedBlockRenderingEvent.php | 4 +- .../Templating/Listing/FilterOrderHelper.php | 2 +- .../Listing/FilterOrderHelperBuilder.php | 2 +- .../Listing/FilterOrderHelperFactory.php | 2 +- .../Templating/Listing/Templating.php | 2 +- .../Templating/TranslatableStringHelper.php | 4 +- .../Templating/TranslatableStringTwig.php | 4 +- .../Templating/Widget/WidgetRenderingTwig.php | 4 +- .../PermissionsGroupControllerTest.php | 2 +- .../Tests/Cron/CronManagerTest.php | 2 +- .../Tests/Form/Type/PickCenterTypeTest.php | 6 +-- .../Tests/Search/AbstractSearchTest.php | 2 +- .../GeographicalUnitBaseImporterTest.php | 4 +- .../Timeline/TimelineBuilder.php | 2 +- .../Util/DateRangeCovering.php | 4 +- .../Validator/RoleScopeScopePresence.php | 2 +- .../Validation/Validator/ValidPhonenumber.php | 2 +- .../Counter/WorkflowByUserCounter.php | 2 +- .../Workflow/EntityWorkflowManager.php | 2 +- ...ntityWorkflowTransitionEventSubscriber.php | 2 +- .../NotificationOnTransition.php | 2 +- .../SendAccessKeyEventSubscriber.php | 2 +- .../Workflow/Helper/MetadataExtractor.php | 2 +- .../WorkflowNotificationHandler.php | 2 +- .../WorkflowTwigExtensionRuntime.php | 2 +- .../EntityWorkflowCreationValidator.php | 2 +- .../PersonAddressMoveEventSubscriber.php | 2 +- .../Events/UserRefEventSubscriber.php | 2 +- .../ChillPersonBundle/Actions/ActionEvent.php | 4 +- .../OneToOneEntityPersonCRUDController.php | 2 +- .../Command/ChillPersonMoveCommand.php | 8 ++-- ...emoveOldDraftAccompanyingPeriodCommand.php | 2 +- .../AccompanyingCourseApiController.php | 2 +- .../AccompanyingCourseCommentController.php | 2 +- .../AccompanyingCourseController.php | 2 +- .../AccompanyingCourseWorkApiController.php | 2 +- .../AccompanyingCourseWorkController.php | 2 +- ...mpanyingPeriodRegulationListController.php | 2 +- ...nyingPeriodWorkEvaluationApiController.php | 2 +- .../Controller/HouseholdApiController.php | 2 +- .../HouseholdCompositionController.php | 2 +- .../Controller/HouseholdController.php | 2 +- .../Controller/HouseholdMemberController.php | 2 +- .../Controller/PersonApiController.php | 6 +-- .../Controller/PersonController.php | 8 ++-- .../Controller/PersonDuplicateController.php | 2 +- .../Controller/PersonResourceController.php | 2 +- .../ReassignAccompanyingPeriodController.php | 4 +- .../Controller/RelationshipApiController.php | 2 +- .../ResidentialAddressController.php | 2 +- .../SocialWorkEvaluationApiController.php | 2 +- .../SocialWorkGoalApiController.php | 2 +- .../SocialWorkResultApiController.php | 2 +- .../SocialWorkSocialActionApiController.php | 2 +- .../UserAccompanyingPeriodController.php | 2 +- .../ORM/LoadAccompanyingPeriodOrigin.php | 2 +- .../ORM/LoadAccompanyingPeriodWork.php | 2 +- .../DataFixtures/ORM/LoadCustomFields.php | 2 +- .../DataFixtures/ORM/LoadHousehold.php | 4 +- .../ORM/LoadHouseholdCompositionType.php | 2 +- .../ORM/LoadHouseholdPosition.php | 8 ++-- .../DataFixtures/ORM/LoadPeople.php | 2 +- .../DataFixtures/ORM/LoadRelations.php | 4 +- .../DataFixtures/ORM/LoadRelationships.php | 2 +- .../ORM/LoadSocialWorkMetadata.php | 2 +- .../Entity/AccompanyingPeriod.php | 12 +++--- .../Entity/AccompanyingPeriod/UserHistory.php | 26 +++++------- .../ChillPersonBundle/Entity/Person.php | 12 +++--- .../Event/Person/PersonAddressMoveEvent.php | 4 +- .../AccompanyingPeriodWorkEventListener.php | 2 +- .../AdministrativeLocationAggregator.php | 2 +- .../ClosingMotiveAggregator.php | 2 +- .../ConfidentialAggregator.php | 2 +- .../CreatorJobAggregator.php | 2 +- .../DurationAggregator.php | 2 +- .../EmergencyAggregator.php | 2 +- .../EvaluationAggregator.php | 2 +- .../GeographicalUnitStatAggregator.php | 2 +- .../IntensityAggregator.php | 2 +- .../OriginAggregator.php | 4 +- .../ReferrerAggregator.php | 2 +- .../ReferrerScopeAggregator.php | 2 +- .../RequestorAggregator.php | 2 +- .../ScopeAggregator.php | 2 +- .../SocialActionAggregator.php | 2 +- .../SocialIssueAggregator.php | 2 +- .../StepAggregator.php | 2 +- .../UserJobAggregator.php | 2 +- .../ByEndDateAggregator.php | 2 - .../ByMaxDateAggregator.php | 2 - .../ByStartDateAggregator.php | 2 - .../EvaluationTypeAggregator.php | 2 +- .../HavingEndDateAggregator.php | 2 +- .../ChildrenNumberAggregator.php | 2 +- .../CompositionAggregator.php | 2 +- .../PersonAggregators/AgeAggregator.php | 2 +- .../ByHouseholdCompositionAggregator.php | 2 +- .../CountryOfBirthAggregator.php | 2 +- .../PersonAggregators/GenderAggregator.php | 2 +- .../GeographicalUnitAggregator.php | 2 +- .../HouseholdPositionAggregator.php | 2 +- .../MaritalStatusAggregator.php | 2 +- .../NationalityAggregator.php | 2 +- .../ActionTypeAggregator.php | 2 +- .../CurrentActionAggregator.php | 2 +- .../SocialWorkAggregators/GoalAggregator.php | 2 +- .../GoalResultAggregator.php | 2 +- .../SocialWorkAggregators/JobAggregator.php | 2 +- .../ReferrerAggregator.php | 2 +- .../ResultAggregator.php | 2 +- .../SocialWorkAggregators/ScopeAggregator.php | 2 +- .../ChillPersonBundle/Export/Declarations.php | 12 +++--- .../Export/Export/CountEvaluation.php | 2 +- .../Export/Export/CountHousehold.php | 2 +- .../CountPersonWithAccompanyingCourse.php | 2 +- .../Export/Export/ListAccompanyingPeriod.php | 2 +- .../Export/ListAccompanyingPeriodWork.php | 2 +- .../Export/Export/ListEvaluation.php | 2 +- .../Export/Export/ListHouseholdInPeriod.php | 2 +- .../Export/Export/ListPerson.php | 2 +- .../Export/Export/ListPersonDuplicate.php | 4 +- .../ListPersonWithAccompanyingPeriod.php | 2 +- .../Export/StatAccompanyingCourseDuration.php | 2 +- .../ActiveOnDateFilter.php | 2 +- .../ActiveOneDayBetweenDatesFilter.php | 2 +- .../AdministrativeLocationFilter.php | 2 +- .../ClosingMotiveFilter.php | 2 +- .../ConfidentialFilter.php | 2 +- .../CreatorJobFilter.php | 2 +- .../EmergencyFilter.php | 2 +- .../EvaluationFilter.php | 2 +- .../GeographicalUnitStatFilter.php | 2 +- .../HasNoReferrerFilter.php | 2 +- .../HasTemporaryLocationFilter.php | 2 +- .../IntensityFilter.php | 2 +- .../OpenBetweenDatesFilter.php | 2 +- .../OriginFilter.php | 2 +- .../ReferrerFilter.php | 2 +- .../RequestorFilter.php | 2 +- .../SocialActionFilter.php | 2 +- .../SocialIssueFilter.php | 2 +- .../AccompanyingCourseFilters/StepFilter.php | 2 +- .../UserJobFilter.php | 2 +- .../UserScopeFilter.php | 2 +- .../EvaluationFilters/ByEndDateFilter.php | 2 +- .../EvaluationFilters/ByStartDateFilter.php | 2 +- .../EvaluationTypeFilter.php | 2 +- .../EvaluationFilters/MaxDateFilter.php | 2 +- .../HouseholdFilters/CompositionFilter.php | 2 +- .../PersonFilters/AddressRefStatusFilter.php | 2 +- .../Export/Filter/PersonFilters/AgeFilter.php | 2 +- .../Filter/PersonFilters/BirthdateFilter.php | 2 +- .../ByHouseholdCompositionFilter.php | 2 +- .../PersonFilters/DeadOrAliveFilter.php | 2 +- .../Filter/PersonFilters/DeathdateFilter.php | 2 +- .../PersonFilters/GeographicalUnitFilter.php | 2 +- .../PersonFilters/MaritalStatusFilter.php | 2 +- .../PersonFilters/NationalityFilter.php | 2 +- .../ResidentialAddressAtThirdpartyFilter.php | 2 +- .../ResidentialAddressAtUserFilter.php | 2 +- .../WithoutHouseholdComposition.php | 2 +- .../Filter/SocialWorkFilters/JobFilter.php | 2 +- .../Filter/SocialWorkFilters/ScopeFilter.php | 2 +- .../SocialWorkTypeFilter.php | 2 +- .../Export/Helper/LabelPersonHelper.php | 2 +- .../Export/Helper/ListPersonHelper.php | 6 +-- .../Form/CreationPersonType.php | 8 ++-- .../Form/HouseholdCompositionType.php | 2 +- .../Form/PersonResourceType.php | 2 +- .../ChillPersonBundle/Form/PersonType.php | 2 +- .../Form/Type/PersonAltNameType.php | 2 +- .../Form/Type/PersonPhoneType.php | 2 +- .../Form/Type/PickPersonDynamicType.php | 2 +- .../Form/Type/PickSocialActionType.php | 2 +- .../Form/Type/PickSocialIssueType.php | 2 +- .../Form/Type/Select2MaritalStatusType.php | 2 +- .../Household/MembersEditor.php | 8 ++-- .../Household/MembersEditorFactory.php | 2 +- .../Menu/PersonMenuBuilder.php | 4 +- .../Menu/SectionMenuBuilder.php | 2 +- .../AccompanyingPeriodNotificationHandler.php | 2 +- .../AccompanyingPeriodPrivacyEvent.php | 2 +- .../Privacy/PrivacyEvent.php | 4 +- ...PeriodWorkEvaluationDocumentRepository.php | 2 +- ...mpanyingPeriodWorkEvaluationRepository.php | 2 +- .../AccompanyingPeriodWorkGoalRepository.php | 2 +- .../AccompanyingPeriodWorkRepository.php | 2 +- .../ClosingMotiveRepository.php | 2 +- .../AccompanyingPeriod/CommentRepository.php | 2 +- .../AccompanyingPeriod/OriginRepository.php | 2 +- .../AccompanyingPeriod/ResourceRepository.php | 2 +- .../AccompanyingPeriodACLAwareRepository.php | 2 +- ...ompanyingPeriodParticipationRepository.php | 2 +- .../AccompanyingPeriodRepository.php | 2 +- .../Household/HouseholdACLAwareRepository.php | 2 +- .../HouseholdCompositionRepository.php | 2 +- .../HouseholdCompositionTypeRepository.php | 2 +- .../Household/HouseholdMembersRepository.php | 2 +- .../Household/HouseholdRepository.php | 4 +- .../PersonHouseholdAddressRepository.php | 2 +- .../Household/PositionRepository.php | 2 +- .../Repository/MaritalStatusRepository.php | 2 +- .../Person/PersonCenterHistoryRepository.php | 2 +- .../Repository/PersonACLAwareRepository.php | 2 +- .../Repository/PersonAltNameRepository.php | 2 +- .../PersonNotDuplicateRepository.php | 2 +- .../Repository/PersonRepository.php | 2 +- .../Repository/PersonResourceRepository.php | 2 +- .../Relationships/RelationRepository.php | 2 +- .../Relationships/RelationshipRepository.php | 4 +- .../SocialWork/EvaluationRepository.php | 2 +- .../Repository/SocialWork/GoalRepository.php | 2 +- .../SocialWork/ResultRepository.php | 2 +- .../SocialWork/SocialActionRepository.php | 2 +- .../SocialWork/SocialIssueRepository.php | 2 +- .../ChillPersonBundle/Search/PersonSearch.php | 6 +-- .../Search/SearchHouseholdApiProvider.php | 2 +- .../Search/SearchPersonApiProvider.php | 2 +- .../Search/SimilarPersonMatcher.php | 4 +- .../AccompanyingPeriodCommentVoter.php | 6 +-- .../AccompanyingPeriodResourceVoter.php | 4 +- .../Authorization/AccompanyingPeriodVoter.php | 32 +++++++------- ...nyingPeriodWorkEvaluationDocumentVoter.php | 4 +- .../AccompanyingPeriodWorkEvaluationVoter.php | 8 ++-- .../AccompanyingPeriodWorkVoter.php | 14 +++---- .../Security/Authorization/HouseholdVoter.php | 12 +++--- .../Security/Authorization/PersonVoter.php | 12 +++--- .../AuthorizedCenterOnPersonCreation.php | 4 +- .../AccompanyingPeriodDocGenNormalizer.php | 2 +- .../AccompanyingPeriodResourceNormalizer.php | 2 +- .../AccompanyingPeriodWorkDenormalizer.php | 6 +-- ...PeriodWorkEvaluationDocumentNormalizer.php | 2 +- ...mpanyingPeriodWorkEvaluationNormalizer.php | 2 +- .../AccompanyingPeriodWorkNormalizer.php | 2 +- .../Normalizer/MembersEditorNormalizer.php | 2 +- .../Normalizer/PersonDocGenNormalizer.php | 2 +- .../Normalizer/PersonJsonNormalizer.php | 21 ++++------ .../RelationshipDocGenNormalizer.php | 2 +- .../Normalizer/SocialActionNormalizer.php | 2 +- .../Normalizer/SocialIssueNormalizer.php | 2 +- .../Normalizer/WorkflowNormalizer.php | 2 +- .../OldDraftAccompanyingPeriodRemover.php | 2 +- .../AccompanyingPeriodContext.php | 2 +- .../AccompanyingPeriodWorkContext.php | 2 +- ...ccompanyingPeriodWorkEvaluationContext.php | 2 +- .../Service/DocGenerator/PersonContext.php | 22 +++++----- .../PersonContextWithThirdParty.php | 2 +- .../Service/Import/SocialWorkMetadata.php | 2 +- .../Templating/Entity/ClosingMotiveRender.php | 2 +- .../Templating/Entity/PersonRender.php | 2 +- .../Templating/Entity/ResourceKindRender.php | 2 +- .../Templating/Entity/SocialActionRender.php | 12 +++--- .../Templating/Entity/SocialIssueRender.php | 2 +- .../AccompanyingPeriodConfidentialTest.php | 2 +- .../AccompanyingCourseApiControllerTest.php | 22 +++++----- .../AccompanyingCourseControllerTest.php | 4 +- .../AccompanyingPeriodControllerTest.php | 6 +-- ...rsonControllerViewWithHiddenFieldsTest.php | 2 +- .../Tests/Form/Type/PickPersonTypeTest.php | 4 +- .../Tests/Search/PersonSearchTest.php | 12 +++--- ...ngPeriodWorkEvaluationDenormalizerTest.php | 2 +- .../Normalizer/HouseholdNormalizerTest.php | 2 +- .../Normalizer/PersonDocGenNormalizerTest.php | 6 +-- .../TimelineAccompanyingPeriodTest.php | 2 +- .../AbstractTimelineAccompanyingPeriod.php | 2 +- .../AccompanyingPeriodValidityValidator.php | 2 +- .../LocationValidityValidator.php | 2 +- .../ParticipationOverlapValidator.php | 2 +- .../ResourceDuplicateCheckValidator.php | 2 +- ...HouseholdMembershipSequentialValidator.php | 2 +- .../Constraints/Person/Birthdate.php | 2 +- .../Person/PersonHasCenterValidator.php | 4 +- .../RelationshipNoDuplicateValidator.php | 2 +- ...dWorkEvaluationDocumentWorkflowHandler.php | 2 +- ...ingPeriodWorkEvaluationWorkflowHandler.php | 2 +- .../AccompanyingPeriodWorkWorkflowHandler.php | 2 +- .../Export/Export/ReportList.php | 8 ++-- .../Export/Filter/ReportDateFilter.php | 2 +- .../ChillReportBundle/Search/ReportSearch.php | 4 +- .../Security/Authorization/ReportVoter.php | 8 ++-- .../Tests/Controller/ReportControllerTest.php | 4 +- .../Timeline/TimelineReportProvider.php | 2 +- .../Controller/SingleTaskController.php | 2 +- .../ChillTaskBundle/Event/TaskEvent.php | 2 +- .../ChillTaskBundle/Event/UI/UIEvent.php | 6 +-- .../ChillTaskBundle/Form/SingleTaskType.php | 2 +- .../SingleTaskAclAwareRepository.php | 6 +-- .../Repository/SingleTaskRepository.php | 10 ++--- .../Authorization/AuthorizationEvent.php | 8 ++-- .../Security/Authorization/TaskVoter.php | 8 ++-- .../Templating/TaskTwigExtension.php | 2 +- .../Templating/UI/CountNotificationTask.php | 4 +- .../SingleTaskACLAwareRepositoryTest.php | 2 +- ...TaskTaskLifeCycleEventTimelineProvider.php | 2 +- .../TaskLifeCycleEventTimelineProvider.php | 2 +- .../Definition/DefaultTaskDefinition.php | 4 +- .../Controller/ThirdPartyController.php | 2 +- .../DataFixtures/ORM/LoadThirdParty.php | 2 +- .../ThirdPartyTypeCompilerPass.php | 2 +- .../Entity/ThirdParty.php | 6 +-- .../Export/Helper/LabelThirdPartyHelper.php | 2 +- .../Form/ThirdPartyType.php | 2 +- .../Type/PickThirdPartyTypeCategoryType.php | 2 +- .../Form/Type/PickThirdpartyDynamicType.php | 2 +- .../ThirdPartyACLAwareRepository.php | 2 +- .../Repository/ThirdPartyRepository.php | 2 +- .../Search/ThirdPartyApiSearch.php | 2 +- .../Search/ThirdPartySearch.php | 4 +- .../Security/Voter/ThirdPartyVoter.php | 6 +-- .../Normalizer/ThirdPartyNormalizer.php | 2 +- .../ThirdPartyType/ThirdPartyTypeManager.php | 2 +- .../src/Controller/Convert.php | 12 +++--- .../ChillWopiBundle/src/Controller/Editor.php | 2 +- .../src/Service/Controller/Responder.php | 9 +--- .../src/Service/Wopi/AuthorizationManager.php | 2 +- .../Service/Wopi/ChillDocumentLockManager.php | 2 +- .../src/Service/Wopi/ChillDocumentManager.php | 12 +++--- .../src/Service/Wopi/ChillWopi.php | 2 +- .../src/Service/Wopi/UserManager.php | 2 +- 733 files changed, 1257 insertions(+), 1322 deletions(-) diff --git a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php index b4567729c..14588a487 100644 --- a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php +++ b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php @@ -25,7 +25,7 @@ class ChillMainConfiguration implements ConfigurationInterface public function __construct( array $widgetFactories, - private ContainerBuilder $containerBuilder + private readonly ContainerBuilder $containerBuilder ) { // we register here widget factories (see below) $this->setWidgetFactories($widgetFactories); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 69d3f3312..75f393bc0 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -48,23 +48,22 @@ use function array_key_exists; final class ActivityController extends AbstractController { public function __construct( - private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, - private ActivityTypeRepositoryInterface $activityTypeRepository, - private ActivityTypeCategoryRepository $activityTypeCategoryRepository, - private PersonRepository $personRepository, - private ThirdPartyRepository $thirdPartyRepository, - private LocationRepository $locationRepository, - private ActivityRepository $activityRepository, - private AccompanyingPeriodRepository $accompanyingPeriodRepository, - private EntityManagerInterface $entityManager, - private EventDispatcherInterface $eventDispatcher, - private LoggerInterface $logger, - private SerializerInterface $serializer, - private UserRepositoryInterface $userRepository, - private CenterResolverManagerInterface $centerResolver, - private TranslatorInterface $translator, - ) - { + private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository, + private readonly ActivityTypeRepositoryInterface $activityTypeRepository, + private readonly ActivityTypeCategoryRepository $activityTypeCategoryRepository, + private readonly PersonRepository $personRepository, + private readonly ThirdPartyRepository $thirdPartyRepository, + private readonly LocationRepository $locationRepository, + private readonly ActivityRepository $activityRepository, + private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, + private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly LoggerInterface $logger, + private readonly SerializerInterface $serializer, + private readonly UserRepositoryInterface $userRepository, + private readonly CenterResolverManagerInterface $centerResolver, + private readonly TranslatorInterface $translator, + ) { } /** diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 60a7636e4..226177d7f 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -24,7 +24,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class ActivityReasonController extends AbstractController { - public function __construct(private ActivityReasonRepository $activityReasonRepository) + public function __construct(private readonly ActivityReasonRepository $activityReasonRepository) { } diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index 74eb4f8d3..9f0c59784 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -30,7 +30,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface */ private $faker; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { $this->faker = FakerFactory::create('fr_FR'); } diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 32ceb2e74..c697cdf9b 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -65,9 +65,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac use TrackUpdateTrait; - public const SENTRECEIVED_RECEIVED = 'received'; + final public const SENTRECEIVED_RECEIVED = 'received'; - public const SENTRECEIVED_SENT = 'sent'; + final public const SENTRECEIVED_SENT = 'sent'; /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index f49297f02..aa6598b0b 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -27,11 +27,11 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; */ class ActivityType { - public const FIELD_INVISIBLE = 0; + final public const FIELD_INVISIBLE = 0; - public const FIELD_OPTIONAL = 1; + final public const FIELD_OPTIONAL = 1; - public const FIELD_REQUIRED = 2; + final public const FIELD_REQUIRED = 2; /** * @deprecated not in use diff --git a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php index fb2fb8a1c..8ae053728 100644 --- a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php +++ b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php @@ -22,7 +22,7 @@ use function in_array; class ActivityEntityListener { - public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository) + public function __construct(private readonly EntityManagerInterface $em, private readonly AccompanyingPeriodWorkRepository $workRepository) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php index 60cff42f8..5e20bd6ab 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByCreatorAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorAggregator implements AggregatorInterface { - public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender) + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index a09c254eb..c3f205543 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -21,7 +21,7 @@ use function in_array; class BySocialActionAggregator implements AggregatorInterface { - public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 111bdcf4b..a54049e13 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -21,7 +21,7 @@ use function in_array; class BySocialIssueAggregator implements AggregatorInterface { - public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) + public function __construct(private readonly SocialIssueRepository $issueRepository, private readonly SocialIssueRender $issueRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index 83c4a5d2a..7b0996eb4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -21,7 +21,7 @@ use function in_array; class ByThirdpartyAggregator implements AggregatorInterface { - public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender) + public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php index 3014352ad..249bb0a5d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/CreatorScopeAggregator.php @@ -21,7 +21,7 @@ use function in_array; class CreatorScopeAggregator implements AggregatorInterface { - public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ScopeRepository $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index a4f93e3b3..461fac62d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -29,7 +29,7 @@ class DateAggregator implements AggregatorInterface private const DEFAULT_CHOICE = 'year'; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index fa2c7f7c2..6c023692e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -21,7 +21,7 @@ use function in_array; class LocationTypeAggregator implements AggregatorInterface { - public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly LocationTypeRepository $locationTypeRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 272727d55..f262c8b58 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -22,7 +22,7 @@ use function in_array; class ActivityTypeAggregator implements AggregatorInterface { - public const KEY = 'activity_type_aggregator'; + final public const KEY = 'activity_type_aggregator'; public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 228ab8500..a79cfcffd 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -21,9 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUserAggregator implements AggregatorInterface { - public const KEY = 'activity_user_id'; + final public const KEY = 'activity_user_id'; - public function __construct(private UserRepository $userRepository, private UserRender $userRender) + public function __construct(private readonly UserRepository $userRepository, private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php index c1b2ff845..b04fd9321 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php @@ -21,7 +21,7 @@ use function in_array; class ActivityUsersAggregator implements AggregatorInterface { - public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender) + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php index 1b8cb7e1c..d02017feb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php @@ -20,7 +20,7 @@ use function in_array; class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface { - public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php index 1f39ccf82..a83a7375a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php @@ -20,7 +20,7 @@ use function in_array; class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface { - public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php index 7ff94aaca..ec0c00648 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SentReceivedAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Declarations.php b/src/Bundle/ChillActivityBundle/Export/Declarations.php index 79afb09c8..210988770 100644 --- a/src/Bundle/ChillActivityBundle/Export/Declarations.php +++ b/src/Bundle/ChillActivityBundle/Export/Declarations.php @@ -16,9 +16,9 @@ namespace Chill\ActivityBundle\Export; */ abstract class Declarations { - public const ACTIVITY = 'activity'; + final public const ACTIVITY = 'activity'; - public const ACTIVITY_ACP = 'activity_linked_to_acp'; + final public const ACTIVITY_ACP = 'activity_linked_to_acp'; - public const ACTIVITY_PERSON = 'activity_linked_to_person'; + final public const ACTIVITY_PERSON = 'activity_linked_to_person'; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index 6e98565c6..9dd8b1e4f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ListActivity implements ListInterface, GroupedExportInterface { - public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper) + public function __construct(private readonly ListActivityHelper $helper, private readonly EntityManagerInterface $entityManager, private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index ff4d4fa47..21c85260b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -50,7 +50,7 @@ class ListActivity implements ListInterface, GroupedExportInterface 'person_id', ]; - public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository) + public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ActivityRepository $activityRepository) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index bb8be00ff..da1669756 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -30,13 +30,13 @@ use Symfony\Component\Form\FormBuilderInterface; */ class StatActivityDuration implements ExportInterface, GroupedExportInterface { - public const SUM = 'sum'; + final public const SUM = 'sum'; /** * @param string $action the stat to perform */ public function __construct( - private ActivityRepository $activityRepository, + private readonly ActivityRepository $activityRepository, /** * The action for this report. */ diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index 43c9f4688..79d297851 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -30,9 +30,9 @@ use const SORT_NUMERIC; class ListActivityHelper { - public const MSG_KEY = 'export.list.activity.'; + final public const MSG_KEY = 'export.list.activity.'; - public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private DateTimeHelper $dateTimeHelper, private LabelPersonHelper $labelPersonHelper, private LabelThirdPartyHelper $labelThirdPartyHelper, private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringExportLabelHelper $translatableStringLabelHelper, private UserHelper $userHelper) + public function __construct(private readonly ActivityPresenceRepositoryInterface $activityPresenceRepository, private readonly ActivityTypeRepositoryInterface $activityTypeRepository, private readonly DateTimeHelper $dateTimeHelper, private readonly LabelPersonHelper $labelPersonHelper, private readonly LabelThirdPartyHelper $labelThirdPartyHelper, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatableStringExportLabelHelper $translatableStringLabelHelper, private readonly UserHelper $userHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php index a1f2bc786..163ac4208 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityTypeFilter implements FilterInterface { - public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ActivityTypeRepositoryInterface $activityTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php index 28264c919..3c8df8df6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByCreatorFilter.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorFilter implements FilterInterface { - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index 89330728f..08ffdb638 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -22,7 +22,7 @@ use function in_array; class BySocialActionFilter implements FilterInterface { - public function __construct(private SocialActionRender $actionRender) + public function __construct(private readonly SocialActionRender $actionRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index d78efbde0..e3163798d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -22,7 +22,7 @@ use function in_array; class BySocialIssueFilter implements FilterInterface { - public function __construct(private SocialIssueRender $issueRender) + public function __construct(private readonly SocialIssueRender $issueRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php index aff224bf3..ea2a70a77 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -28,7 +28,7 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = false; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index 800381416..40835d367 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -22,7 +22,7 @@ use function in_array; class LocationTypeFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php index b901ebde7..6a44414a3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php @@ -29,7 +29,7 @@ class SentReceivedFilter implements FilterInterface private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index 1a5d28059..f1537bfb2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class UserFilter implements FilterInterface { - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index 47445a012..5cc872aea 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -23,7 +23,7 @@ use function in_array; class UserScopeFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 1ea273c64..30c625a39 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ActivityDateFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(protected TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php index 735b66a31..43163b5ab 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersFilter implements FilterInterface { - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index c9e942816..6f35e98b6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class UsersJobFilter implements FilterInterface { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php index f93f982aa..58533cae4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class UsersScopeFilter implements FilterInterface { - public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 6288486f7..63b1ab6c8 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -25,7 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ActivityTypeType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php index 4709b3010..392019ec9 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php @@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class PickActivityReasonType extends AbstractType { - public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ActivityReasonRepository $activityReasonRepository, private readonly ActivityReasonRender $reasonRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php index 8ccdf42c8..37bc90b0c 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php @@ -23,7 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class TranslatableActivityReasonCategoryType extends AbstractType { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index bdffafcb2..8337a3582 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -18,7 +18,7 @@ use Symfony\Component\Security\Core\Security; /** * @implements LocalMenuBuilderInterface */ -final class AdminMenuBuilder implements LocalMenuBuilderInterface +final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { public function __construct(private Security $security) { diff --git a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php index 4b8566484..3356e7107 100644 --- a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php +++ b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php @@ -16,7 +16,7 @@ use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Notification\NotificationHandlerInterface; -final class ActivityNotificationHandler implements NotificationHandlerInterface +final readonly class ActivityNotificationHandler implements NotificationHandlerInterface { public function __construct(private ActivityRepository $activityRepository) { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index c4eae39f0..06a74a1f0 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -33,7 +33,7 @@ use Symfony\Component\Security\Core\Security; use function count; use function in_array; -final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface +final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface { public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private TokenStorageInterface $tokenStorage, private ActivityRepository $repository, private EntityManagerInterface $em, private Security $security) { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php index 2cf9f9470..3ed96074b 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class ActivityPresenceRepository implements ActivityPresenceRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php index 33c36693e..47a7b35e8 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonRepository.php @@ -25,7 +25,7 @@ class ActivityReasonRepository extends ServiceEntityRepository { public function __construct( ManagerRegistry $registry, - private RequestStack $requestStack + private readonly RequestStack $requestStack ) { parent::__construct($registry, ActivityReason::class); } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php index fd5d52fce..99adf4fe0 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class ActivityTypeRepository implements ActivityTypeRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php index 2e55f862c..27f4b07a6 100644 --- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php +++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php @@ -20,9 +20,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const LISTS = 'CHILL_ACTIVITY_LIST'; + final public const LISTS = 'CHILL_ACTIVITY_LIST'; - public const STATS = 'CHILL_ACTIVITY_STATS'; + final public const STATS = 'CHILL_ACTIVITY_STATS'; protected VoterHelperInterface $helper; diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php index a036c9784..06cbb7145 100644 --- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php +++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php @@ -35,7 +35,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn * * It is safe for usage in template and controller */ - public const CREATE = 'CHILL_ACTIVITY_CREATE'; + final public const CREATE = 'CHILL_ACTIVITY_CREATE'; /** * role to allow to create an activity associated win an accompanying course. @@ -44,7 +44,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn * * @internal */ - public const CREATE_ACCOMPANYING_COURSE = 'CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE'; + final public const CREATE_ACCOMPANYING_COURSE = 'CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE'; /** * role to allow to create an activity associated with a person. @@ -53,17 +53,17 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn * * @internal */ - public const CREATE_PERSON = 'CHILL_ACTIVITY_CREATE_PERSON'; + final public const CREATE_PERSON = 'CHILL_ACTIVITY_CREATE_PERSON'; - public const DELETE = 'CHILL_ACTIVITY_DELETE'; + final public const DELETE = 'CHILL_ACTIVITY_DELETE'; - public const FULL = 'CHILL_ACTIVITY_FULL'; + final public const FULL = 'CHILL_ACTIVITY_FULL'; - public const SEE = 'CHILL_ACTIVITY_SEE'; + final public const SEE = 'CHILL_ACTIVITY_SEE'; - public const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS'; - public const UPDATE = 'CHILL_ACTIVITY_UPDATE'; + final public const UPDATE = 'CHILL_ACTIVITY_UPDATE'; private const ALL = [ self::CREATE, diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 95a5a4b10..e1bcd7677 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -39,7 +39,7 @@ class ActivityContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private DocumentCategoryRepository $documentCategoryRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper, private EntityManagerInterface $em, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private TranslatorInterface $translator, private BaseContextData $baseContextData) + public function __construct(private readonly DocumentCategoryRepository $documentCategoryRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly EntityManagerInterface $em, private readonly PersonRenderInterface $personRender, private readonly PersonRepository $personRepository, private readonly TranslatorInterface $translator, private readonly BaseContextData $baseContextData) { } diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index dc895782a..4d049515c 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -48,7 +48,7 @@ class ListActivitiesByAccompanyingPeriodContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private AccompanyingPeriodContext $accompanyingPeriodContext, private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private NormalizerInterface $normalizer, private PersonRepository $personRepository, private SocialActionRepository $socialActionRepository, private SocialIssueRepository $socialIssueRepository, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper, private UserRepository $userRepository) + public function __construct(private readonly AccompanyingPeriodContext $accompanyingPeriodContext, private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private readonly NormalizerInterface $normalizer, private readonly PersonRepository $personRepository, private readonly SocialActionRepository $socialActionRepository, private readonly SocialIssueRepository $socialIssueRepository, private readonly ThirdPartyRepository $thirdPartyRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php index b90a5018e..30fb72fb9 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php @@ -214,7 +214,7 @@ final class ActivityControllerTest extends WebTestCase ->setName('social without activity'); //copy role scopes where ACTIVITY is not present foreach ($socialPermissionGroup->getRoleScopes() as $roleScope) { - if (!strpos($roleScope->getRole(), 'ACTIVITY')) { + if (!strpos((string) $roleScope->getRole(), 'ACTIVITY')) { $withoutActivityPermissionGroup->addRoleScope($roleScope); } } diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php index 14f75e863..88d6535d2 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class ActivityReasonCategoryControllerTest extends WebTestCase { - public function testToWrite() + public function testToWrite(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php index 47de677a3..eafa7ed0b 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class ActivityReasonControllerTest extends WebTestCase { - public function testToWrite() + public function testToWrite(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php index b2276f427..49c0c6a08 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class ActivityTypeControllerTest extends WebTestCase { - public function testToWrite() + public function testToWrite(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php index a8d85daa6..82750a751 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php @@ -34,7 +34,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase parent::setUp(); } - public function testSimple() + public function testSimple(): never { $translatableActivityReasonType = new PickActivityReasonType( $this->getTranslatableStringHelper() diff --git a/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php b/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php index 664196ad4..ff6f46567 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class TimelineProviderTest extends WebTestCase { - public function testAnActivityIsShownOnTimeline() + public function testAnActivityIsShownOnTimeline(): never { $this->markTestSkipped('we have to write fixtures before writing this tests'); } diff --git a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php index 393b33322..bb1dbc9d3 100644 --- a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php +++ b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php @@ -18,9 +18,9 @@ use Symfony\Component\Validator\Constraint; */ class ActivityValidity extends Constraint { - public const IS_REQUIRED_MESSAGE = ' is required'; + final public const IS_REQUIRED_MESSAGE = ' is required'; - public const ROOT_MESSAGE = 'For this type of activity, '; + final public const ROOT_MESSAGE = 'For this type of activity, '; public $noPersonsMessage = 'For this type of activity, you must add at least one person'; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 281585bb9..1aa53db4e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request; final class AsideActivityController extends CRUDController { - public function __construct(private AsideActivityCategoryRepository $categoryRepository) + public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php index e39813009..fdf035682 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php @@ -24,7 +24,7 @@ use function random_int; class LoadAsideActivity extends Fixture implements DependentFixtureInterface { - public function __construct(private UserRepository $userRepository) + public function __construct(private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php index 86a1360dc..aed5f95a0 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByActivityTypeAggregator implements AggregatorInterface { - public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php index a911ad163..aa4e57481 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php @@ -22,7 +22,7 @@ use function in_array; class ByUserJobAggregator implements AggregatorInterface { - public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php index 553e2f77b..47c0b6826 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php @@ -22,7 +22,7 @@ use function in_array; class ByUserScopeAggregator implements AggregatorInterface { - public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Declarations.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Declarations.php index 8c808ea37..f86f78866 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Declarations.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Declarations.php @@ -16,5 +16,5 @@ namespace Chill\AsideActivityBundle\Export; */ abstract class Declarations { - public const ASIDE_ACTIVITY_TYPE = 'aside_activity'; + final public const ASIDE_ACTIVITY_TYPE = 'aside_activity'; } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php index 75d221b70..62b37b870 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private AsideActivityRepository $repository) + public function __construct(private readonly AsideActivityRepository $repository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php index e9c4932f3..7e4d40bef 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CountAsideActivity implements ExportInterface, GroupedExportInterface { - public function __construct(private AsideActivityRepository $repository) + public function __construct(private readonly AsideActivityRepository $repository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index a59962829..b6772dbb0 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -32,7 +32,7 @@ use Doctrine\ORM\QueryBuilder; use LogicException; use Symfony\Component\Form\FormBuilderInterface; -final class ListAsideActivity implements ListInterface, GroupedExportInterface +final readonly class ListAsideActivity implements ListInterface, GroupedExportInterface { public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php index 278fd7b91..7aca79004 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private AsideActivityRepository $repository) + public function __construct(private readonly AsideActivityRepository $repository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php index 535ee04bb..13b60ab7e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByActivityTypeFilter implements FilterInterface { - public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository) + public function __construct(private readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly AsideActivityCategoryRepository $asideActivityTypeRepository) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php index 05bf46889..226caaba1 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php @@ -26,7 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ByDateFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index 809ec1250..6b7f19601 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserFilter implements FilterInterface { - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php index 8b7b1c662..5b3f3cf62 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserJobFilter implements FilterInterface { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php index b7b7edfe4..6269ff562 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserScopeFilter implements FilterInterface { - public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index 584c528e4..c285f0f9b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { - public function __construct(private CategoryRender $categoryRender) + public function __construct(private readonly CategoryRender $categoryRender) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index 727287972..dee87061c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -33,7 +33,7 @@ use function in_array; final class AsideActivityFormType extends AbstractType { - private array $timeChoices; + private readonly array $timeChoices; public function __construct( ParameterBagInterface $parameterBag, @@ -105,13 +105,7 @@ final class AsideActivityFormType extends AbstractType if (!in_array($data->getTimestamp(), $timeChoices, true)) { // the data are not in the possible values. add them $timeChoices[$data->format('H:i')] = $data->getTimestamp(); - $form = $builder->create($fieldName, ChoiceType::class, array_merge( - $durationTimeOptions, - [ - 'choices' => $timeChoices, - 'auto_initialize' => false, - ] - )); + $form = $builder->create($fieldName, ChoiceType::class, [...$durationTimeOptions, 'choices' => $timeChoices, 'auto_initialize' => false]); $form->addModelTransformer($durationTimeTransformer); $formEvent->getForm()->getParent()->add($form->getForm()); } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php index 63f6372d8..8341d8595 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php @@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class PickAsideActivityCategoryType extends AbstractType { - public function __construct(private CategoryRender $categoryRender) + public function __construct(private readonly CategoryRender $categoryRender) { } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php index dcf5c6720..d0a593dab 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -14,7 +14,7 @@ namespace Chill\AsideActivityBundle\Menu; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; -final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface +final readonly class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface { public function __construct(private Security $security) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php b/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php index 918cec586..6735606ce 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Repository/AsideActivityCategoryRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; class AsideActivityCategoryRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Security/AsideActivityVoter.php b/src/Bundle/ChillAsideActivityBundle/src/Security/AsideActivityVoter.php index 6b308b5f2..e15abd439 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Security/AsideActivityVoter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Security/AsideActivityVoter.php @@ -21,9 +21,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; class AsideActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const STATS = 'CHILL_ASIDE_ACTIVITY_STATS'; + final public const STATS = 'CHILL_ASIDE_ACTIVITY_STATS'; - private VoterHelperInterface $voterHelper; + private readonly VoterHelperInterface $voterHelper; public function __construct( VoterHelperFactoryInterface $voterHelperFactory diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index f4a7c4977..9094169c2 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -19,7 +19,7 @@ use Symfony\Component\Templating\EngineInterface; /** * @implements ChillEntityRenderInterface */ -final class CategoryRender implements ChillEntityRenderInterface +final readonly class CategoryRender implements ChillEntityRenderInterface { public const DEFAULT_ARGS = [ self::SEPERATOR_KEY => ' > ', diff --git a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php index 380e641a6..052045f7e 100644 --- a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php +++ b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php @@ -13,11 +13,11 @@ namespace Chill\BudgetBundle\Calculator; class CalculatorResult { - public const TYPE_CURRENCY = 'currency'; + final public const TYPE_CURRENCY = 'currency'; - public const TYPE_PERCENTAGE = 'percentage'; + final public const TYPE_PERCENTAGE = 'percentage'; - public const TYPE_RATE = 'rate'; + final public const TYPE_RATE = 'rate'; public $label; diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index 20f05a8ca..c949342b9 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -31,7 +31,7 @@ use function count; class ElementController extends AbstractController { - public function __construct(private CalculatorManager $calculator, private ResourceRepository $resourceRepository, private ChargeRepository $chargeRepository) + public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) { } diff --git a/src/Bundle/ChillBudgetBundle/Entity/Charge.php b/src/Bundle/ChillBudgetBundle/Entity/Charge.php index 056e4abff..50602e849 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Charge.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Charge.php @@ -24,15 +24,15 @@ use Doctrine\ORM\Mapping as ORM; */ class Charge extends AbstractElement implements HasCentersInterface { - public const HELP_ASKED = 'running'; + final public const HELP_ASKED = 'running'; - public const HELP_NO = 'no'; + final public const HELP_NO = 'no'; - public const HELP_NOT_RELEVANT = 'not-relevant'; + final public const HELP_NOT_RELEVANT = 'not-relevant'; - public const HELP_YES = 'yes'; + final public const HELP_YES = 'yes'; - public const HELPS = [ + final public const HELPS = [ self::HELP_ASKED, self::HELP_NO, self::HELP_YES, diff --git a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php index 778866cb3..c2f2e4b67 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php @@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ChargeType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ChargeKindRepository $repository, private TranslatorInterface $translator) + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php index c98301597..3896b0dd8 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php @@ -26,7 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ResourceType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepository $repository, private TranslatorInterface $translator) + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php index 787980862..805ad865d 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; -final class AdminMenuBuilder implements LocalMenuBuilderInterface +final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { public function __construct(private Security $security) { diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php index 9aaf68ddf..a0c23a4ad 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class ChargeKindRepository implements ChargeKindRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php index 1f9f99753..1ac419e30 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class ResourceKindRepository implements ResourceKindRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php index 5203f9092..11d465421 100644 --- a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php +++ b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php @@ -24,20 +24,20 @@ use UnexpectedValueException; class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_BUDGET_ELEMENT_CREATE'; + final public const CREATE = 'CHILL_BUDGET_ELEMENT_CREATE'; - public const DELETE = 'CHILL_BUDGET_ELEMENT_DELETE'; + final public const DELETE = 'CHILL_BUDGET_ELEMENT_DELETE'; - public const ROLES = [ + final public const ROLES = [ self::CREATE, self::DELETE, self::SEE, self::UPDATE, ]; - public const SEE = 'CHILL_BUDGET_ELEMENT_SEE'; + final public const SEE = 'CHILL_BUDGET_ELEMENT_SEE'; - public const UPDATE = 'CHILL_BUDGET_ELEMENT_UPDATE'; + final public const UPDATE = 'CHILL_BUDGET_ELEMENT_UPDATE'; protected VoterHelperInterface $voter; diff --git a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php index 17e80bd63..70348da30 100644 --- a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php +++ b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php @@ -27,7 +27,7 @@ use function count; /** * Helps to find a summary of the budget: the sum of resources and charges. */ -final class SummaryBudget implements SummaryBudgetInterface +final readonly class SummaryBudget implements SummaryBudgetInterface { private const QUERY_CHARGE_BY_HOUSEHOLD = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, charge_id AS kind_id FROM chill_budget.charge WHERE (person_id IN (_ids_) OR household_id = ?) AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY charge_id'; diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index 336d69c66..c48c952a1 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -20,7 +20,7 @@ use Symfony\Component\Templating\EngineInterface; /** * @implements ChillEntityRenderInterface */ -final class BudgetElementTypeRender implements ChillEntityRenderInterface +final readonly class BudgetElementTypeRender implements ChillEntityRenderInterface { public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine) { diff --git a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php index 4190341d0..7d90bf575 100644 --- a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php +++ b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php @@ -66,11 +66,11 @@ final class SummaryBudgetTest extends TestCase $em = $this->prophesize(EntityManagerInterface::class); $em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class)) ->will(static function ($args) use ($queryResources, $queryCharges) { - if (str_contains($args[0], 'chill_budget.resource')) { + if (str_contains((string) $args[0], 'chill_budget.resource')) { return $queryResources->reveal(); } - if (str_contains($args[0], 'chill_budget.charge')) { + if (str_contains((string) $args[0], 'chill_budget.charge')) { return $queryCharges->reveal(); } diff --git a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php index d71439314..de9b5477f 100644 --- a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php +++ b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php @@ -29,7 +29,7 @@ use TheNetworg\OAuth2\Client\Provider\Azure; class AzureGrantAdminConsentAndAcquireToken extends Command { - public function __construct(private Azure $azure, private ClientRegistry $clientRegistry, private MachineTokenStorage $machineTokenStorage) + public function __construct(private readonly Azure $azure, private readonly ClientRegistry $clientRegistry, private readonly MachineTokenStorage $machineTokenStorage) { parent::__construct('chill:calendar:msgraph-grant-admin-consent'); } diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 48b9242fd..35517ec9e 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -33,11 +33,11 @@ use Symfony\Component\Console\Output\OutputInterface; class MapAndSubscribeUserCalendarCommand extends Command { public function __construct( - private EntityManagerInterface $em, - private EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, - private LoggerInterface $logger, - private MapCalendarToUser $mapCalendarToUser, - private MSGraphUserRepository $userRepository + private readonly EntityManagerInterface $em, + private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, + private readonly LoggerInterface $logger, + private readonly MapCalendarToUser $mapCalendarToUser, + private readonly MSGraphUserRepository $userRepository ) { parent::__construct('chill:calendar:msgraph-user-map-subscribe'); } diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index de5f43102..8222d0ace 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -25,7 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface; class SendShortMessageOnEligibleCalendar extends Command { - public function __construct(private BulkCalendarShortMessageSender $messageSender) + public function __construct(private readonly BulkCalendarShortMessageSender $messageSender) { parent::__construct(); } diff --git a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php index 882277c91..e39ff2d75 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php @@ -44,12 +44,12 @@ use function count; class SendTestShortMessageOnCalendarCommand extends Command { public function __construct( - private PersonRepository $personRepository, - private PhoneNumberUtil $phoneNumberUtil, - private PhoneNumberHelperInterface $phoneNumberHelper, - private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder, - private ShortMessageTransporterInterface $transporter, - private UserRepositoryInterface $userRepository + private readonly PersonRepository $personRepository, + private readonly PhoneNumberUtil $phoneNumberUtil, + private readonly PhoneNumberHelperInterface $phoneNumberHelper, + private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder, + private readonly ShortMessageTransporterInterface $transporter, + private readonly UserRepositoryInterface $userRepository ) { parent::__construct(); } diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index b426dabd8..65d8301a8 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -24,7 +24,7 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarAPIController extends ApiController { - public function __construct(private CalendarRepository $calendarRepository) + public function __construct(private readonly CalendarRepository $calendarRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 34481facb..aaa4d7832 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -49,7 +49,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CalendarController extends AbstractController { - public function __construct(private CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private LoggerInterface $logger, private PaginatorFactory $paginator, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer, private TranslatableStringHelperInterface $translatableStringHelper, private PersonRepository $personRepository, private AccompanyingPeriodRepository $accompanyingPeriodRepository, private UserRepositoryInterface $userRepository, private TranslatorInterface $translator) + public function __construct(private readonly CalendarACLAwareRepositoryInterface $calendarACLAwareRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly LoggerInterface $logger, private readonly PaginatorFactory $paginator, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly PersonRepository $personRepository, private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly UserRepositoryInterface $userRepository, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index 16d1c942c..6542f5c97 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -33,9 +33,7 @@ use UnexpectedValueException; class CalendarDocController { - private SerializerInterface $serializer; - - public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EngineInterface $engine, private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EngineInterface $engine, private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 1b967a9ee..443c88e7e 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -25,7 +25,7 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarRangeAPIController extends ApiController { - public function __construct(private CalendarRangeRepository $calendarRangeRepository) + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 6e4930cdb..b230010e3 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -35,7 +35,7 @@ use function in_array; class InviteApiController { - public function __construct(private EntityManagerInterface $entityManager, private MessageBusInterface $messageBus, private Security $security) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index d10b5d41a..a8339137a 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -30,7 +30,7 @@ use TheNetworg\OAuth2\Client\Token\AccessToken; class RemoteCalendarConnectAzureController { - public function __construct(private ClientRegistry $clientRegistry, private OnBehalfOfUserTokenStorage $MSGraphTokenStorage) + public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index 33e549b37..9abed89c0 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -29,7 +29,7 @@ use const JSON_THROW_ON_ERROR; class RemoteCalendarMSGraphSyncController { - public function __construct(private MessageBusInterface $messageBus) + public function __construct(private readonly MessageBusInterface $messageBus) { } diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index a2143922f..102157447 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -36,7 +36,7 @@ use function count; */ class RemoteCalendarProxyController { - public function __construct(private PaginatorFactory $paginatorFactory, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private SerializerInterface $serializer) + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) { } diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php index 493a97dec..5dc0cd9f0 100644 --- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php @@ -29,7 +29,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere { public static array $references = []; - public function __construct(private UserRepository $userRepository) + public function __construct(private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index dc98c47d9..9fb449115 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -58,20 +58,20 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente use TrackUpdateTrait; - public const SMS_CANCEL_PENDING = 'sms_cancel_pending'; + final public const SMS_CANCEL_PENDING = 'sms_cancel_pending'; - public const SMS_PENDING = 'sms_pending'; + final public const SMS_PENDING = 'sms_pending'; - public const SMS_SENT = 'sms_sent'; + final public const SMS_SENT = 'sms_sent'; - public const STATUS_CANCELED = 'canceled'; + final public const STATUS_CANCELED = 'canceled'; /** * @deprecated */ - public const STATUS_MOVED = 'moved'; + final public const STATUS_MOVED = 'moved'; - public const STATUS_VALID = 'valid'; + final public const STATUS_VALID = 'valid'; /** * a list of invite which have been added during this session. diff --git a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php index a262842c2..3c4d80c94 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php @@ -20,11 +20,11 @@ use Doctrine\ORM\Mapping as ORM; */ class CancelReason { - public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT'; + final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT'; - public const CANCELEDBY_PERSON = 'CANCELEDBY_PERSON'; + final public const CANCELEDBY_PERSON = 'CANCELEDBY_PERSON'; - public const CANCELEDBY_USER = 'CANCELEDBY_USER'; + final public const CANCELEDBY_USER = 'CANCELEDBY_USER'; /** * @ORM\Column(type="boolean") diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php index c2d79aff2..da1b9bb9e 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php @@ -40,23 +40,23 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface use TrackUpdateTrait; - public const ACCEPTED = 'accepted'; + final public const ACCEPTED = 'accepted'; - public const DECLINED = 'declined'; + final public const DECLINED = 'declined'; - public const PENDING = 'pending'; + final public const PENDING = 'pending'; /** * all statuses in one const. */ - public const STATUSES = [ + final public const STATUSES = [ self::ACCEPTED, self::DECLINED, self::PENDING, self::TENTATIVELY_ACCEPTED, ]; - public const TENTATIVELY_ACCEPTED = 'tentative'; + final public const TENTATIVELY_ACCEPTED = 'tentative'; /** * @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites") diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index b781615ef..6870b5292 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -19,7 +19,7 @@ use function array_key_exists; class ListenToActivityCreate { - public function __construct(private RequestStack $requestStack) + public function __construct(private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index bc76dc021..132fbfeed 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class AgentAggregator implements AggregatorInterface +final readonly class AgentAggregator implements AggregatorInterface { public function __construct(private UserRepository $userRepository, private UserRender $userRender) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 051150378..5501215b7 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -22,7 +22,7 @@ use function in_array; class CancelReasonAggregator implements AggregatorInterface { - public function __construct(private CancelReasonRepository $cancelReasonRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index dbda0ad61..5094e05d0 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class JobAggregator implements AggregatorInterface +final readonly class JobAggregator implements AggregatorInterface { public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index 954175935..36c224603 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class LocationAggregator implements AggregatorInterface +final readonly class LocationAggregator implements AggregatorInterface { public function __construct(private LocationRepository $locationRepository) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 489bda8cb..b716fd4e7 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class LocationTypeAggregator implements AggregatorInterface +final readonly class LocationTypeAggregator implements AggregatorInterface { public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 6f72648e0..529fa2e92 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ScopeAggregator implements AggregatorInterface +final readonly class ScopeAggregator implements AggregatorInterface { public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index c7b03a146..53c6b2cb9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -28,7 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UrgencyAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Declarations.php b/src/Bundle/ChillCalendarBundle/Export/Declarations.php index 0df90749c..a007424e5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Declarations.php +++ b/src/Bundle/ChillCalendarBundle/Export/Declarations.php @@ -16,5 +16,5 @@ namespace Chill\CalendarBundle\Export; */ abstract class Declarations { - public const CALENDAR_TYPE = 'calendar'; + final public const CALENDAR_TYPE = 'calendar'; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index 50367ece7..81d519063 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Exception\LogicException; class CountCalendars implements ExportInterface, GroupedExportInterface { - public function __construct(private CalendarRepository $calendarRepository) + public function __construct(private readonly CalendarRepository $calendarRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php index 68ab4fdd3..9964b8638 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private CalendarRepository $calendarRepository) + public function __construct(private readonly CalendarRepository $calendarRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php index fe94cc4e0..2d372f898 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private CalendarRepository $calendarRepository) + public function __construct(private readonly CalendarRepository $calendarRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index 6ae9d8236..2e31388d2 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AgentFilter implements FilterInterface { - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index 9a316208c..62eb1418c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BetweenDatesFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index 6795457d9..bee70238a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -35,7 +35,7 @@ class CalendarRangeFilter implements FilterInterface private const DEFAULT_CHOICE = false; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 47482c732..e27de7633 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -24,7 +24,7 @@ use function in_array; class JobFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 80cbdec37..1f4f82a8e 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -24,7 +24,7 @@ use function in_array; class ScopeFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index e54517ef3..a67d48b0b 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -32,7 +32,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CalendarType extends AbstractType { - public function __construct(private PersonsToIdDataTransformer $personsToIdDataTransformer, private IdToUserDataTransformer $idToUserDataTransformer, private IdToUsersDataTransformer $idToUsersDataTransformer, private IdToLocationDataTransformer $idToLocationDataTransformer, private ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private IdToCalendarRangeDataTransformer $calendarRangeDataTransformer) + public function __construct(private readonly PersonsToIdDataTransformer $personsToIdDataTransformer, private readonly IdToUserDataTransformer $idToUserDataTransformer, private readonly IdToUsersDataTransformer $idToUsersDataTransformer, private readonly IdToLocationDataTransformer $idToLocationDataTransformer, private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer) { } diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php index a81fbdedd..3997c4dad 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -19,7 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security, protected TranslatorInterface $translator) + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php index fb1a60a7b..c7bbc756c 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php @@ -19,7 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security, protected TranslatorInterface $translator) + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php index f8c804519..90b94b08e 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php @@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security, public TranslatorInterface $translator) + public function __construct(private readonly Security $security, public TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php index d940cbeca..6b51b3793 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php @@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Security; class CalendarEntityListener { - public function __construct(private MessageBusInterface $messageBus, private Security $security) + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php index cb3d9a763..40da612e5 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php @@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Security; class CalendarRangeEntityListener { - public function __construct(private MessageBusInterface $messageBus, private Security $security) + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php index b814d4cb8..c55bd8144 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php @@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface { - public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private UserRepository $userRepository) + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php index b94ab6d9d..950ca526d 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php @@ -32,7 +32,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeToRemoteHandler implements MessageHandlerInterface { - public function __construct(private CalendarRangeRepository $calendarRangeRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector, private EntityManagerInterface $entityManager) + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php index ccc8d0a06..6838d3147 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php @@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRemoveHandler implements MessageHandlerInterface { - public function __construct(private RemoteCalendarConnectorInterface $remoteCalendarConnector, private CalendarRangeRepository $calendarRangeRepository, private UserRepositoryInterface $userRepository) + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php index 2698921fc..310e8734b 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php @@ -37,7 +37,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarToRemoteHandler implements MessageHandlerInterface { - public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRepository $calendarRepository, private EntityManagerInterface $entityManager, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $calendarConnector, private UserRepository $userRepository) + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php index b917a13ae..1d987c19e 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php @@ -31,7 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class InviteUpdateHandler implements MessageHandlerInterface { - public function __construct(private EntityManagerInterface $em, private InviteRepository $inviteRepository, private RemoteCalendarConnectorInterface $remoteCalendarConnector) + public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php index f6debd2d5..342180cf1 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php @@ -36,7 +36,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class MSGraphChangeNotificationHandler implements MessageHandlerInterface { - public function __construct(private CalendarRangeRepository $calendarRangeRepository, private CalendarRangeSyncer $calendarRangeSyncer, private CalendarRepository $calendarRepository, private CalendarSyncer $calendarSyncer, private EntityManagerInterface $em, private LoggerInterface $logger, private MapCalendarToUser $mapCalendarToUser, private UserRepository $userRepository) + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php index 53b20e49e..9bcd81c67 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarMessage.php @@ -24,13 +24,13 @@ use Chill\MainBundle\Entity\User; class CalendarMessage { - public const CALENDAR_PERSIST = 'CHILL_CALENDAR_CALENDAR_PERSIST'; + final public const CALENDAR_PERSIST = 'CHILL_CALENDAR_CALENDAR_PERSIST'; - public const CALENDAR_UPDATE = 'CHILL_CALENDAR_CALENDAR_UPDATE'; + final public const CALENDAR_UPDATE = 'CHILL_CALENDAR_CALENDAR_UPDATE'; - private int $byUserId; + private readonly int $byUserId; - private int $calendarId; + private readonly int $calendarId; private array $newInvitesIds = []; @@ -45,7 +45,7 @@ class CalendarMessage public function __construct( Calendar $calendar, - private string $action, + private readonly string $action, User $byUser ) { $this->calendarId = $calendar->getId(); diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php index 61d006a79..13669a0a2 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeMessage.php @@ -23,15 +23,15 @@ use Chill\MainBundle\Entity\User; class CalendarRangeMessage { - public const CALENDAR_RANGE_PERSIST = 'CHILL_CALENDAR_CALENDAR_RANGE_PERSIST'; + final public const CALENDAR_RANGE_PERSIST = 'CHILL_CALENDAR_CALENDAR_RANGE_PERSIST'; - public const CALENDAR_RANGE_UPDATE = 'CHILL_CALENDAR_CALENDAR_RANGE_UPDATE'; + final public const CALENDAR_RANGE_UPDATE = 'CHILL_CALENDAR_CALENDAR_RANGE_UPDATE'; private ?int $byUserId = null; - private int $calendarRangeId; + private readonly int $calendarRangeId; - public function __construct(CalendarRange $calendarRange, private string $action, ?User $byUser) + public function __construct(CalendarRange $calendarRange, private readonly string $action, ?User $byUser) { $this->calendarRangeId = $calendarRange->getId(); diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeRemovedMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeRemovedMessage.php index 783484592..eb8be6838 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeRemovedMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRangeRemovedMessage.php @@ -25,11 +25,11 @@ class CalendarRangeRemovedMessage { private ?int $byUserId = null; - private int $calendarRangeUserId; + private readonly int $calendarRangeUserId; - private array $remoteAttributes; + private readonly array $remoteAttributes; - private string $remoteId; + private readonly string $remoteId; public function __construct(CalendarRange $calendarRange, ?User $byUser) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRemovedMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRemovedMessage.php index 65831ebe0..53dcea28c 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRemovedMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/CalendarRemovedMessage.php @@ -27,11 +27,11 @@ class CalendarRemovedMessage private ?int $byUserId = null; - private int $calendarUserId; + private readonly int $calendarUserId; - private array $remoteAttributes; + private readonly array $remoteAttributes; - private string $remoteId; + private readonly string $remoteId; public function __construct(Calendar $calendar, ?User $byUser) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/InviteUpdateMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/InviteUpdateMessage.php index 35f78fc7d..d18ab8db1 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/InviteUpdateMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/InviteUpdateMessage.php @@ -23,9 +23,9 @@ use Chill\MainBundle\Entity\User; class InviteUpdateMessage { - private int $byUserId; + private readonly int $byUserId; - private int $inviteId; + private readonly int $inviteId; public function __construct(Invite $invite, User $byUser) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php index 8288787cb..682369e03 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php @@ -20,7 +20,7 @@ namespace Chill\CalendarBundle\Messenger\Message; class MSGraphChangeNotificationMessage { - public function __construct(private array $content, private int $userId) + public function __construct(private readonly array $content, private readonly int $userId) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php index 05f116c6b..2764a46e3 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php @@ -24,7 +24,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; class AddressConverter { - public function __construct(private AddressRender $addressRender, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php index 3bbe22161..f6d8cba5a 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php @@ -30,7 +30,7 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; */ class EventsOnUserSubscriptionCreator { - public function __construct(private LoggerInterface $logger, private MachineHttpClient $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php index 5de500b52..cbf97806e 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php @@ -22,7 +22,7 @@ use Chill\MainBundle\Entity\Location; class LocationConverter { - public function __construct(private AddressConverter $addressConverter) + public function __construct(private readonly AddressConverter $addressConverter) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php index 39fbf6c15..840ecd40f 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php @@ -42,7 +42,7 @@ class MSGraphUserRepository ; SQL; - public function __construct(private EntityManagerInterface $entityManager) + public function __construct(private readonly EntityManagerInterface $entityManager) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php index 8a3f37678..b7b9b4e73 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineHttpClient.php @@ -28,12 +28,12 @@ class MachineHttpClient implements HttpClientInterface { use BearerAuthorizationTrait; - private HttpClientInterface $decoratedClient; + private readonly HttpClientInterface $decoratedClient; /** * @param HttpClientInterface $decoratedClient */ - public function __construct(private MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null) + public function __construct(private readonly MachineTokenStorage $machineTokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php index ad7060c1a..f5d25caaf 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php @@ -29,7 +29,7 @@ class MachineTokenStorage private ?AccessTokenInterface $accessToken = null; - public function __construct(private Azure $azure, private ChillRedis $chillRedis) + public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index 6fcc9d20f..6abe11120 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -31,15 +31,15 @@ use function array_key_exists; */ class MapCalendarToUser { - public const EXPIRATION_SUBSCRIPTION_EVENT = 'subscription_events_expiration'; + final public const EXPIRATION_SUBSCRIPTION_EVENT = 'subscription_events_expiration'; - public const ID_SUBSCRIPTION_EVENT = 'subscription_events_id'; + final public const ID_SUBSCRIPTION_EVENT = 'subscription_events_id'; - public const METADATA_KEY = 'msgraph'; + final public const METADATA_KEY = 'msgraph'; - public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret'; + final public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret'; - public function __construct(private HttpClientInterface $machineHttpClient, private LoggerInterface $logger) + public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php index 70a7f1ca0..32f0e5dec 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserHttpClient.php @@ -28,12 +28,12 @@ class OnBehalfOfUserHttpClient { use BearerAuthorizationTrait; - private HttpClientInterface $decoratedClient; + private readonly HttpClientInterface $decoratedClient; /** * @param HttpClientInterface $decoratedClient */ - public function __construct(private OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null) + public function __construct(private readonly OnBehalfOfUserTokenStorage $tokenStorage, ?HttpClientInterface $decoratedClient = null) { $this->decoratedClient = $decoratedClient ?? \Symfony\Component\HttpClient\HttpClient::create(); } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php index 6bb171248..c40c46fbe 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php @@ -28,9 +28,9 @@ use TheNetworg\OAuth2\Client\Token\AccessToken; */ class OnBehalfOfUserTokenStorage { - public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token'; + final public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token'; - public function __construct(private Azure $azure, private SessionInterface $session) + public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php index 9d96357cd..c4d8e0b70 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php @@ -41,27 +41,27 @@ class RemoteEventConverter * valid when the remote string contains also a timezone, like in * lastModifiedDate. */ - public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\\TH:i:s.u?P'; + final public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\\TH:i:s.u?P'; /** * Same as above, but sometimes the date is expressed with only 6 milliseconds. */ - public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\\TH:i:s.uP'; + final public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\\TH:i:s.uP'; private const REMOTE_DATE_FORMAT = 'Y-m-d\TH:i:s.u0'; private const REMOTE_DATETIME_WITHOUT_TZ_FORMAT = 'Y-m-d\TH:i:s.u?'; - private DateTimeZone $defaultDateTimeZone; + private readonly DateTimeZone $defaultDateTimeZone; - private DateTimeZone $remoteDateTimeZone; + private readonly DateTimeZone $remoteDateTimeZone; public function __construct( - private EngineInterface $engine, - private LocationConverter $locationConverter, - private LoggerInterface $logger, - private PersonRenderInterface $personRender, - private TranslatorInterface $translator + private readonly EngineInterface $engine, + private readonly LocationConverter $locationConverter, + private readonly LoggerInterface $logger, + private readonly PersonRenderInterface $personRender, + private readonly TranslatorInterface $translator ) { $this->defaultDateTimeZone = (new DateTimeImmutable())->getTimezone(); $this->remoteDateTimeZone = self::getRemoteTimeZone(); diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php index add82d5d9..8df0d8a0b 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php @@ -33,7 +33,7 @@ class CalendarRangeSyncer /** * @param MachineHttpClient $machineHttpClient */ - public function __construct(private EntityManagerInterface $em, private LoggerInterface $logger, private HttpClientInterface $machineHttpClient) + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php index 7767c0a8b..470e5d30a 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php @@ -32,7 +32,7 @@ use function in_array; class CalendarSyncer { - public function __construct(private LoggerInterface $logger, private HttpClientInterface $machineHttpClient, private UserRepositoryInterface $userRepository) + public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) { } @@ -119,7 +119,7 @@ class CalendarSyncer } $email = $attendee['emailAddress']['address']; - $emails[] = strtolower($email); + $emails[] = strtolower((string) $email); $user = $this->userRepository->findOneByUsernameOrEmail($email); if (null === $user) { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 9d6dcd65c..0d47eaec4 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -45,7 +45,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface { private array $cacheScheduleTimeForUser = []; - public function __construct(private CalendarRepository $calendarRepository, private CalendarRangeRepository $calendarRangeRepository, private HttpClientInterface $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private LoggerInterface $logger, private OnBehalfOfUserTokenStorage $tokenStorage, private OnBehalfOfUserHttpClient $userHttpClient, private RemoteEventConverter $remoteEventConverter, private TranslatorInterface $translator, private UrlGeneratorInterface $urlGenerator, private Security $security) + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) { } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php index 1fc5dd351..6981f0a4c 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php @@ -29,7 +29,7 @@ use Doctrine\ORM\QueryBuilder; class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface { - public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EntityManagerInterface $em) + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php index bd1074b5f..dd593bf3c 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarDocRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; class CalendarDocRepository implements ObjectRepository, CalendarDocRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php index 69a077e47..b74110c96 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php @@ -24,9 +24,9 @@ use function count; class CalendarRangeRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { $this->repository = $em->getRepository(CalendarRange::class); } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php index 4fd9b8a29..91a64c5ec 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php @@ -25,9 +25,9 @@ use function count; class CalendarRepository implements ObjectRepository { - private EntityManagerInterface $em; + private readonly EntityManagerInterface $em; - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php index f0bd8fe88..8778330f8 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; class InviteRepository implements ObjectRepository { - private EntityRepository $entityRepository; + private readonly EntityRepository $entityRepository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php index 7cd815961..a3e1b91ff 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php @@ -20,16 +20,16 @@ use function in_array; class CalendarDocVoter extends Voter { - public const EDIT = 'CHILL_CALENDAR_DOC_EDIT'; + final public const EDIT = 'CHILL_CALENDAR_DOC_EDIT'; - public const SEE = 'CHILL_CALENDAR_DOC_SEE'; + final public const SEE = 'CHILL_CALENDAR_DOC_SEE'; private const ALL = [ 'CHILL_CALENDAR_DOC_EDIT', 'CHILL_CALENDAR_DOC_SEE', ]; - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php index faf6fb5c8..10370ebbb 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php @@ -34,22 +34,18 @@ use Symfony\Component\Security\Core\Security; class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_CALENDAR_CALENDAR_CREATE'; + final public const CREATE = 'CHILL_CALENDAR_CALENDAR_CREATE'; - public const DELETE = 'CHILL_CALENDAR_CALENDAR_DELETE'; + final public const DELETE = 'CHILL_CALENDAR_CALENDAR_DELETE'; - public const EDIT = 'CHILL_CALENDAR_CALENDAR_EDIT'; + final public const EDIT = 'CHILL_CALENDAR_CALENDAR_EDIT'; - public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE'; + final public const SEE = 'CHILL_CALENDAR_CALENDAR_SEE'; - private AuthorizationHelperInterface $authorizationHelper; - - private CenterResolverManagerInterface $centerResolverManager; - - private VoterHelperInterface $voterHelper; + private readonly VoterHelperInterface $voterHelper; public function __construct( - private Security $security, + private readonly Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { $this->voterHelper = $voterHelperFactory diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/InviteVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/InviteVoter.php index 36ca66d05..72aa806e6 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/InviteVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/InviteVoter.php @@ -24,7 +24,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter; class InviteVoter extends Voter { - public const ANSWER = 'CHILL_CALENDAR_INVITE_ANSWER'; + final public const ANSWER = 'CHILL_CALENDAR_INVITE_ANSWER'; protected function supports($attribute, $subject): bool { diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index cb8bb5f7a..88ab41e91 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -31,7 +31,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use function count; -final class CalendarContext implements CalendarContextInterface +final readonly class CalendarContext implements CalendarContextInterface { public function __construct(private BaseContextData $baseContextData, private EntityManagerInterface $entityManager, private NormalizerInterface $normalizer, private PersonRender $personRender, private PersonRepository $personRepository, private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper) { diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php index f5fc86373..ad558b774 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php @@ -26,7 +26,7 @@ use Symfony\Component\Messenger\MessageBusInterface; class BulkCalendarShortMessageSender { - public function __construct(private CalendarForShortMessageProvider $provider, private EntityManagerInterface $em, private LoggerInterface $logger, private MessageBusInterface $messageBus, private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) + public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) { } diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php index a6a8134ae..d460e6715 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php @@ -26,7 +26,7 @@ use function count; class CalendarForShortMessageProvider { - public function __construct(private CalendarRepository $calendarRepository, private EntityManagerInterface $em, private RangeGeneratorInterface $rangeGenerator) + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) { } diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php index 66de8781c..8177be31a 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php @@ -24,7 +24,7 @@ use Symfony\Component\Templating\EngineInterface; class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface { - public function __construct(private EngineInterface $engine) + public function __construct(private readonly EngineInterface $engine) { } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php b/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php index 9195d5eac..f9392ba57 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php @@ -170,7 +170,7 @@ final class CalendarTypeTest extends TypeTestCase return $obj; }, - explode(',', $args[0]) + explode(',', (string) $args[0]) ); }); diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index 739cc6c6e..40a946bd2 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -34,9 +34,9 @@ use function count; */ class CreateFieldsOnGroupCommand extends Command { - public const ARG_DELETE = 'delete'; + final public const ARG_DELETE = 'delete'; - public const ARG_PATH = 'path'; + final public const ARG_PATH = 'path'; /** * CreateFieldsOnGroupCommand constructor. @@ -45,9 +45,9 @@ class CreateFieldsOnGroupCommand extends Command * @param $customizablesEntities */ public function __construct( - private CustomFieldProvider $customFieldProvider, - private EntityManager $entityManager, - private ValidatorInterface $validator, + private readonly CustomFieldProvider $customFieldProvider, + private readonly EntityManager $entityManager, + private readonly ValidatorInterface $validator, private $availableLanguages, private $customizablesEntities ) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 2ae552b01..75935afe7 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -36,7 +36,7 @@ class CustomFieldsGroupController extends AbstractController /** * CustomFieldsGroupController constructor. */ - public function __construct(private CustomFieldProvider $customFieldProvider, private TranslatorInterface $translator) + public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 8add4b995..f5a7b0f03 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -32,15 +32,15 @@ use function LogicException; class CustomFieldChoice extends AbstractCustomField { - public const ALLOW_OTHER = 'other'; + final public const ALLOW_OTHER = 'other'; - public const CHOICES = 'choices'; + final public const CHOICES = 'choices'; - public const EXPANDED = 'expanded'; + final public const EXPANDED = 'expanded'; - public const MULTIPLE = 'multiple'; + final public const MULTIPLE = 'multiple'; - public const OTHER_VALUE_LABEL = 'otherValueLabel'; + final public const OTHER_VALUE_LABEL = 'otherValueLabel'; private $defaultLocales; @@ -49,11 +49,11 @@ class CustomFieldChoice extends AbstractCustomField */ public function __construct( TranslatorInterface $translator, - private TwigEngine $templating, + private readonly TwigEngine $templating, /** * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ - private TranslatableStringHelper $translatableStringHelper + private readonly TranslatableStringHelper $translatableStringHelper ) { $this->defaultLocales = $translator->getFallbackLocales(); } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php index b8688efb1..ccdbcb199 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php @@ -33,18 +33,18 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; */ class CustomFieldDate extends AbstractCustomField { - public const DATE_FORMAT = DateTime::RFC3339; + final public const DATE_FORMAT = DateTime::RFC3339; - public const FORMAT = 'format'; + final public const FORMAT = 'format'; - public const MAX = 'max'; + final public const MAX = 'max'; /** * key for the minimal value of the field. */ - public const MIN = 'min'; + final public const MIN = 'min'; - public function __construct(private TwigEngine $templating, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TwigEngine $templating, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index aa73af462..5f7351372 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -30,12 +30,12 @@ use function is_object; class CustomFieldLongChoice extends AbstractCustomField { - public const KEY = 'key'; + final public const KEY = 'key'; public function __construct( - private OptionRepository $optionRepository, - private TranslatableStringHelper $translatableStringHelper, - private EngineInterface $templating, + private readonly OptionRepository $optionRepository, + private readonly TranslatableStringHelper $translatableStringHelper, + private readonly EngineInterface $templating, ) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php index 7c0e17931..69b856db1 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php @@ -28,18 +28,18 @@ use Symfony\Component\Validator\Constraints\LessThanOrEqual; */ class CustomFieldNumber extends AbstractCustomField { - public const MAX = 'max'; + final public const MAX = 'max'; /** * key for the minimal value of the field. */ - public const MIN = 'min'; + final public const MIN = 'min'; - public const POST_TEXT = 'post_text'; + final public const POST_TEXT = 'post_text'; - public const SCALE = 'scale'; + final public const SCALE = 'scale'; - public function __construct(private TwigEngine $templating, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TwigEngine $templating, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index 389303906..3be0886f6 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -25,17 +25,17 @@ use function array_key_exists; class CustomFieldText extends AbstractCustomField { - public const MAX_LENGTH = 'maxLength'; + final public const MAX_LENGTH = 'maxLength'; - public const MULTIPLE_CF_INLINE = 'multipleCFInline'; + final public const MULTIPLE_CF_INLINE = 'multipleCFInline'; public function __construct( - private RequestStack $requestStack, - private TwigEngine $templating, + private readonly RequestStack $requestStack, + private readonly TwigEngine $templating, /** * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ - private TranslatableStringHelper $translatableStringHelper + private readonly TranslatableStringHelper $translatableStringHelper ) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php index 59114a4a5..4fbfe51d9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php @@ -21,19 +21,19 @@ use Symfony\Component\HttpFoundation\RequestStack; class CustomFieldTitle extends AbstractCustomField { - public const TYPE = 'type'; + final public const TYPE = 'type'; - public const TYPE_SUBTITLE = 'subtitle'; + final public const TYPE_SUBTITLE = 'subtitle'; - public const TYPE_TITLE = 'title'; + final public const TYPE_TITLE = 'title'; public function __construct( - private RequestStack $requestStack, - private TwigEngine $templating, + private readonly RequestStack $requestStack, + private readonly TwigEngine $templating, /** * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ - private TranslatableStringHelper $translatableStringHelper + private readonly TranslatableStringHelper $translatableStringHelper ) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index d9f43ed3b..06aeb9f4f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -22,9 +22,9 @@ use Doctrine\ORM\Mapping as ORM; */ class CustomField { - public const ONE_TO_MANY = 2; + final public const ONE_TO_MANY = 2; - public const ONE_TO_ONE = 1; + final public const ONE_TO_ONE = 1; /** * @var bool diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php index df4e82d5b..29a70bbca 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php @@ -30,7 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CustomFieldType extends AbstractType { - public function __construct(private CustomFieldProvider $customFieldProvider, private ObjectManager $om, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php index e62e85c04..bf0e680c6 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php @@ -26,9 +26,9 @@ use function count; class CustomFieldsGroupType extends AbstractType { public function __construct( - private array $customizableEntities, + private readonly array $customizableEntities, //TODO : add comment about this variable - private TranslatorInterface $translator + private readonly TranslatorInterface $translator ) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php index f1df42ff7..3091ea66f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface; class CustomFieldDataTransformer implements DataTransformerInterface { - public function __construct(private CustomFieldInterface $customFieldDefinition, private CustomField $customField) + public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index 5cba21068..2364a8087 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -20,7 +20,7 @@ use function gettype; class CustomFieldsGroupToIdTransformer implements DataTransformerInterface { - public function __construct(private ObjectManager $om) + public function __construct(private readonly ObjectManager $om) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php index 1ac3ace19..2827c0a73 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php @@ -24,9 +24,9 @@ use const JSON_THROW_ON_ERROR; */ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface { - private array $customField; + private readonly array $customField; - public function __construct(private ObjectManager $om) + public function __construct(private readonly ObjectManager $om) { $customFields = $this->om ->getRepository(CustomField::class) @@ -68,13 +68,13 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface if (array_key_exists($key, $this->customField)) { $type = $this->customField[$key]->getType(); - if (str_starts_with($type, 'ManyToOne')) { + if (str_starts_with((string) $type, 'ManyToOne')) { // pour le manytoone() faire // un update du form en js ? : http://symfony.com/fr/doc/current/cookbook/form/form_collections.html // //$entityClass = substr($type, 10, -1); //echo $entityClasss; - if (str_starts_with($type, 'ManyToOnePersist')) { + if (str_starts_with((string) $type, 'ManyToOnePersist')) { // PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien... // // @@ -112,7 +112,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface if (null === $customFieldsJSON) { $customFieldsArray = []; } else { - $customFieldsArray = json_decode($customFieldsJSON, true, 512, JSON_THROW_ON_ERROR); + $customFieldsArray = json_decode((string) $customFieldsJSON, true, 512, JSON_THROW_ON_ERROR); } $customFieldsArrayRet = []; @@ -123,11 +123,11 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface if (array_key_exists($key, $this->customField)) { $type = $this->customField[$key]->getType(); - if (str_starts_with($type, 'ManyToOne')) { - if (str_starts_with($type, 'ManyToOnePersist')) { - $entityClass = substr($type, 17, -1); + if (str_starts_with((string) $type, 'ManyToOne')) { + if (str_starts_with((string) $type, 'ManyToOnePersist')) { + $entityClass = substr((string) $type, 17, -1); } else { - $entityClass = substr($type, 10, -1); + $entityClass = substr((string) $type, 10, -1); } $customFieldsArrayRet[$key] = $this->om diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php index 93e969e1f..e9da23858 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php @@ -24,7 +24,7 @@ class CustomFieldType extends AbstractType */ private $customFieldCompiler; - public function __construct(private ObjectManager $om, CustomFieldProvider $compiler) + public function __construct(private readonly ObjectManager $om, CustomFieldProvider $compiler) { $this->customFieldCompiler = $compiler; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php index 5f87bbab0..bd75e58b4 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php @@ -46,7 +46,7 @@ class LinkedCustomFieldsType extends AbstractType */ private $options = []; - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } @@ -93,7 +93,7 @@ class LinkedCustomFieldsType extends AbstractType $builder->addEventListener( FormEvents::POST_SET_DATA, - [$this, 'appendChoice'] + $this->appendChoice(...) ); } diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php index be26cd6f3..c0bee2301 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php +++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php @@ -29,7 +29,7 @@ class CustomFieldsHelper * @param CustomFieldProvider $provider The customfield provider that * contains all the declared custom fields */ - public function __construct(private EntityManagerInterface $em, private CustomFieldProvider $provider) + public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) { } diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php index 021999b1d..a7949de25 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php @@ -38,7 +38,7 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa 'label_layout' => 'ChillCustomFieldsBundle:CustomField:render_label.html.twig', ]; - public function __construct(private CustomFieldsHelper $customFieldsHelper) + public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) { } @@ -50,26 +50,17 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa public function getFunctions() { return [ - new TwigFunction('chill_custom_field_widget', [ - $this, - 'renderWidget', - ], [ + new TwigFunction('chill_custom_field_widget', $this->renderWidget(...), [ 'is_safe' => [ 'html', ], ]), - new TwigFunction('chill_custom_field_label', [ - $this, - 'renderLabel', - ], [ + new TwigFunction('chill_custom_field_label', $this->renderLabel(...), [ 'is_safe' => [ 'html', ], ]), - new TwigFunction('chill_custom_field_is_empty', [ - $this, - 'isEmptyValue', - ]), + new TwigFunction('chill_custom_field_is_empty', $this->isEmptyValue(...)), ]; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php index 1291f0849..cf6a55604 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php @@ -53,10 +53,7 @@ class CustomFieldsGroupRenderingTwig extends AbstractExtension implements Contai public function getFunctions() { return [ - new TwigFunction('chill_custom_fields_group_widget', [ - $this, - 'renderWidget', - ], [ + new TwigFunction('chill_custom_fields_group_widget', $this->renderWidget(...), [ 'is_safe' => [ 'html', ], diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php index 2e2c9a9fd..95419e001 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php @@ -14,7 +14,7 @@ namespace Chill\DocGeneratorBundle\Context; use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; -final class ContextManager implements ContextManagerInterface +final readonly class ContextManager implements ContextManagerInterface { /** * @param \Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface[] $contexts diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index 58c2b4e57..ebce55957 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -22,7 +22,7 @@ use Symfony\Component\Routing\Annotation\Route; class AdminDocGeneratorTemplateController extends CRUDController { - public function __construct(private ContextManager $contextManager) + public function __construct(private readonly ContextManager $contextManager) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 7ad660260..a007ff8ff 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -43,7 +43,7 @@ use const JSON_PRETTY_PRINT; final class DocGeneratorTemplateController extends AbstractController { - public function __construct(private ContextManager $contextManager, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private GeneratorInterface $generator, private MessageBusInterface $messageBus, private PaginatorFactory $paginatorFactory, private EntityManagerInterface $entityManager) + public function __construct(private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php index a92dc67f2..8f698cb97 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php +++ b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php @@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class DocGeneratorTemplateType extends AbstractType { - public function __construct(private ContextManager $contextManager) + public function __construct(private readonly ContextManager $contextManager) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php index 90de02914..5e7227a00 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/Exception/TemplateException.php @@ -20,7 +20,7 @@ use Throwable; */ class TemplateException extends RuntimeException { - public function __construct(private 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 2166032e1..7dd1dccf0 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php @@ -24,12 +24,12 @@ use Throwable; final class RelatorioDriver implements DriverInterface { - private string $url; + private readonly string $url; public function __construct( - private HttpClientInterface $client, + private readonly HttpClientInterface $client, ParameterBagInterface $parameterBag, - private LoggerInterface $logger + private readonly LoggerInterface $logger ) { $this->url = $parameterBag->get('chill_doc_generator')['driver']['relatorio']['url']; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php index 6f048ae66..a021e1495 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php @@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private TranslatorInterface $translator, private Security $security) + public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php index 850f9a862..0f2771b4e 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php +++ b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php @@ -19,9 +19,9 @@ use Symfony\Component\HttpFoundation\RequestStack; final class DocGeneratorTemplateRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager, private RequestStack $requestStack) + public function __construct(EntityManagerInterface $entityManager, private readonly RequestStack $requestStack) { $this->repository = $entityManager->getRepository(DocGeneratorTemplate::class); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php index f35736635..0b898d59c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php @@ -19,7 +19,7 @@ use function is_array; class NormalizeNullValueHelper { - public function __construct(private NormalizerInterface $normalizer, private ?string $discriminatorType = null, private ?string $discriminatorValue = null) + public function __construct(private readonly NormalizerInterface $normalizer, private ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php index bda1fda5c..ef02e0073 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php @@ -40,11 +40,11 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - private PropertyAccessor $propertyAccess; + private readonly PropertyAccessor $propertyAccess; public function __construct( - private ClassMetadataFactoryInterface $classMetadataFactory, - private TranslatableStringHelperInterface $translatableStringHelper + private readonly ClassMetadataFactoryInterface $classMetadataFactory, + private readonly TranslatableStringHelperInterface $translatableStringHelper ) { $this->propertyAccess = PropertyAccess::createPropertyAccessor(); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index ad546a97f..afe53c6f9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -19,7 +19,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BaseContextData { - public function __construct(private NormalizerInterface $normalizer) + public function __construct(private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 66136639f..2d5108b74 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -27,7 +27,7 @@ class Generator implements GeneratorInterface { private const LOG_PREFIX = '[docgen generator] '; - public function __construct(private ContextManagerInterface $contextManager, private DriverInterface $driver, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private StoredObjectManagerInterface $storedObjectManager) + public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php index 9024db235..abed586af 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php @@ -19,7 +19,7 @@ class GeneratorException extends RuntimeException /** * @param string[] $errors */ - public function __construct(private 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/Messenger/OnGenerationFails.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php index 7ea3a1dc7..06d396af2 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php @@ -24,7 +24,7 @@ use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent; use Symfony\Contracts\Translation\TranslatorInterface; -final class OnGenerationFails implements EventSubscriberInterface +final readonly class OnGenerationFails implements EventSubscriberInterface { public const LOG_PREFIX = '[docgen failed] '; diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index 99f0854cd..e0f95834b 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -26,11 +26,11 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class RequestGenerationHandler implements MessageHandlerInterface { - public const AUTHORIZED_TRIALS = 5; + final public const AUTHORIZED_TRIALS = 5; private const LOG_PREFIX = '[docgen message handler] '; - public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private Generator $generator, private LoggerInterface $logger, private StoredObjectRepository $storedObjectRepository, private UserRepositoryInterface $userRepository) + public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository) { } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php index 0bc0ec850..092073817 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php @@ -17,20 +17,20 @@ use Chill\MainBundle\Entity\User; class RequestGenerationMessage { - private int $creatorId; + private readonly int $creatorId; - private int $templateId; + private readonly int $templateId; - private int $destinationStoredObjectId; + private readonly int $destinationStoredObjectId; - private \DateTimeImmutable $createdAt; + private readonly \DateTimeImmutable $createdAt; public function __construct( User $creator, DocGeneratorTemplate $template, - private int $entityId, + private readonly int $entityId, StoredObject $destinationStoredObject, - private array $contextGenerationData + private readonly array $contextGenerationData ) { $this->creatorId = $creator->getId(); $this->templateId = $template->getId(); diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php index 3250d4d5a..4ea289a8c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php @@ -135,7 +135,7 @@ final class DocGenObjectNormalizerTest extends KernelTestCase $this->assertEquals($expected, $actual, 'test normalization for a null scope'); } - public function testNormalizeNullObjectWithObjectEmbedded() + public function testNormalizeNullObjectWithObjectEmbedded(): never { $this->markTestIncomplete('test to implement'); $normalized = $this->normalizer->normalize(null, 'docgen', [ @@ -154,7 +154,7 @@ final class DocGenObjectNormalizerTest extends KernelTestCase $this->assertEquals($expected, $normalized, 'test normalization for a null user'); } - public function testNormalizeWithNullValueEmbedded() + public function testNormalizeWithNullValueEmbedded(): never { $this->markTestIncomplete('test to write'); $user = new User(); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index 2c70454b0..0a3a56fdf 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -36,7 +36,7 @@ class DocumentAccompanyingCourseController extends AbstractController /** * DocumentAccompanyingCourseController constructor. */ - public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private PaginatorFactory $paginatorFactory, private AccompanyingCourseDocumentRepository $courseRepository) + public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private readonly PaginatorFactory $paginatorFactory, private readonly AccompanyingCourseDocumentRepository $courseRepository) { } diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 79fb401ea..469e5bf7e 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -42,7 +42,7 @@ class DocumentPersonController extends AbstractController /** * DocumentPersonController constructor. */ - public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private PaginatorFactory $paginatorFactory, private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository) + public function __construct(protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper, private readonly PaginatorFactory $paginatorFactory, private readonly PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository) { } diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index b675d6246..6bfb05bfc 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -20,7 +20,7 @@ use Symfony\Component\Security\Core\Security; class StoredObjectApiController { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index fbfd4ef54..bf2808c19 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -36,9 +36,9 @@ use Symfony\Component\Serializer\Annotation as Serializer; class StoredObject implements AsyncFileInterface, Document, TrackCreationInterface { use TrackCreationTrait; - public const STATUS_READY = "ready"; - public const STATUS_PENDING = "pending"; - public const STATUS_FAILURE = "failure"; + final public const STATUS_READY = "ready"; + final public const STATUS_PENDING = "pending"; + final public const STATUS_FAILURE = "failure"; /** * @ORM\Column(type="json", name="datas") diff --git a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php index 8ae67be51..f3506d631 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php @@ -26,7 +26,7 @@ class DocumentCategoryType extends AbstractType { // TODO faire un service dans CHillMain foreach ($kernelBundles as $key => $value) { - if (str_starts_with($key, 'Chill')) { + if (str_starts_with((string) $key, 'Chill')) { $this->chillBundlesFlipped[$value] = $key; } } diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php index cfe5d5156..5c0b7d501 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php @@ -30,7 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonDocumentType extends AbstractType { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private ScopeResolverDispatcher $scopeResolverDispatcher, private ParameterBagInterface $parameterBag, private CenterResolverDispatcher $centerResolverDispatcher) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher) { } diff --git a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php index 4f3cd315f..c153efae5 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php @@ -57,20 +57,20 @@ class StoredObjectType extends AbstractType $builder ->get('keyInfos') ->addModelTransformer(new CallbackTransformer( - [$this, 'transform'], - [$this, 'reverseTransform'] + $this->transform(...), + $this->reverseTransform(...) )); $builder ->get('iv') ->addModelTransformer(new CallbackTransformer( - [$this, 'transform'], - [$this, 'reverseTransform'] + $this->transform(...), + $this->reverseTransform(...) )); $builder ->addModelTransformer(new CallbackTransformer( - [$this, 'transformObject'], - [$this, 'reverseTransformObject'] + $this->transformObject(...), + $this->reverseTransformObject(...) )); } @@ -95,7 +95,7 @@ class StoredObjectType extends AbstractType return null; } - return json_decode($value, true, 512, JSON_THROW_ON_ERROR); + return json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); } public function reverseTransformObject($object) diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php index 49f7723ce..1f9268bf1 100644 --- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php @@ -19,7 +19,7 @@ use LogicException; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; -final class MenuBuilder implements LocalMenuBuilderInterface +final readonly class MenuBuilder implements LocalMenuBuilderInterface { public function __construct(private Security $security, private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php index 3231bfd79..2679993c4 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/AccompanyingCourseDocumentRepository.php @@ -20,9 +20,9 @@ use Doctrine\Persistence\ObjectRepository; class AccompanyingCourseDocumentRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { $this->repository = $em->getRepository(AccompanyingCourseDocument::class); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php index 9025afd09..22aeb24d2 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/DocumentCategoryRepository.php @@ -21,9 +21,9 @@ use Doctrine\Persistence\ObjectRepository; */ class DocumentCategoryRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { $this->repository = $em->getRepository(DocumentCategory::class); } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index da1809dbb..128a552a8 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -22,7 +22,7 @@ use Symfony\Component\Security\Core\Security; class PersonDocumentACLAwareRepository implements PersonDocumentACLAwareRepositoryInterface { - public function __construct(private EntityManagerInterface $em, private AuthorizationHelperInterface $authorizationHelper, private CenterResolverDispatcher $centerResolverDispatcher, private Security $security) + public function __construct(private readonly EntityManagerInterface $em, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly CenterResolverDispatcher $centerResolverDispatcher, private readonly Security $security) { } diff --git a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php index 82e658620..d2e715f7e 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/StoredObjectRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class StoredObjectRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php index 60bc7060c..f04a6dbf8 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AccompanyingCourseDocumentVoter.php @@ -27,15 +27,15 @@ use function in_array; class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE'; + final public const CREATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE'; - public const DELETE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE'; + final public const DELETE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE'; - public const SEE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE'; + final public const SEE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE'; - public const SEE_DETAILS = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS'; - public const UPDATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE'; + final public const UPDATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE'; protected VoterHelperInterface $voterHelper; diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php index b4a5de4c5..c1c6b1211 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php @@ -25,15 +25,15 @@ use Symfony\Component\Security\Core\Security; class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE'; + final public const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE'; - public const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE'; + final public const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE'; - public const SEE = 'CHILL_PERSON_DOCUMENT_SEE'; + final public const SEE = 'CHILL_PERSON_DOCUMENT_SEE'; - public const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS'; - public const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE'; + final public const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE'; protected VoterHelperInterface $voterHelper; diff --git a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php index d277c7ec9..822a70597 100644 --- a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php +++ b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php @@ -22,7 +22,7 @@ class StoredObjectDenormalizer implements DenormalizerInterface { use ObjectToPopulateTrait; - public function __construct(private StoredObjectRepository $storedObjectRepository) + public function __construct(private readonly StoredObjectRepository $storedObjectRepository) { } diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php index 5e7a54410..56c1e0d9f 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php @@ -35,7 +35,7 @@ final class StoredObjectManager implements StoredObjectManagerInterface private array $inMemory = []; - public function __construct(private HttpClientInterface $client, private TempUrlGeneratorInterface $tempUrlGenerator) + public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator) { } diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index 89655fc35..ad491674d 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -20,7 +20,7 @@ use Twig\Extension\RuntimeExtensionInterface; use function in_array; -final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface +final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface { public const SUPPORTED_MIMES = [ 'image/svg+xml', @@ -151,7 +151,7 @@ final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface 'document_json' => $this->normalizer->normalize($document, 'json', [AbstractNormalizer::GROUPS => ['read']]), 'title' => $title, 'can_edit' => $canEdit, - 'options' => array_merge(self::DEFAULT_OPTIONS_TEMPLATE_BUTTON_GROUP, $options), + 'options' => [...self::DEFAULT_OPTIONS_TEMPLATE_BUTTON_GROUP, ...$options], ]); } diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index 5a7ce406c..328585c62 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -22,14 +22,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandlerInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; /** * TODO: injecter le repository directement. */ public function __construct( EntityManagerInterface $em, - private TranslatorInterface $translator + private readonly TranslatorInterface $translator ) { $this->repository = $em->getRepository(AccompanyingCourseDocument::class); } diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 9cd807479..17550758b 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -36,7 +36,7 @@ class ParticipationController extends AbstractController /** * ParticipationController constructor. */ - public function __construct(private LoggerInterface $logger) + public function __construct(private readonly LoggerInterface $logger) { } @@ -582,7 +582,7 @@ class ParticipationController extends AbstractController $persons_ids = $request->query->has('person_id') ? [$request->query->getInt('person_id', 0)] // sf4 check: // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` - : explode(',', $request->query->get('persons_ids')); + : explode(',', (string) $request->query->get('persons_ids')); $participations = []; foreach ($persons_ids as $person_id) { @@ -746,7 +746,7 @@ class ParticipationController extends AbstractController if (true === $multiple) { $persons_ids = $request->query->get('persons_ids'); - if (!preg_match('/^([0-9]{1,},{0,1}){1,}[0-9]{0,}$/', $persons_ids)) { + if (!preg_match('/^([0-9]{1,},{0,1}){1,}[0-9]{0,}$/', (string) $persons_ids)) { throw new RuntimeException('The persons_ids value should ' . "contains int separated by ','"); } diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index ca1379657..c5a8f953f 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -176,7 +176,7 @@ class Event implements HasCenterInterface, HasScopeInterface { $iterator = $this->participations->getIterator(); - $iterator->uasort(static fn ($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName())); + $iterator->uasort(static fn ($first, $second) => strnatcasecmp((string) $first->getPerson()->getFirstName(), (string) $second->getPerson()->getFirstName())); return $iterator; } diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 8a396e5cb..6b4192004 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -38,7 +38,7 @@ use function count; */ class EventSearch extends AbstractSearch { - public const NAME = 'event_regular'; + final public const NAME = 'event_regular'; /** * @var \Chill\MainBundle\Entity\User @@ -47,10 +47,10 @@ class EventSearch extends AbstractSearch public function __construct( TokenStorageInterface $tokenStorage, - private EntityRepository $er, - private AuthorizationHelper $helper, - private TemplatingEngine $templating, - private PaginatorFactory $paginationFactory + private readonly EntityRepository $er, + private readonly AuthorizationHelper $helper, + private readonly TemplatingEngine $templating, + private readonly PaginatorFactory $paginationFactory ) { $this->user = $tokenStorage->getToken()->getUser(); } diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php index ade1b48de..691939120 100644 --- a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php +++ b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php @@ -31,20 +31,20 @@ use function in_array; */ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_EVENT_CREATE'; + final public const CREATE = 'CHILL_EVENT_CREATE'; - public const ROLES = [ + final public const ROLES = [ self::SEE, self::SEE_DETAILS, self::CREATE, self::UPDATE, ]; - public const SEE = 'CHILL_EVENT_SEE'; + final public const SEE = 'CHILL_EVENT_SEE'; - public const SEE_DETAILS = 'CHILL_EVENT_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_EVENT_SEE_DETAILS'; - public const UPDATE = 'CHILL_EVENT_UPDATE'; + final public const UPDATE = 'CHILL_EVENT_UPDATE'; /** * @var AccessDecisionManagerInterface diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php index 12c01ca60..b0c588560 100644 --- a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php +++ b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php @@ -28,20 +28,20 @@ use function in_array; class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_EVENT_PARTICIPATION_CREATE'; + final public const CREATE = 'CHILL_EVENT_PARTICIPATION_CREATE'; - public const ROLES = [ + final public const ROLES = [ self::SEE, self::SEE_DETAILS, self::CREATE, self::UPDATE, ]; - public const SEE = 'CHILL_EVENT_PARTICIPATION_SEE'; + final public const SEE = 'CHILL_EVENT_PARTICIPATION_SEE'; - public const SEE_DETAILS = 'CHILL_EVENT_PARTICIPATION_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_EVENT_PARTICIPATION_SEE_DETAILS'; - public const UPDATE = 'CHILL_EVENT_PARTICIPATION_UPDATE'; + final public const UPDATE = 'CHILL_EVENT_PARTICIPATION_UPDATE'; /** * @var AccessDecisionManagerInterface diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php index 01f5e1b1a..cece09a99 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class EventControllerTest extends WebTestCase { - public function testSkipped() + public function testSkipped(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php index 23394d43c..8e351066d 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class EventTypeControllerTest extends WebTestCase { - public function testSkipped() + public function testSkipped(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php index 937bf8e49..3839a1647 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class RoleControllerTest extends WebTestCase { - public function testSkipped() + public function testSkipped(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php index 04a6e6270..e573edaab 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class StatusControllerTest extends WebTestCase { - public function testSkipped() + public function testSkipped(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php index 131d6051d..f81804b1b 100644 --- a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php @@ -373,7 +373,7 @@ final class EventSearchTest extends WebTestCase // get the second node, which should contains a date $tdDate = $tr->filter('td')->eq(1); // transform the date, which should be in french, into a DateTime object - $parts = explode(' ', $tdDate->text()); + $parts = explode(' ', (string) $tdDate->text()); return DateTime::createFromFormat('Y-m-d', $parts[2] . '-' . $months[$parts[1]] . '-' . $parts[0]); diff --git a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php index 34a83dfcb..a886294bb 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php +++ b/src/Bundle/ChillFamilyMembersBundle/Controller/FamilyMemberController.php @@ -28,7 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class FamilyMemberController extends AbstractController { - public function __construct(private EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger, private FamilyMemberRepository $familyMemberRepository) + public function __construct(private readonly EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger, private readonly FamilyMemberRepository $familyMemberRepository) { } diff --git a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php index 4c45691e5..c317633e7 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php +++ b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php @@ -25,7 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class FamilyMemberType extends AbstractType { - public function __construct(private ConfigRepository $configRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ConfigRepository $configRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php index 027597cc9..68fd332ff 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php +++ b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php @@ -23,20 +23,20 @@ use function in_array; class FamilyMemberVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_CREATE'; + final public const CREATE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_CREATE'; - public const DELETE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_DELETE'; + final public const DELETE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_DELETE'; - public const ROLES = [ + final public const ROLES = [ self::CREATE, self::DELETE, self::SHOW, self::UPDATE, ]; - public const SHOW = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_SHOW'; + final public const SHOW = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_SHOW'; - public const UPDATE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_UPDATE'; + final public const UPDATE = 'CHILL_FAMILY_MEMBERS_FAMILY_MEMBERS_UPDATE'; /** * @var AuthorizationHelper diff --git a/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php b/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php index a2bed6319..05ccdc493 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php +++ b/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php @@ -73,17 +73,17 @@ class Twig extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_family_member_link_display', [$this, 'displayLink'], ['is_safe' => ['html']]), - new TwigFilter('chill_family_member_professional_situation_display', [$this, 'displayProfessionalSituation'], ['is_safe' => ['html']]), - new TwigFilter('chill_family_member_familial_situation_display', [$this, 'displayFamilialSituation'], ['is_safe' => ['html']]), + new TwigFilter('chill_family_member_link_display', $this->displayLink(...), ['is_safe' => ['html']]), + new TwigFilter('chill_family_member_professional_situation_display', $this->displayProfessionalSituation(...), ['is_safe' => ['html']]), + new TwigFilter('chill_family_member_familial_situation_display', $this->displayFamilialSituation(...), ['is_safe' => ['html']]), ]; } public function getFunctions() { return [ - new TwigFunction('chill_family_members_has_professionnal_situation', [$this, 'hasProfessionnalSituation']), - new TwigFunction('chill_family_members_has_familial_situation', [$this, 'hasFamilialSituation']), + new TwigFunction('chill_family_members_has_professionnal_situation', $this->hasProfessionnalSituation(...)), + new TwigFunction('chill_family_members_has_familial_situation', $this->hasFamilialSituation(...)), ]; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php b/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php index aa06fbf2d..6068a5391 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php +++ b/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php @@ -25,17 +25,17 @@ class Resolver /** * The key to get the role necessary for the action. */ - public const ROLE = 'role'; + final public const ROLE = 'role'; /** * @deprecated */ - public const ROLE_EDIT = 'role.edit'; + final public const ROLE_EDIT = 'role.edit'; /** * @deprecated */ - public const ROLE_VIEW = 'role.view'; + final public const ROLE_VIEW = 'role.view'; /** * @var array diff --git a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php index afa3eab30..845bc145b 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php +++ b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php @@ -54,12 +54,12 @@ class TwigCRUDResolver extends AbstractExtension return [ new TwigFunction( 'chill_crud_config', - [$this, 'getConfig'], + $this->getConfig(...), ['is_safe' => 'html'] ), new TwigFunction( 'chill_crud_action_exists', - [$this, 'hasAction'], + $this->hasAction(...), [] ), ]; diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index d4c3dcb42..48d460875 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -138,8 +138,8 @@ class ChillImportUsersCommand extends Command { $user = new User(); $user - ->setEmail(trim($data['email'])) - ->setUsername(trim($data['username'])) + ->setEmail(trim((string) $data['email'])) + ->setUsername(trim((string) $data['username'])) ->setEnabled(true) ->setPassword($this->passwordEncoder->encodePassword( $user, diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index 5f62d39ed..b7ef472a4 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -160,7 +160,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command try { if (array_key_exists('email', $row)) { - return $userRepository->findOneByUsernameOrEmail(trim($row['email'])); + return $userRepository->findOneByUsernameOrEmail(trim((string) $row['email'])); } } catch (\Doctrine\ORM\NoResultException) { // continue, we will try username @@ -168,7 +168,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command try { if (array_key_exists('username', $row)) { - return $userRepository->findOneByUsernameOrEmail(trim($row['username'])); + return $userRepository->findOneByUsernameOrEmail(trim((string) $row['username'])); } } catch (\Doctrine\ORM\NoResultException) { return null; diff --git a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php index e2d7bd6dd..b3f9a9f4d 100644 --- a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ExecuteCronJobCommand extends Command { public function __construct( - private CronManagerInterface $cronManager + private readonly CronManagerInterface $cronManager ) { parent::__construct('chill:cron-job:execute'); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php index 0335f11ee..710dedb8f 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php @@ -21,8 +21,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesBEFromBestAddressCommand extends Command { public function __construct( - private AddressReferenceBEFromBestAddress $addressImporter, - private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter + private readonly AddressReferenceBEFromBestAddress $addressImporter, + private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter ) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php index 732355a44..8f51a7335 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php @@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesFRFromBANOCommand extends Command { - public function __construct(private AddressReferenceFromBano $addressReferenceFromBano) + public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index 702a71403..729051ea3 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -26,9 +26,9 @@ use function in_array; */ class LoadAndUpdateLanguagesCommand extends Command { - public const INCLUDE_ANCIENT = 'include_ancient'; + final public const INCLUDE_ANCIENT = 'include_ancient'; - public const INCLUDE_REGIONAL_VERSION = 'include_regional'; + final public const INCLUDE_REGIONAL_VERSION = 'include_regional'; // Array of ancien languages (to exclude) private $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga', @@ -43,7 +43,7 @@ class LoadAndUpdateLanguagesCommand extends Command * * @param $availableLanguages */ - public function __construct(private EntityManager $entityManager, private $availableLanguages) + public function __construct(private readonly EntityManager $entityManager, private $availableLanguages) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index 01400a9ad..c5cbdd78a 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -25,7 +25,7 @@ class LoadCountriesCommand extends Command * * @param $availableLanguages */ - public function __construct(private EntityManager $entityManager, private $availableLanguages) + public function __construct(private readonly EntityManager $entityManager, private $availableLanguages) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php index 6d1999127..be29cad9f 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadPostalCodeFR extends Command { - public function __construct(private PostalCodeFRFromOpenData $loader) + public function __construct(private readonly PostalCodeFRFromOpenData $loader) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 208f67cab..7bda1d672 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -30,7 +30,7 @@ use function strlen; class LoadPostalCodesCommand extends Command { - public function __construct(private EntityManagerInterface $entityManager, private ValidatorInterface $validator) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator) { parent::__construct(); } @@ -90,7 +90,7 @@ class LoadPostalCodesCommand extends Command 0, $input->getOption('delimiter'), $input->getOption('enclosure'), - $input->getOption('escape') + (string) $input->getOption('escape') )) ) { try { @@ -109,7 +109,7 @@ class LoadPostalCodesCommand extends Command private function addPostalCode($row, OutputInterface $output) { - if ('FR' === $row[2] && strlen($row[0]) === 4) { + if ('FR' === $row[2] && strlen((string) $row[0]) === 4) { // CP in FRANCE are on 5 digit // For CP starting with a zero, the starting zero can be remove if stored as number in a csv // add a zero if CP from FR and on 4 digit diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php index 16619bf54..c5eec91be 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -29,7 +29,7 @@ class SetPasswordCommand extends Command /** * SetPasswordCommand constructor. */ - public function __construct(private EntityManager $entityManager) + public function __construct(private readonly EntityManager $entityManager) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index 68a0afdb6..b80bc2524 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -28,7 +28,7 @@ use function trim; final class AddressReferenceAPIController extends ApiController { - public function __construct(private AddressReferenceRepository $addressReferenceRepository, private PaginatorFactory $paginatorFactory) + public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) { } @@ -45,7 +45,7 @@ final class AddressReferenceAPIController extends ApiController $pattern = $request->query->get('q'); - if ('' === trim($pattern)) { + if ('' === trim((string) $pattern)) { throw new BadRequestHttpException('the search pattern is empty'); } diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index fc92cd299..079f4783b 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -23,7 +23,7 @@ use Symfony\Component\Serializer\SerializerInterface; class AddressToReferenceMatcherController { - public function __construct(private Security $security, private EntityManagerInterface $entityManager, private SerializerInterface $serializer) + public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) { } diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 9e62cacf6..07d7907f6 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -47,7 +47,7 @@ use function unserialize; */ class ExportController extends AbstractController { - public function __construct(private ChillRedis $redis, private ExportManager $exportManager, private FormFactoryInterface $formFactory, private LoggerInterface $logger, private SessionInterface $session, private TranslatorInterface $translator, private EntityManagerInterface $entityManager) + public function __construct(private readonly ChillRedis $redis, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly LoggerInterface $logger, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly EntityManagerInterface $entityManager) { } @@ -234,7 +234,7 @@ class ExportController extends AbstractController { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; - $isGenerate = str_starts_with($step, 'generate_'); + $isGenerate = str_starts_with((string) $step, 'generate_'); $builder = $this->formFactory ->createNamedBuilder(null, FormType::class, [], [ diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index 6ab4a6e3e..a8a9c0610 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -24,7 +24,7 @@ use Symfony\Component\Serializer\SerializerInterface; class GeographicalUnitByAddressApiController { - public function __construct(private PaginatorFactory $paginatorFactory, private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private Security $security, private SerializerInterface $serializer) + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) { } diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 52810cd97..1e371b970 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -33,7 +33,7 @@ use UnexpectedValueException; */ class NotificationApiController { - public function __construct(private EntityManagerInterface $entityManager, private NotificationRepository $notificationRepository, private PaginatorFactory $paginatorFactory, private Security $security, private SerializerInterface $serializer) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) { } diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index d2d37ad77..5715b2f56 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -41,7 +41,7 @@ use function in_array; */ class NotificationController extends AbstractController { - public function __construct(private EntityManagerInterface $em, private LoggerInterface $chillLogger, private LoggerInterface $logger, private Security $security, private NotificationRepository $notificationRepository, private NotificationHandlerManager $notificationHandlerManager, private PaginatorFactory $paginatorFactory, private TranslatorInterface $translator, private UserRepository $userRepository) + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly Security $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index a28ca46f4..60f2d1ffb 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -24,7 +24,7 @@ use function json_decode; class PermissionApiController extends AbstractController { - public function __construct(private DenormalizerInterface $denormalizer, private Security $security) + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index f1b485870..bdcaf861a 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -37,7 +37,7 @@ class PermissionsGroupController extends AbstractController /** * PermissionsGroupController constructor. */ - public function __construct(private TranslatableStringHelper $translatableStringHelper, private RoleProvider $roleProvider, private RoleHierarchy $roleHierarchy, private TranslatorInterface $translator, private ValidatorInterface $validator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly RoleProvider $roleProvider, private readonly RoleHierarchy $roleHierarchy, private readonly TranslatorInterface $translator, private readonly ValidatorInterface $validator) { } diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index 945ad8fcf..e51f74e40 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -26,7 +26,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class PostalCodeAPIController extends ApiController { - public function __construct(private CountryRepository $countryRepository, private PostalCodeRepositoryInterface $postalCodeRepository, private PaginatorFactory $paginatorFactory) + public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) { } @@ -43,7 +43,7 @@ final class PostalCodeAPIController extends ApiController $pattern = $request->query->get('q'); - if ('' === trim($pattern)) { + if ('' === trim((string) $pattern)) { throw new BadRequestHttpException('the search pattern is empty'); } diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index f5e84c1b3..923394da9 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -36,7 +36,7 @@ use function count; class SavedExportController { - public function __construct(private EngineInterface $templating, private EntityManagerInterface $entityManager, private ExportManager $exportManager, private FormFactoryInterface $formFactory, private SavedExportRepositoryInterface $savedExportRepository, private Security $security, private SessionInterface $session, private TranslatorInterface $translator, private UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly EngineInterface $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index dfaaa50d4..097b71d0e 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -103,7 +103,7 @@ class SearchController extends AbstractController public function searchAction(Request $request, $_format) { - $pattern = trim($request->query->get('q', '')); + $pattern = trim((string) $request->query->get('q', '')); if ('' === $pattern) { switch ($_format) { diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index fdb521882..f031c8ef1 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -22,7 +22,7 @@ use function count; class TimelineCenterController extends AbstractController { - public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private Security $security) + public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index f8e512f78..af7620356 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -36,9 +36,9 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class UserController extends CRUDController { - public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter'; + final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter'; - public function __construct(private LoggerInterface $logger, private ValidatorInterface $validator, private UserPasswordEncoderInterface $passwordEncoder, private UserRepository $userRepository, protected ParameterBagInterface $parameterBag) + public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag) { } diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index dfb06d3df..5de0e1252 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -30,7 +30,7 @@ use Symfony\Component\Serializer\SerializerInterface; class WorkflowApiController { - public function __construct(private EntityManagerInterface $entityManager, private EntityWorkflowRepository $entityWorkflowRepository, private PaginatorFactory $paginatorFactory, private Security $security, private SerializerInterface $serializer) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) { } diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index b3d2ad475..6b3680b51 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -39,7 +39,7 @@ use function count; class WorkflowController extends AbstractController { - public function __construct(private EntityWorkflowManager $entityWorkflowManager, private EntityWorkflowRepository $entityWorkflowRepository, private ValidatorInterface $validator, private PaginatorFactory $paginatorFactory, private Registry $registry, private EntityManagerInterface $entityManager, private TranslatorInterface $translator, private Security $security) + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index 0bf928ee1..da3316b11 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -49,7 +49,7 @@ class CronManager implements CronManagerInterface /** * @param CronJobInterface[] $jobs */ - public function __construct(private CronJobExecutionRepositoryInterface $cronJobExecutionRepository, private EntityManagerInterface $entityManager, private iterable $jobs, private LoggerInterface $logger) + public function __construct(private readonly CronJobExecutionRepositoryInterface $cronJobExecutionRepository, private readonly EntityManagerInterface $entityManager, private readonly iterable $jobs, private readonly LoggerInterface $logger) { } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index 0d3b79fa0..8b6862364 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -84,7 +84,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde ->getEncoder($user) ->encodePassword('password', $user->getSalt()) ) - ->setEmail(sprintf('%s@chill.social', str_replace(' ', '', $username))); + ->setEmail(sprintf('%s@chill.social', str_replace(' ', '', (string) $username))); foreach ($params['groupCenterRefs'] as $groupCenterRef) { $user->addGroupCenter($this->getReference($groupCenterRef)); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php index f9fdb80d0..88d72bddf 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php @@ -36,7 +36,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface { $config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages'), true); // weird fix for special characters - $config['dsn'] = str_replace(['%%'], ['%'], $config['dsn']); + $config['dsn'] = str_replace(['%%'], ['%'], (string) $config['dsn']); $dsn = parse_url($config['dsn']); parse_str($dsn['query'] ?? '', $dsn['queries']); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 0c5fd56c9..7cfe8cfb6 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface public function __construct( array $widgetFactories, - private ContainerBuilder $containerBuilder + private readonly ContainerBuilder $containerBuilder ) { $this->setWidgetFactories($widgetFactories); } diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index 0c8159df3..624167fec 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -22,7 +22,7 @@ use Symfony\Component\Security\Core\Security; class TrackCreateUpdateSubscriber implements EventSubscriber { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index de73bdf5a..03f1e7a8e 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -20,7 +20,7 @@ class Point implements JsonSerializable { public static string $SRID = '4326'; - private function __construct(private ?float $lon, private ?float $lat) + private function __construct(private readonly ?float $lon, private readonly ?float $lat) { } diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php index 91033ec0b..c060dec60 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php @@ -29,7 +29,7 @@ use function reset; */ class NativeDateIntervalType extends DateIntervalType { - public const FORMAT = '%rP%YY%MM%DDT%HH%IM%SS'; + final public const FORMAT = '%rP%YY%MM%DDT%HH%IM%SS'; public function convertToDatabaseValue($value, AbstractPlatform $platform) { @@ -51,7 +51,7 @@ class NativeDateIntervalType extends DateIntervalType } try { - $strings = explode(' ', $value); + $strings = explode(' ', (string) $value); if (count($strings) === 0) { return null; @@ -101,8 +101,8 @@ class NativeDateIntervalType extends DateIntervalType return $current . $unit; } - if (preg_match('/([0-9]{2}\:[0-9]{2}:[0-9]{2})/', $current) === 1) { - $tExploded = explode(':', $current); + if (preg_match('/([0-9]{2}\:[0-9]{2}:[0-9]{2})/', (string) $current) === 1) { + $tExploded = explode(':', (string) $current); $intervalSpec = 'T'; $intervalSpec .= $tExploded[0] . 'H'; $intervalSpec .= $tExploded[1] . 'M'; diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php index e1849574b..ce9074592 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php @@ -21,7 +21,7 @@ use Doctrine\DBAL\Types\Type; */ class PointType extends Type { - public const POINT = 'point'; + final public const POINT = 'point'; public function canRequireSQLConversion() { diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 52e8d7c62..f753a048a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -40,19 +40,19 @@ class Address implements TrackCreationInterface, TrackUpdateInterface /** * When an Address does match with the AddressReference */ - public const ADDR_REFERENCE_STATUS_MATCH = 'match'; + final public const ADDR_REFERENCE_STATUS_MATCH = 'match'; /** * When an Address does not match with the AddressReference, and * is pending for a review */ - public const ADDR_REFERENCE_STATUS_TO_REVIEW = 'to_review'; + final public const ADDR_REFERENCE_STATUS_TO_REVIEW = 'to_review'; /** * When an Address does not match with the AddressReference, but * is reviewed */ - public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed'; + final public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed'; /** * @ORM\ManyToOne(targetEntity=AddressReference::class) diff --git a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php index ea3d47f72..5b80f41be 100644 --- a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php +++ b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php @@ -20,9 +20,9 @@ use Doctrine\ORM\Mapping as ORM; */ class CronJobExecution { - public const FAILURE = 100; + final public const FAILURE = 100; - public const SUCCESS = 1; + final public const SUCCESS = 1; /** * @var DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index 42d1aa960..902ffce4d 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -27,15 +27,15 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; */ class LocationType { - public const DEFAULT_FOR_3PARTY = 'thirdparty'; + final public const DEFAULT_FOR_3PARTY = 'thirdparty'; - public const DEFAULT_FOR_PERSON = 'person'; + final public const DEFAULT_FOR_PERSON = 'person'; - public const STATUS_NEVER = 'never'; + final public const STATUS_NEVER = 'never'; - public const STATUS_OPTIONAL = 'optional'; + final public const STATUS_OPTIONAL = 'optional'; - public const STATUS_REQUIRED = 'required'; + final public const STATUS_REQUIRED = 'required'; /** * @ORM\Column(type="boolean", nullable=true) diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index 9b8fb340e..d3295e956 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -71,9 +71,9 @@ class ExportManager private $user; public function __construct( - private LoggerInterface $logger, - private AuthorizationCheckerInterface $authorizationChecker, - private AuthorizationHelperInterface $authorizationHelper, + private readonly LoggerInterface $logger, + private readonly AuthorizationCheckerInterface $authorizationChecker, + private readonly AuthorizationHelperInterface $authorizationHelper, TokenStorageInterface $tokenStorage, iterable $exports, iterable $aggregators, diff --git a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 6b780715b..5c5e24318 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class DateTimeHelper { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php index 465fe6608..e96987760 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -32,25 +32,25 @@ class ExportAddressHelper /** * Compute all the F_* constants. */ - public const F_ALL = + final public const F_ALL = self::F_ATTRIBUTES | self::F_BUILDING | self::F_COUNTRY | self::F_GEOM | self::F_POSTAL_CODE | self::F_STREET | self::F_GEOGRAPHICAL_UNITS; - public const F_AS_STRING = 0b00010000; + final public const F_AS_STRING = 0b00010000; - public const F_ATTRIBUTES = 0b01000000; + final public const F_ATTRIBUTES = 0b01000000; - public const F_BUILDING = 0b00001000; + final public const F_BUILDING = 0b00001000; - public const F_COUNTRY = 0b00000001; + final public const F_COUNTRY = 0b00000001; - public const F_GEOGRAPHICAL_UNITS = 0b1000000000; + final public const F_GEOGRAPHICAL_UNITS = 0b1000000000; - public const F_GEOM = 0b00100000; + final public const F_GEOM = 0b00100000; - public const F_POSTAL_CODE = 0b00000010; + final public const F_POSTAL_CODE = 0b00000010; - public const F_STREET = 0b00000100; + final public const F_STREET = 0b00000100; private const ALL = [ 'country' => self::F_COUNTRY, @@ -84,7 +84,7 @@ class ExportAddressHelper */ private ?array $unitRefsKeysCache = []; - public function __construct(private AddressRender $addressRender, private AddressRepository $addressRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } @@ -253,7 +253,7 @@ class ExportAddressHelper public function getLabel($key, array $values, $data, string $prefix = '', string $translationPrefix = 'export.address_helper.'): callable { - $sanitizedKey = substr($key, strlen($prefix)); + $sanitizedKey = substr((string) $key, strlen($prefix)); switch ($sanitizedKey) { case 'id': @@ -333,7 +333,7 @@ class ExportAddressHelper }; default: - $layerNamesKeys = array_merge($this->generateKeysForUnitsNames($prefix), $this->generateKeysForUnitsRefs($prefix)); + $layerNamesKeys = [...$this->generateKeysForUnitsNames($prefix), ...$this->generateKeysForUnitsRefs($prefix)]; if (array_key_exists($key, $layerNamesKeys)) { return function ($value) use ($key, $layerNamesKeys) { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php index 37a41325e..9077ad8b0 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -21,7 +21,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ class TranslatableStringExportLabelHelper { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index cb13ac1c9..d77e7190e 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -18,7 +18,7 @@ use const SORT_NUMERIC; class UserHelper { - public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) + public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) { } diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 18fceeb5c..10f9c26e3 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\Security; final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index bb5f64895..267927ff1 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -16,7 +16,7 @@ use Symfony\Component\Form\DataMapperInterface; class ScopePickerDataMapper implements DataMapperInterface { - public function __construct(private ?Scope $scope = null) + public function __construct(private readonly ?Scope $scope = null) { } diff --git a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php index 48dd0dc7c..d392fb90a 100644 --- a/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/DataTransformer/IdToEntityDataTransformer.php @@ -29,12 +29,12 @@ use function call_user_func; */ class IdToEntityDataTransformer implements DataTransformerInterface { - private Closure $getId; + private readonly Closure $getId; /** * @param Closure $getId */ - public function __construct(private ObjectRepository $repository, private bool $multiple = false, ?callable $getId = null) + public function __construct(private readonly ObjectRepository $repository, private readonly bool $multiple = false, ?callable $getId = null) { $this->getId = $getId ?? static fn (object $o) => $o->getId(); } diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php index 2f64f0699..a816e7371 100644 --- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php +++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php @@ -15,7 +15,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CustomizeFormEvent extends \Symfony\Component\EventDispatcher\Event { - public const NAME = 'chill_main.customize_form'; + final public const NAME = 'chill_main.customize_form'; public function __construct(protected string $type, protected FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php index dd102dfc6..e4748d850 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class LocationFormType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php index 16aafeb41..1ff8b2647 100644 --- a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php +++ b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php @@ -24,7 +24,7 @@ use function count; class PermissionsGroupType extends AbstractType { - public const FLAG_SCOPE = 'permissions_group'; + final public const FLAG_SCOPE = 'permissions_group'; /** * @var PermissionsGroupFlagProvider[] diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php index 159d2ec1e..700726619 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php @@ -20,9 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ChillPhoneNumberType extends AbstractType { - private string $defaultCarrierCode; + private readonly string $defaultCarrierCode; - private PhoneNumberUtil $phoneNumberUtil; + private readonly PhoneNumberUtil $phoneNumberUtil; public function __construct(ParameterBagInterface $parameterBag) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php index d9a469dec..4b9b95031 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php @@ -44,7 +44,7 @@ class ComposedRoleScopeType extends AbstractType private $rolesWithoutScope = []; public function __construct( - private TranslatableStringHelper $translatableStringHelper, + private readonly TranslatableStringHelper $translatableStringHelper, RoleProvider $roleProvider ) { $this->roles = $roleProvider->getRoles(); diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php index a9774d06e..c04a4b158 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Repository\AddressRepository; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; -final class AddressToIdDataTransformer implements DataTransformerInterface +final readonly class AddressToIdDataTransformer implements DataTransformerInterface { public function __construct(private AddressRepository $addressRepository) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index b195a5905..e9c745118 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -23,7 +23,7 @@ use function count; class CenterTransformer implements DataTransformerInterface { - public function __construct(private CenterRepository $centerRepository, private bool $multiple = false) + public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false) { } @@ -40,7 +40,7 @@ class CenterTransformer implements DataTransformerInterface $ids = []; if ($this->multiple) { - $ids = explode(',', $id); + $ids = explode(',', (string) $id); } else { $ids[] = (int) $id; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php index 9ab91222c..044946716 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -25,7 +25,7 @@ use function array_key_exists; class EntityToJsonTransformer implements DataTransformerInterface { - public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private bool $multiple, private string $type) + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type) { } @@ -35,7 +35,7 @@ class EntityToJsonTransformer implements DataTransformerInterface return null; } - $denormalized = json_decode($value, true, 512, JSON_THROW_ON_ERROR); + $denormalized = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); if ($this->multiple) { if (null === $denormalized) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php index 345df74bd..1284cbaa8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface; class MultipleObjectsToIdTransformer implements DataTransformerInterface { - public function __construct(private EntityManagerInterface $em, private ?string $class = null) + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php index fe87fdb6c..23bc4c5ca 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ObjectToIdTransformer implements DataTransformerInterface { - public function __construct(private EntityManagerInterface $em, private ?string $class = null) + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php index d18e3de8c..643ac0e62 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php @@ -20,7 +20,7 @@ use function is_int; class PostalCodeToIdTransformer implements DataTransformerInterface { - public function __construct(private PostalCodeRepositoryInterface $postalCodeRepository) + public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php index bdd981706..81179c0be 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php @@ -18,7 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ScopeTransformer implements DataTransformerInterface { - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php index bfb408cca..cf47d528b 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php @@ -20,13 +20,13 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ExportType extends AbstractType { - public const AGGREGATOR_KEY = 'aggregators'; + final public const AGGREGATOR_KEY = 'aggregators'; - public const EXPORT_KEY = 'export'; + final public const EXPORT_KEY = 'export'; - public const FILTER_KEY = 'filters'; + final public const FILTER_KEY = 'filters'; - public const PICK_FORMATTER_KEY = 'pick_formatter'; + final public const PICK_FORMATTER_KEY = 'pick_formatter'; /** * @var ExportManager diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php index 153f8946b..6446304a6 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php @@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class FilterType extends AbstractType { - public const ENABLED_FIELD = 'enabled'; + final public const ENABLED_FIELD = 'enabled'; public function __construct() { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index ef8dfb62e..598d983fb 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -33,13 +33,13 @@ final class PickCenterType extends AbstractType { public const CENTERS_IDENTIFIERS = 'c'; - private UserInterface $user; + private readonly UserInterface $user; public function __construct( TokenStorageInterface $tokenStorage, - private ExportManager $exportManager, - private RegroupmentRepository $regroupmentRepository, - private AuthorizationHelperInterface $authorizationHelper + private readonly ExportManager $exportManager, + private readonly RegroupmentRepository $regroupmentRepository, + private readonly AuthorizationHelperInterface $authorizationHelper ) { $this->user = $tokenStorage->getToken()->getUser(); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index d0dbfbe53..6a9c57420 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -27,7 +27,7 @@ use function count; final class FilterOrderType extends \Symfony\Component\Form\AbstractType { - public function __construct(private RequestStack $requestStack) + public function __construct(private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php index dbbdf502f..2bb1dad0e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php @@ -43,7 +43,7 @@ use function uniqid; */ final class PickAddressType extends AbstractType { - public function __construct(private AddressToIdDataTransformer $addressToIdDataTransformer, private TranslatorInterface $translator) + public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php index 2a7ab259c..abe190de5 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php @@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickCivilityType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php index cc9737270..7fb50fd4a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php @@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickLocationTypeType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php index 2ef990704..041176905 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php @@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickPostalCodeType extends AbstractType { - public function __construct(private PostalCodeToIdTransformer $postalCodeToIdTransformer) + public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php index a4492526f..b60401a46 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php @@ -55,7 +55,7 @@ class PickRollingDateType extends AbstractType 'class' => RollingDate::class, 'empty_data' => new RollingDate(RollingDate::T_TODAY), 'constraints' => [ - new Callback([$this, 'validate']), + new Callback($this->validate(...)), ], ]); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index 1b0a3c6e0..a12042dab 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -27,7 +27,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickUserDynamicType extends AbstractType { - public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php index cc8171c4a..2fb695e85 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php @@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickUserLocationType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private LocationRepository $locationRepository) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 28894a421..8229d4074 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -42,7 +42,7 @@ use function count; */ class ScopePickerType extends AbstractType { - public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php index c22c3f523..eaaf0e9b2 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -29,7 +29,7 @@ use const SORT_STRING; */ class Select2CountryType extends AbstractType { - public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index 7e5adb0cf..7e6d1589a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -29,7 +29,7 @@ use const SORT_STRING; */ class Select2LanguageType extends AbstractType { - public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) { } diff --git a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php index 580f2ca09..118b91226 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php @@ -28,7 +28,7 @@ class TranslatableStringFormType extends AbstractType private $frameworkTranslatorFallback; // The langagues used for the translation - public function __construct(private array $availableLanguages, Translator $translator) + public function __construct(private readonly array $availableLanguages, Translator $translator) { $this->frameworkTranslatorFallback = $translator->getFallbackLocales(); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php index 38987d8fb..791063f0a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php @@ -49,7 +49,7 @@ class UserPickerType extends AbstractType TokenStorageInterface $tokenStorage, protected UserRepository $userRepository, protected UserACLAwareRepositoryInterface $userACLAwareRepository, - private UserRender $userRender + private readonly UserRender $userRender ) { $this->authorizationHelper = $authorizationHelper; $this->tokenStorage = $tokenStorage; diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 63f319de4..c787b1207 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -35,7 +35,7 @@ use Symfony\Component\Validator\Constraints\Regex; class UserType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) { } diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index e967d299f..54b1a9fd7 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -36,7 +36,7 @@ use function array_key_exists; class WorkflowStepType extends AbstractType { - public function __construct(private EntityWorkflowManager $entityWorkflowManager, private Registry $registry, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index cbafdcfaf..50da55240 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -23,7 +23,7 @@ use Doctrine\ORM\Event\PreFlushEventArgs; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Security\Core\User\UserInterface; -final class NotificationByUserCounter implements NotificationCounterInterface +final readonly class NotificationByUserCounter implements NotificationCounterInterface { public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) { diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 3d63c28a9..0850e1e4a 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -25,7 +25,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class NotificationMailer { - public function __construct(private MailerInterface $mailer, private LoggerInterface $logger, private TranslatorInterface $translator) + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php index 0601f0141..7051ee05e 100644 --- a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php @@ -19,7 +19,7 @@ use function count; class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface { - public function __construct(private EntityManagerInterface $em, private NotificationPersisterInterface $persister) + public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) { } diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index b65d29c8d..082bff84c 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -40,7 +40,7 @@ class Mailer * @param $routeParameters * @param mixed[] $routeParameters */ - public function __construct(private MailerInterface $mailer, private LoggerInterface $logger, private EngineInterface $twig, private RouterInterface $router, private TranslatorInterface $translator, protected $routeParameters) + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly EngineInterface $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) { } diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php index d39bc8a00..04116a434 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Notification\Exception\NotificationHandlerNotFound; use Doctrine\ORM\EntityManagerInterface; -final class NotificationHandlerManager +final readonly class NotificationHandlerManager { public function __construct(private iterable $handlers, private EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php index 51cb73ccf..ad926d4be 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php @@ -24,7 +24,7 @@ class NotificationPresence { private array $cache = []; - public function __construct(private Security $security, private NotificationRepository $notificationRepository) + public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) { } diff --git a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php index 3c31b7201..d0f3b0930 100644 --- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php @@ -21,7 +21,7 @@ use Twig\Extension\RuntimeExtensionInterface; class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private FormFactoryInterface $formFactory, private NotificationPresence $notificationPresence, private UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php index 97d4629c7..d66adb974 100644 --- a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php +++ b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php @@ -25,7 +25,7 @@ class ChillItemsPerPageTwig extends AbstractExtension return [ new TwigFunction( 'chill_items_per_page', - [$this, 'paginationRender'], + $this->paginationRender(...), [ 'needs_environment' => true, 'is_safe' => ['html'], diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php index 2c75ad41a..e5883d593 100644 --- a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php +++ b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php @@ -20,16 +20,16 @@ use Twig\TwigFunction; */ class ChillPaginationTwig extends AbstractExtension { - public const LONG_TEMPLATE = '@ChillMain/Pagination/long.html.twig'; + final public const LONG_TEMPLATE = '@ChillMain/Pagination/long.html.twig'; - public const SHORT_TEMPLATE = '@ChillMain/Pagination/short.html.twig'; + final public const SHORT_TEMPLATE = '@ChillMain/Pagination/short.html.twig'; public function getFunctions() { return [ new TwigFunction( 'chill_pagination', - [$this, 'paginationRender'], + $this->paginationRender(...), [ 'needs_environment' => true, 'is_safe' => ['html'], diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 60f9a6bc0..c75348910 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -19,11 +19,11 @@ use Symfony\Component\Routing\RouterInterface; */ class PaginatorFactory { - public const DEFAULT_CURRENT_PAGE_KEY = 'page'; + final public const DEFAULT_CURRENT_PAGE_KEY = 'page'; - public const DEFAULT_ITEM_PER_NUMBER_KEY = 'item_per_page'; + final public const DEFAULT_ITEM_PER_NUMBER_KEY = 'item_per_page'; - public const DEFAULT_PAGE_NUMBER = 1; + final public const DEFAULT_PAGE_NUMBER = 1; /** * @param int $itemPerPage @@ -32,11 +32,11 @@ class PaginatorFactory /** * the request stack. */ - private RequestStack $requestStack, + private readonly RequestStack $requestStack, /** * the router and generator for url. */ - private RouterInterface $router, + private readonly RouterInterface $router, /** * the default item per page. This may be overriden by * the request or inside the paginator. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index 0c6fbbf03..27bd7051d 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -35,28 +35,28 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface public const LOOKUP_URI = 'https://lookups.twilio.com/v1/PhoneNumbers/%s'; - private array $config; + private readonly array $config; private bool $isConfigured = false; - private PhonenumberUtil $phoneNumberUtil; + private readonly PhonenumberUtil $phoneNumberUtil; private Client $twilioClient; public function __construct( - private CacheItemPoolInterface $cachePool, + private readonly CacheItemPoolInterface $cachePool, ParameterBagInterface $parameterBag, - private LoggerInterface $logger + private readonly LoggerInterface $logger ) { $this->config = $config = $parameterBag->get('chill_main.phone_helper'); if ( array_key_exists('twilio_sid', $config) && !empty($config['twilio_sid']) - && strlen($config['twilio_sid']) > 2 + && strlen((string) $config['twilio_sid']) > 2 && array_key_exists('twilio_secret', $config) && !empty($config['twilio_secret']) - && strlen($config['twilio_secret']) > 2 + && strlen((string) $config['twilio_secret']) > 2 ) { $this->twilioClient = new Client([ 'auth' => [$config['twilio_sid'], $config['twilio_secret']], diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php index 6f4f09bfd..69da56eca 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php @@ -28,7 +28,7 @@ class Templating extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_format_phonenumber', [$this, 'formatPhonenumber']), + new TwigFilter('chill_format_phonenumber', $this->formatPhonenumber(...)), ]; } } diff --git a/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php b/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php index f5a2515c8..fdf81d441 100644 --- a/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php +++ b/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php @@ -16,13 +16,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; final class RedisConnectionFactory implements EventSubscriberInterface { - private string $host; + private readonly string $host; - private int $port; + private readonly int $port; - private ChillRedis $redis; + private readonly ChillRedis $redis; - private int $timeout; + private readonly int $timeout; public function __construct($parameters) { diff --git a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php index d301940ae..8cb4b2084 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php @@ -28,9 +28,9 @@ use function trim; final class AddressReferenceRepository implements ObjectRepository { - private EntityManagerInterface $entityManager; + private readonly EntityManagerInterface $entityManager; - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php index 622a9cb65..074b1fc32 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php @@ -19,7 +19,7 @@ use Doctrine\Persistence\ObjectRepository; final class AddressRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php index eaa0a6b1e..1f498a666 100644 --- a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class CenterRepository implements CenterRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php index 70b4a2bc4..982d3dd4c 100644 --- a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class CivilityRepository implements CivilityRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php index 699303bc8..701019dba 100644 --- a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php @@ -19,7 +19,7 @@ use Doctrine\Persistence\ObjectRepository; final class CountryRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php index a3c495d7d..1f369ef4e 100644 --- a/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CronJobExecutionRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class CronJobExecutionRepository implements CronJobExecutionRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php index 3f7f96407..11a03c209 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php index f5e646dba..a59ac9a8c 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; final class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php index 07bf728a2..2d9ad8c5a 100644 --- a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class GroupCenterRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php index 2e972442e..d8c5d54f8 100644 --- a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class LanguageRepository implements LanguageRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php index 5677adedb..045610f54 100644 --- a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php @@ -25,9 +25,9 @@ final class NotificationRepository implements ObjectRepository { private ?Statement $notificationByRelatedEntityAndUserAssociatedStatement = null; - private EntityRepository $repository; + private readonly EntityRepository $repository; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { $this->repository = $em->getRepository(Notification::class); } diff --git a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php index 64863bf8c..0af942c75 100644 --- a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class PermissionsGroupRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php index 32c1322be..3d2b2bb11 100644 --- a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php @@ -22,9 +22,9 @@ use RuntimeException; final class PostalCodeRepository implements PostalCodeRepositoryInterface { - private EntityManagerInterface $entityManager; + private readonly EntityManagerInterface $entityManager; - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php index a28f2f341..d05ceb699 100644 --- a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class RegroupmentRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php index 49162310c..ddf52af5b 100644 --- a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class RoleScopeRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php b/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php index 0011c5c43..c56e9927d 100644 --- a/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/SavedExportRepository.php @@ -22,7 +22,7 @@ use Doctrine\Persistence\ObjectRepository; */ class SavedExportRepository implements SavedExportRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php index 158678fb6..ba4ddae9b 100644 --- a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php @@ -18,7 +18,7 @@ use Doctrine\ORM\QueryBuilder; final class ScopeRepository implements ScopeRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index a64c77f10..5b830ce27 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -19,7 +19,7 @@ use Doctrine\ORM\EntityManagerInterface; class UserACLAwareRepository implements UserACLAwareRepositoryInterface { - public function __construct(private ParentRoleHelper $parentRoleHelper, private EntityManagerInterface $em) + public function __construct(private readonly ParentRoleHelper $parentRoleHelper, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php index 0be3e1b9c..302830cdc 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class UserJobRepository implements UserJobRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php index 360171f58..672add512 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php @@ -22,7 +22,7 @@ use Doctrine\ORM\QueryBuilder; use function count; -final class UserRepository implements UserRepositoryInterface +final readonly class UserRepository implements UserRepositoryInterface { private EntityRepository $repository; diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php index a304ff6d7..3ca56a2a0 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php @@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository; class EntityWorkflowRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php index d8c3619c3..545ec2873 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository; class EntityWorkflowStepRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php b/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php index ebfb263aa..37faf98ab 100644 --- a/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php +++ b/src/Bundle/ChillMainBundle/Routing/Loader/ChillRoutesLoader.php @@ -22,7 +22,7 @@ use Symfony\Component\Routing\RouteCollection; */ class ChillRoutesLoader extends Loader { - public function __construct(private array $routes) + public function __construct(private readonly array $routes) { parent::__construct(); } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php index 81c84a7a8..c203df335 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php @@ -22,7 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private NotificationByUserCounter $notificationByUserCounter, private WorkflowByUserCounter $workflowByUserCounter, private Security $security, private TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private RequestStack $requestStack) + public function __construct(private readonly NotificationByUserCounter $notificationByUserCounter, private readonly WorkflowByUserCounter $workflowByUserCounter, private readonly Security $security, private readonly TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php index ed9ff5169..f82ee2eae 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php @@ -33,7 +33,7 @@ class MenuComposer private RouteCollection $routeCollection; - public function __construct(private RouterInterface $router, private FactoryInterface $menuFactory, private TranslatorInterface $translator) + public function __construct(private readonly RouterInterface $router, private readonly FactoryInterface $menuFactory, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index b77d4343f..c46ce9500 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -38,7 +38,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface 'activeRouteKey' => null, ]; - public function __construct(private MenuComposer $menuComposer) + public function __construct(private readonly MenuComposer $menuComposer) { } @@ -76,7 +76,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface { return [new TwigFunction( 'chill_menu', - [$this, 'chillMenu'], + $this->chillMenu(...), [ 'is_safe' => ['html'], 'needs_environment' => true, diff --git a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php index f65319a09..9cd2cbd77 100644 --- a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php +++ b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php @@ -65,12 +65,12 @@ abstract class AbstractSearch implements SearchInterface foreach ($supportedTerms as $term) { if (array_key_exists($term, $terms) && '_default' !== $term) { $recomposed .= ' ' . $term . ':'; - $containsSpace = str_contains($terms[$term], ' '); + $containsSpace = str_contains((string) $terms[$term], ' '); if ($containsSpace) { $recomposed .= '"'; } - $recomposed .= (mb_stristr(' ', $terms[$term]) === false) ? $terms[$term] : '(' . $terms[$term] . ')'; + $recomposed .= (mb_stristr(' ', (string) $terms[$term]) === false) ? $terms[$term] : '(' . $terms[$term] . ')'; if ($containsSpace) { $recomposed .= '"'; diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php index 397e0b589..5928911d9 100644 --- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php +++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php @@ -20,7 +20,7 @@ use function in_array; class SearchUserApiProvider implements SearchApiInterface { - public function __construct(private UserRepository $userRepository) + public function __construct(private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillMainBundle/Search/Model/Result.php b/src/Bundle/ChillMainBundle/Search/Model/Result.php index 1ef249c1f..4f20924eb 100644 --- a/src/Bundle/ChillMainBundle/Search/Model/Result.php +++ b/src/Bundle/ChillMainBundle/Search/Model/Result.php @@ -17,7 +17,7 @@ class Result * @param $result */ public function __construct( - private float $relevance, + private readonly float $relevance, /** * mixed an arbitrary result. */ diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php index e7159db06..83cd83194 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApi.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php @@ -26,7 +26,7 @@ use function strtr; class SearchApi { - public function __construct(private EntityManagerInterface $em, private iterable $providers, private PaginatorFactory $paginator) + public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) { } diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php index 542e18d7c..c006b4bee 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php @@ -18,11 +18,11 @@ use function implode; class SearchApiNoQueryException extends RuntimeException { - private string $pattern; + private readonly string $pattern; - private array $types; + private readonly array $types; - public function __construct(string $pattern = '', array $types = [], private 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/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index b49c01565..218f4697e 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -15,11 +15,9 @@ use Symfony\Component\Serializer\Annotation as Serializer; class SearchApiResult { - private float $pertinence; - private $result; - public function __construct(private float $relevance) + public function __construct(private readonly float $relevance) { } diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php index 52b484c2d..81c3a3969 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php +++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php @@ -252,17 +252,17 @@ class SearchProvider { $terms = []; $matches = []; - preg_match_all('/([a-z\-]+):(([^"][\S\-]+)|"[^"]*")/', $subject, $matches); + preg_match_all('/([a-z\-]+):(([^"][\S\-]+)|"[^"]*")/', (string) $subject, $matches); foreach ($matches[2] as $key => $match) { //remove from search pattern $this->mustBeExtracted[] = $matches[0][$key]; //strip parenthesis if ( - mb_substr($match, 0, 1) === '"' - && mb_substr($match, mb_strlen($match) - 1) === '"' + mb_substr((string) $match, 0, 1) === '"' + && mb_substr((string) $match, mb_strlen((string) $match) - 1) === '"' ) { - $match = trim(mb_substr($match, 1, mb_strlen($match) - 2)); + $match = trim(mb_substr((string) $match, 1, mb_strlen((string) $match) - 2)); } $terms[$matches[1][$key]] = $match; } diff --git a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php index df9934570..ce79a637b 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php @@ -26,7 +26,7 @@ class ExtractPhonenumberFromPattern { private const PATTERN = '([\\+]{0,1}[0-9\\ ]{5,})'; - private string $defaultCarrierCode; + private readonly string $defaultCarrierCode; public function __construct(ParameterBagInterface $parameterBag) { diff --git a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php index 20d5948a3..c753013cb 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php @@ -13,7 +13,7 @@ namespace Chill\MainBundle\Search\Utils; class SearchExtractionResult { - public function __construct(private string $filteredSubject, private array $found) + public function __construct(private readonly string $filteredSubject, private readonly array $found) { } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index c431c4492..50cbf3f8d 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -34,7 +34,7 @@ use function get_class; */ class AuthorizationHelper implements AuthorizationHelperInterface { - public function __construct(private CenterResolverManagerInterface $centerResolverManager, private LoggerInterface $logger, private ScopeResolverDispatcher $scopeResolverDispatcher, private UserACLAwareRepositoryInterface $userACLAwareRepository, private ParentRoleHelper $parentRoleHelper) + public function __construct(private readonly CenterResolverManagerInterface $centerResolverManager, private readonly LoggerInterface $logger, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly UserACLAwareRepositoryInterface $userACLAwareRepository, private readonly ParentRoleHelper $parentRoleHelper) { } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php index 45a1f3095..0a9d837a6 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php @@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\Security; class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrentUserInterface { - public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security) + public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/ChillExportVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/ChillExportVoter.php index 62ac2b81b..10552d1f7 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/ChillExportVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/ChillExportVoter.php @@ -16,9 +16,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter; class ChillExportVoter extends Voter { - public const EXPORT = 'chill_export'; + final public const EXPORT = 'chill_export'; - private VoterHelperInterface $helper; + private readonly VoterHelperInterface $helper; public function __construct(VoterHelperFactoryInterface $voterHelperFactory) { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php index c6ae44d9f..a9c9f7445 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php @@ -16,7 +16,7 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; use function in_array; -final class DefaultVoterHelper implements VoterHelperInterface +final readonly class DefaultVoterHelper implements VoterHelperInterface { public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private array $configuration) { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php index 7844632d8..cea60b931 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php @@ -17,7 +17,7 @@ final class DefaultVoterHelperGenerator implements VoterGeneratorInterface { private array $configuration = []; - public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher) + public function __construct(private readonly AuthorizationHelper $authorizationHelper, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher) { } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php index 5d2bc72a7..11871b0b3 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php @@ -21,15 +21,15 @@ use function in_array; class EntityWorkflowVoter extends Voter { - public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE'; + final public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE'; - public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE'; + final public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE'; - public const SEE = 'CHILL_MAIN_WORKFLOW_SEE'; + final public const SEE = 'CHILL_MAIN_WORKFLOW_SEE'; - public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW'; + final public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW'; - public function __construct(private EntityWorkflowManager $manager, private Security $security) + public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php index 179cada57..32281f6dc 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php @@ -19,11 +19,11 @@ use function in_array; class SavedExportVoter extends Voter { - public const DELETE = 'CHLL_MAIN_EXPORT_SAVED_DELETE'; + final public const DELETE = 'CHLL_MAIN_EXPORT_SAVED_DELETE'; - public const EDIT = 'CHLL_MAIN_EXPORT_SAVED_EDIT'; + final public const EDIT = 'CHLL_MAIN_EXPORT_SAVED_EDIT'; - public const GENERATE = 'CHLL_MAIN_EXPORT_SAVED_GENERATE'; + final public const GENERATE = 'CHLL_MAIN_EXPORT_SAVED_GENERATE'; private const ALL = [ self::DELETE, diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php index 23265306d..875288e90 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -24,7 +24,7 @@ class WorkflowEntityDeletionVoter extends Voter /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private $handlers, private EntityWorkflowRepository $entityWorkflowRepository) + public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) { } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php index 5c8a01e1d..96ba1c74f 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php @@ -16,22 +16,21 @@ use Symfony\Component\EventDispatcher\Event; class PasswordRecoverEvent extends Event { - public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form'; + final public const ASK_TOKEN_INVALID_FORM = 'chill_main.ask_token_invalid_form'; - public const ASK_TOKEN_SUCCESS = 'chill_main.ask_token_success'; + final public const ASK_TOKEN_SUCCESS = 'chill_main.ask_token_success'; - public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token'; + final public const INVALID_TOKEN = 'chill_main.password_recover_invalid_token'; /** * @param bool $safelyGenerated true if generated safely (from console command, etc.) */ public function __construct( - private ?string $token = null, - private ?User $user = null, + private readonly ?string $token = null, + private readonly ?User $user = null, private $ip = null, - private bool $safelyGenerated = false, - ) - { + private readonly bool $safelyGenerated = false, + ) { } public function getIp() diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php index 53be72874..1266453e7 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php @@ -18,28 +18,28 @@ use UnexpectedValueException; class PasswordRecoverLocker { - public const ASK_TOKEN_INVALID_FORM_TTL = 3600; + final public const ASK_TOKEN_INVALID_FORM_TTL = 3600; /** * TTL to keep invalid token recorded. */ - public const INVALID_TOKEN_TTL = 3600; + final public const INVALID_TOKEN_TTL = 3600; - public const MAX_ASK_TOKEN_BY_USER = 10; + final public const MAX_ASK_TOKEN_BY_USER = 10; - public const MAX_ASK_TOKEN_INVALID_FORM_BY_IP = 10; + final public const MAX_ASK_TOKEN_INVALID_FORM_BY_IP = 10; - public const MAX_ASK_TOKEN_INVALID_FORM_GLOBAL = 50; + final public const MAX_ASK_TOKEN_INVALID_FORM_GLOBAL = 50; /** * The maximum of invalid token by ip. */ - public const MAX_INVALID_TOKEN_BY_IP = 10; + final public const MAX_INVALID_TOKEN_BY_IP = 10; /** * The maximum of invalid token globally (across all ip). */ - public const MAX_INVALID_TOKEN_GLOBAL = 50; + final public const MAX_INVALID_TOKEN_GLOBAL = 50; /** * @var ChillRedis diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php index 7ba724618..b2a17d2da 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php @@ -20,9 +20,9 @@ use function in_array; class PasswordRecoverVoter extends Voter { - public const ASK_TOKEN = 'CHILL_PASSWORD_ASK_TOKEN'; + final public const ASK_TOKEN = 'CHILL_PASSWORD_ASK_TOKEN'; - public const TRY_TOKEN = 'CHILL_PASSWORD_TRY_TOKEN'; + final public const TRY_TOKEN = 'CHILL_PASSWORD_TRY_TOKEN'; /** * @var PasswordRecoverLocker diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php index 4598f6199..a8f8b4300 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php @@ -22,9 +22,9 @@ use function array_merge; class RecoverPasswordHelper { - public const RECOVER_PASSWORD_ROUTE = 'password_recover'; + final public const RECOVER_PASSWORD_ROUTE = 'password_recover'; - public function __construct(private TokenManager $tokenManager, private UrlGeneratorInterface $urlGenerator, private MailerInterface $mailer) + public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer) { } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php index 370c1c521..f442ae4a7 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php @@ -27,15 +27,15 @@ use function trim; class TokenManager { - public const HASH = 'h'; + final public const HASH = 'h'; - public const TIMESTAMP = 'ts'; + final public const TIMESTAMP = 'ts'; - public const TOKEN = 't'; + final public const TOKEN = 't'; - public const TOKEN_LENGTH = 24; + final public const TOKEN_LENGTH = 24; - public const USERNAME_CANONICAL = 'u'; + final public const USERNAME_CANONICAL = 'u'; /** * @var LoggerInterface @@ -72,7 +72,7 @@ class TokenManager public function verify($hash, $token, User $user, string $timestamp) { - $token = hex2bin(trim($token)); + $token = hex2bin(trim((string) $token)); if (strlen($token) !== self::TOKEN_LENGTH) { return false; diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php index d01ba6665..9855477fd 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Security\Resolver; -final class CenterResolverDispatcher implements CenterResolverDispatcherInterface +final readonly class CenterResolverDispatcher implements CenterResolverDispatcherInterface { /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php index 3ccdd3746..9c6dc841d 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php @@ -17,7 +17,7 @@ use UnexpectedValueException; use function get_class; use function is_array; -final class CenterResolverManager implements CenterResolverManagerInterface +final readonly class CenterResolverManager implements CenterResolverManagerInterface { /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php index 299d8dd2b..c3c328bd2 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php @@ -15,16 +15,16 @@ use Twig\TwigFilter; final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension { - public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher) + public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) { } public function getFilters() { return [ - new TwigFilter('chill_resolve_center', [$this, 'resolveCenter']), - new TwigFilter('chill_resolve_scope', [$this, 'resolveScope']), - new TwigFilter('chill_is_scope_concerned', [$this, 'isScopeConcerned']), + new TwigFilter('chill_resolve_center', $this->resolveCenter(...)), + new TwigFilter('chill_resolve_scope', $this->resolveScope(...)), + new TwigFilter('chill_is_scope_concerned', $this->isScopeConcerned(...)), ]; } diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index 151754ae7..e8207406a 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -14,7 +14,7 @@ namespace Chill\MainBundle\Security\Resolver; use Chill\MainBundle\Entity\Scope; use Doctrine\Common\Collections\Collection; -final class ScopeResolverDispatcher +final readonly class ScopeResolverDispatcher { /** * @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php index 4f6248621..9d80eabe9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Pagination\PaginatorInterface; class Collection { - public function __construct(private $items, private PaginatorInterface $paginator) + public function __construct(private $items, private readonly PaginatorInterface $paginator) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index 5e6c8cc05..ac3304767 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -48,7 +48,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'confidential', ]; - public function __construct(private AddressRender $addressRender) + public function __construct(private readonly AddressRender $addressRender) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index cfb53e1a1..6a4355a08 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -22,7 +22,7 @@ use function array_key_exists; class CenterNormalizer implements DenormalizerInterface, NormalizerInterface { - public function __construct(private CenterRepository $repository) + public function __construct(private readonly CenterRepository $repository) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index 10c865608..ba29093ce 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -25,7 +25,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa { use NormalizerAwareTrait; - public function __construct(private UserRepository $userRepository) + public function __construct(private readonly UserRepository $userRepository) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index c5032a7b9..cbd12e15f 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -26,7 +26,7 @@ use function is_array; class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface { - public function __construct(private RequestStack $requestStack, private ParameterBagInterface $parameterBag) + public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php index da2b63faa..58dc7e839 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php @@ -32,12 +32,12 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa * Should be present in context and contains an array of * allowed types. */ - public const ALLOWED_TYPES = 'denormalize_multi.allowed_types'; + final public const ALLOWED_TYPES = 'denormalize_multi.allowed_types'; /** * The type to set for enabling this type. */ - public const TYPE = '@multi'; + final public const TYPE = '@multi'; public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index 94c5d400e..9c9081ae9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -23,7 +23,7 @@ use function is_array; class DoctrineExistingEntityNormalizer implements DenormalizerInterface { - public function __construct(private EntityManagerInterface $em, private ClassMetadataFactoryInterface $serializerMetadataFactory) + public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php index 16553ab29..83e84f7a0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php @@ -23,7 +23,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn { use NormalizerAwareTrait; - public function __construct(private EntityWorkflowManager $entityWorkflowManager, private MetadataExtractor $metadataExtractor, private Registry $registry) + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 874faf9c9..46dbd00cc 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -21,7 +21,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz { use NormalizerAwareTrait; - public function __construct(private MetadataExtractor $metadataExtractor) + public function __construct(private readonly MetadataExtractor $metadataExtractor) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 98101a86d..241cd83a9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -24,7 +24,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - public function __construct(private NotificationHandlerManager $notificationHandlerManager, private EntityManagerInterface $entityManager, private Security $security) + public function __construct(private readonly NotificationHandlerManager $notificationHandlerManager, private readonly EntityManagerInterface $entityManager, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index 349f2dace..ec6e3d5e6 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -21,9 +21,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class PhonenumberNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface { - private string $defaultCarrierCode; + private readonly string $defaultCarrierCode; - private PhoneNumberUtil $phoneNumberUtil; + private readonly PhoneNumberUtil $phoneNumberUtil; public function __construct(ParameterBagInterface $parameterBag) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php index 6a98bc428..1d7ee43ce 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -18,7 +18,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index 5f68454fd..5211ff505 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -26,7 +26,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware { use NormalizerAwareTrait; - public const NULL_USER = [ + final public const NULL_USER = [ 'type' => 'user', 'id' => '', 'username' => '', @@ -36,7 +36,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware 'email' => '', ]; - public function __construct(private UserRender $userRender) + public function __construct(private readonly UserRender $userRender) { } @@ -65,14 +65,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware ); if (null === $object && 'docgen' === $format) { - return array_merge(self::NULL_USER, [ - 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), - 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), - 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), - 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), - 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), - 'main_location' => $this->normalizer->normalize(null, $format, $locationContext), - ]); + return [...self::NULL_USER, 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)]; } $data = [ diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index b64891695..d17d02f54 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -20,7 +20,7 @@ use UnexpectedValueException; class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJobInterface { - public function __construct(private Connection $connection) + public function __construct(private readonly Connection $connection) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php index 09bc5e3f8..fce6116a8 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php @@ -22,7 +22,7 @@ class AddressReferenceBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher) + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php index 9c8f2f705..68f6287e6 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php @@ -50,7 +50,7 @@ final class AddressReferenceBaseImporter private array $waitingForInsert = []; - public function __construct(private Connection $defaultConnection, private LoggerInterface $logger) + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php index 657463dc7..a908bc31e 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php @@ -20,7 +20,7 @@ use function is_int; class AddressReferenceFromBano { - public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher) + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php index bf9b57a1a..67ad25fbb 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php @@ -19,7 +19,7 @@ use Psr\Log\LoggerInterface; * Mark existing addresses as to be reviewed regarding the * address reference */ -final class AddressToReferenceMatcher +final readonly class AddressToReferenceMatcher { private const LOG_PREFIX = '[address_to_reference_matcher] '; diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index c8a229cd7..ec3203de2 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -47,7 +47,7 @@ final class GeographicalUnitBaseImporter private array $waitingForInsert = []; - public function __construct(private Connection $defaultConnection, private LoggerInterface $logger) + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php index 41672e421..b1b5563ec 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php @@ -21,7 +21,7 @@ class PostalCodeBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger) + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) { } @@ -82,8 +82,8 @@ class PostalCodeBEFromBestAddress { $this->baseImporter->importCode( 'BE', - trim($record['municipality_name']), - trim($record['postal_info_objectid']), + trim((string) $record['municipality_name']), + trim((string) $record['postal_info_objectid']), $record['municipality_objectid'], 'bestaddress', (float) $record['Y'], diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php index 8b5e6d4e1..86f00193a 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php @@ -57,7 +57,7 @@ class PostalCodeBaseImporter private array $waitingForInsert = []; - public function __construct(private Connection $defaultConnection) + public function __construct(private readonly Connection $defaultConnection) { } diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php index 23687d558..3eb178b01 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php @@ -26,7 +26,7 @@ class PostalCodeFRFromOpenData { private const CSV = 'https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B'; - public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger) + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) { } @@ -72,17 +72,17 @@ class PostalCodeFRFromOpenData $lat = $lon = 0.0; } - $ref = trim($record['Code_commune_INSEE']); + $ref = trim((string) $record['Code_commune_INSEE']); if (str_starts_with($ref, '987')) { // some differences in French Polynesia - $ref .= '.' . trim($record['Libellé_d_acheminement']); + $ref .= '.' . trim((string) $record['Libellé_d_acheminement']); } $this->baseImporter->importCode( 'FR', - trim($record['Libellé_d_acheminement']), - trim($record['Code_postal']), + trim((string) $record['Libellé_d_acheminement']), + trim((string) $record['Code_postal']), $ref, 'INSEE', $lat, diff --git a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php index 6474ccf9c..b9b2f026d 100644 --- a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php +++ b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php @@ -22,7 +22,7 @@ class ChillMailer implements MailerInterface { private string $prefix = '[Chill] '; - public function __construct(private MailerInterface $initial, private LoggerInterface $chillLogger) + public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger) { } diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index 32aa7030a..cc02dc822 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -15,7 +15,7 @@ use DateTimeImmutable; class RollingDate { - public const ALL_T = [ + final public const ALL_T = [ self::T_YEAR_PREVIOUS_START, self::T_QUARTER_PREVIOUS_START, self::T_MONTH_PREVIOUS_START, @@ -35,47 +35,41 @@ class RollingDate /** * A given fixed date. */ - public const T_FIXED_DATE = 'fixed_date'; + final public const T_FIXED_DATE = 'fixed_date'; - public const T_MONTH_CURRENT_START = 'month_current_start'; + final public const T_MONTH_CURRENT_START = 'month_current_start'; - public const T_MONTH_NEXT_START = 'month_next_start'; + final public const T_MONTH_NEXT_START = 'month_next_start'; - public const T_MONTH_PREVIOUS_START = 'month_previous_start'; + final public const T_MONTH_PREVIOUS_START = 'month_previous_start'; - public const T_QUARTER_CURRENT_START = 'quarter_current_start'; + final public const T_QUARTER_CURRENT_START = 'quarter_current_start'; - public const T_QUARTER_NEXT_START = 'quarter_next_start'; + final public const T_QUARTER_NEXT_START = 'quarter_next_start'; - public const T_QUARTER_PREVIOUS_START = 'quarter_previous_start'; + final public const T_QUARTER_PREVIOUS_START = 'quarter_previous_start'; - public const T_TODAY = 'today'; + final public const T_TODAY = 'today'; - public const T_WEEK_CURRENT_START = 'week_current_start'; + final public const T_WEEK_CURRENT_START = 'week_current_start'; - public const T_WEEK_NEXT_START = 'week_next_start'; + final public const T_WEEK_NEXT_START = 'week_next_start'; - public const T_WEEK_PREVIOUS_START = 'week_previous_start'; + final public const T_WEEK_PREVIOUS_START = 'week_previous_start'; - public const T_YEAR_CURRENT_START = 'year_current_start'; + final public const T_YEAR_CURRENT_START = 'year_current_start'; - public const T_YEAR_NEXT_START = 'year_next_start'; + final public const T_YEAR_NEXT_START = 'year_next_start'; - public const T_YEAR_PREVIOUS_START = 'year_previous_start'; + final public const T_YEAR_PREVIOUS_START = 'year_previous_start'; /** - * The pivot date is the date from the rolling is computed. By default, it is "now". - */ - private DateTimeImmutable $pivotDate; - - /** - * @param string|self::T_* $roll - * @param DateTimeImmutable|null $pivotDate Will be "now" if null is given + * @param string $roll * @param DateTimeImmutable|null $fixedDate Only to insert if $roll equals @see{self::T_FIXED_DATE} + * @param DateTimeImmutable $pivotDate Will be "now" if null is given */ - public function __construct(private string $roll, private ?\DateTimeImmutable $fixedDate = null, ?DateTimeImmutable $pivotDate = null) + public function __construct(private readonly string $roll, private readonly ?DateTimeImmutable $fixedDate = null, private readonly DateTimeImmutable $pivotDate = new DateTimeImmutable('now')) { - $this->pivotDate = $pivotDate ?? new DateTimeImmutable('now'); } public function getFixedDate(): ?DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php index 2a86ddab4..e028cf3c4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php @@ -22,9 +22,9 @@ use libphonenumber\PhoneNumber; class ShortMessage { - public const PRIORITY_LOW = 'low'; + final public const PRIORITY_LOW = 'low'; - public const PRIORITY_MEDIUM = 'medium'; + final public const PRIORITY_MEDIUM = 'medium'; public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php index 6f8b5427d..55490b2eb 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php @@ -25,7 +25,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class ShortMessageHandler implements MessageHandlerInterface { - public function __construct(private ShortMessageTransporterInterface $messageTransporter) + public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter) { } diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php index 5dfbc9fc0..76e45acbd 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php @@ -20,7 +20,7 @@ namespace Chill\MainBundle\Service\ShortMessage; class ShortMessageTransporter implements ShortMessageTransporterInterface { - public function __construct(private ShortMessageSenderInterface $sender) + public function __construct(private readonly ShortMessageSenderInterface $sender) { } diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php index 72ef53b85..bf43d76d4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php @@ -28,14 +28,14 @@ use Psr\Log\LoggerInterface; class OvhShortMessageSender implements ShortMessageSenderInterface { public function __construct( - private Api $api, + private readonly Api $api, // for DI, must remains as first argument - private string $serviceName, + private readonly string $serviceName, // for di, must remains as second argument - private string $sender, + private readonly string $sender, // for DI, must remains as third argument - private LoggerInterface $logger, - private PhoneNumberUtil $phoneNumberUtil + private readonly LoggerInterface $logger, + private readonly PhoneNumberUtil $phoneNumberUtil ) { } diff --git a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php index f5f91c361..7aaa33c7c 100644 --- a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php @@ -46,7 +46,7 @@ class CSVCellTwig extends AbstractExtension return [ new TwigFilter( 'csv_cell', - [$this, 'csvCellFilter'], + $this->csvCellFilter(...), ['is_safe' => ['html']] ), ]; diff --git a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php index d277c0f41..690188704 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php @@ -34,7 +34,7 @@ final class ChillMarkdownRenderExtension extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('chill_markdown_to_html', [$this, 'renderMarkdownToHtml'], [ + new TwigFilter('chill_markdown_to_html', $this->renderMarkdownToHtml(...), [ 'is_safe' => ['html'], ]), ]; diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php index 95b307ed7..56a729071 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php @@ -23,7 +23,7 @@ class ChillTwigHelper extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_print_or_message', [$this, 'printOrMessage'], [ + new TwigFilter('chill_print_or_message', $this->printOrMessage(...), [ 'needs_environment' => true, 'is_safe' => ['html', 'html_attrs'], ]), diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php index a01398210..1e55a8d74 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php @@ -46,16 +46,16 @@ class ChillTwigRoutingHelper extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_return_path_label', [$this, 'getLabelReturnPath']), + new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)), ]; } public function getFunctions() { return [ - new TwigFunction('chill_return_path_or', [$this, 'getReturnPathOr'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), - new TwigFunction('chill_path_add_return_path', [$this, 'getPathAddReturnPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), - new TwigFunction('chill_path_forward_return_path', [$this, 'getPathForwardReturnPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + new TwigFunction('chill_return_path_or', $this->getReturnPathOr(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]), + new TwigFunction('chill_path_add_return_path', $this->getPathAddReturnPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]), + new TwigFunction('chill_path_forward_return_path', $this->getPathForwardReturnPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]), ]; } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index 668f7875a..c952bb5aa 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -25,7 +25,7 @@ use function strtr; */ class AddressRender implements ChillEntityRenderInterface { - public const DEFAULT_OPTIONS = [ + final public const DEFAULT_OPTIONS = [ 'with_valid_from' => false, 'with_valid_to' => false, 'with_picto' => false, @@ -36,7 +36,7 @@ class AddressRender implements ChillEntityRenderInterface 'extended_infos' => false, ]; - public function __construct(private EngineInterface $templating, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly EngineInterface $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php index 967b3ca78..2a1c91fa2 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php @@ -44,10 +44,10 @@ class ChillEntityRenderExtension extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_entity_render_string', [$this, 'renderString'], [ + new TwigFilter('chill_entity_render_string', $this->renderString(...), [ 'is_safe' => ['html'], ]), - new TwigFilter('chill_entity_render_box', [$this, 'renderBox'], [ + new TwigFilter('chill_entity_render_box', $this->renderBox(...), [ 'is_safe' => ['html'], ]), ]; diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index 464415848..ff8ea0dc3 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -25,7 +25,7 @@ class CommentRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private UserRepositoryInterface $userRepository, private EngineInterface $engine) + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly EngineInterface $engine) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index e34440491..880ee8587 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -24,13 +24,13 @@ use function array_merge; */ class UserRender implements ChillEntityRenderInterface { - public const DEFAULT_OPTIONS = [ + final public const DEFAULT_OPTIONS = [ 'main_scope' => true, 'user_job' => true, 'absence' => true, ]; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php b/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php index ce02789fd..c7a31b042 100644 --- a/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php +++ b/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php @@ -80,13 +80,13 @@ class DelegatedBlockRenderingEvent extends Event implements ArrayAccess return $this->context[$offset]; } - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value): never { throw new RuntimeException('The event context is read-only, you are not ' . 'allowed to update it.'); } - public function offsetUnset($offset): void + public function offsetUnset($offset): never { throw new RuntimeException('The event context is read-only, you are not ' . 'allowed to update it.'); diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index c8b3839c9..e9e5065b2 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -36,7 +36,7 @@ class FilterOrderHelper private ?array $submitted = null; - public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index 770b42cae..206e57cea 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -23,7 +23,7 @@ class FilterOrderHelperBuilder private ?array $searchBoxFields = null; - public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index 930da454c..c9c094a15 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\RequestStack; class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface { - public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack) + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index bc256e24f..4c3a1f3eb 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -20,7 +20,7 @@ class Templating extends AbstractExtension public function getFilters() { return [ - new TwigFilter('chill_render_filter_order_helper', [$this, 'renderFilterOrderHelper'], [ + new TwigFilter('chill_render_filter_order_helper', $this->renderFilterOrderHelper(...), [ 'needs_environment' => true, 'is_safe' => ['html'], ]), ]; diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php index 6136ffc3e..924e1a2be 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php @@ -19,9 +19,9 @@ use function array_key_exists; final class TranslatableStringHelper implements TranslatableStringHelperInterface { - private string $defaultLocale; + private readonly string $defaultLocale; - public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator, ParameterBagInterface $parameterBag) + public function __construct(private readonly RequestStack $requestStack, private readonly TranslatorInterface $translator, ParameterBagInterface $parameterBag) { $this->defaultLocale = $parameterBag->get('kernel.default_locale'); } diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php index aaefdeeae..512d8bd2a 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php @@ -22,7 +22,7 @@ class TranslatableStringTwig extends AbstractExtension /** * TranslatableStringTwig constructor. */ - public function __construct(private TranslatableStringHelper $helper) + public function __construct(private readonly TranslatableStringHelper $helper) { } @@ -38,7 +38,7 @@ class TranslatableStringTwig extends AbstractExtension return [ new TwigFilter( 'localize_translatable_string', - [$this, 'localize'] + $this->localize(...) ), ]; } diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php index 9b752c439..c38f410d4 100644 --- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php @@ -92,7 +92,7 @@ class WidgetRenderingTwig extends AbstractExtension return [ new TwigFunction( 'chill_delegated_block', - [$this, 'renderingWidget'], + $this->renderingWidget(...), [ 'is_safe' => ['html'], 'needs_environment' => true, @@ -101,7 +101,7 @@ class WidgetRenderingTwig extends AbstractExtension ), new TwigFunction( 'chill_widget', - [$this, 'renderingWidget'], + $this->renderingWidget(...), ['is_safe' => ['html'], 'needs_environment' => true] ), ]; diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php index cbb3e3601..1c2ffe4d3 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php @@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class PermissionsGroupControllerTest extends WebTestCase { - public function testEmpty() + public function testEmpty(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index 98de6891f..20a3027b3 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -161,7 +161,7 @@ final class CronManagerTest extends TestCase class JobCanRun implements CronJobInterface { - public function __construct(private string $key) + public function __construct(private readonly string $key) { } diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php index ffb7c6bed..db1d701f6 100644 --- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php @@ -28,7 +28,7 @@ final class PickCenterTypeTest extends TypeTestCase * Test that a user which can reach multiple center * make CenterType render as "entity" type. */ - public function testUserCanReachMultipleCenters() + public function testUserCanReachMultipleCenters(): never { $this->markTestSkipped(); //prepare user @@ -51,7 +51,7 @@ final class PickCenterTypeTest extends TypeTestCase * Test that a user which can reach only one center * render as an hidden field. */ - public function testUserCanReachMultipleSameCenter() + public function testUserCanReachMultipleSameCenter(): never { $this->markTestSkipped(); //prepare user @@ -73,7 +73,7 @@ final class PickCenterTypeTest extends TypeTestCase * Test that a user which can reach only one center * render as an hidden field. */ - public function testUserCanReachSingleCenter() + public function testUserCanReachSingleCenter(): never { $this->markTestSkipped(); //prepare user diff --git a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php index 9348c6fe2..afe10b4ec 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php @@ -38,7 +38,7 @@ final class AbstractSearchTest extends \PHPUnit\Framework\TestCase $this->assertEquals('01', $date->format('d')); } - public function testRecompose() + public function testRecompose(): never { $this->markTestSkipped(); } diff --git a/src/Bundle/ChillMainBundle/Tests/Services/Import/GeographicalUnitBaseImporterTest.php b/src/Bundle/ChillMainBundle/Tests/Services/Import/GeographicalUnitBaseImporterTest.php index b3bd856ff..757e13c2f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/Import/GeographicalUnitBaseImporterTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/Import/GeographicalUnitBaseImporterTest.php @@ -64,7 +64,7 @@ final class GeographicalUnitBaseImporterTest extends KernelTestCase $this->assertEquals($results['unitrefid'], 'layer_one'); $this->assertEquals($results['unitname'], 'Layer one'); - $this->assertEquals(json_decode($results['layername'], true, 512, JSON_THROW_ON_ERROR), ['fr' => 'Test Layer']); + $this->assertEquals(json_decode((string) $results['layername'], true, 512, JSON_THROW_ON_ERROR), ['fr' => 'Test Layer']); $this->assertEquals($results['layerrefid'], 'test'); $this->assertEquals($results['geom'], 'MULTIPOLYGON(((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))'); @@ -93,7 +93,7 @@ final class GeographicalUnitBaseImporterTest extends KernelTestCase $this->assertEquals($results['unitrefid'], 'layer_one'); $this->assertEquals($results['unitname'], 'Layer one fixed'); - $this->assertEquals(json_decode($results['layername'], true, 512, JSON_THROW_ON_ERROR), ['fr' => 'Test Layer fixed']); + $this->assertEquals(json_decode((string) $results['layername'], true, 512, JSON_THROW_ON_ERROR), ['fr' => 'Test Layer fixed']); $this->assertEquals($results['layerrefid'], 'test'); $this->assertEquals($results['geom'], 'MULTIPOLYGON(((130 120,45 40,10 40,130 120)),((0 0,15 5,40 10,10 20,0 0)))'); } diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index c223bc375..df700324b 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -47,7 +47,7 @@ class TimelineBuilder implements ContainerAwareInterface */ private $providersByContext = []; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php index 7ddecf70c..e5d3de41a 100644 --- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php +++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php @@ -65,7 +65,7 @@ class DateRangeCovering private array $metadatas = []; - private int $minCover; + private readonly int $minCover; private array $sequence = []; @@ -74,7 +74,7 @@ class DateRangeCovering /** * @param int $minCover the minimum of covering required */ - public function __construct(int $minCover, private DateTimeZone $tz) + public function __construct(int $minCover, private readonly DateTimeZone $tz) { if (0 > $minCover) { throw new LogicException('argument minCover cannot be lower than 0'); diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php index 1ffb767e3..cff4d34c7 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php @@ -24,7 +24,7 @@ use function in_array; class RoleScopeScopePresence extends ConstraintValidator { - public function __construct(private RoleProvider $roleProvider, private LoggerInterface $logger, private TranslatorInterface $translator) + public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php index 0c9eae2c4..ab38e5081 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php @@ -19,7 +19,7 @@ use Symfony\Component\Validator\ConstraintValidator; final class ValidPhonenumber extends ConstraintValidator { - public function __construct(private LoggerInterface $logger, private PhoneNumberHelperInterface $phonenumberHelper) + public function __construct(private readonly LoggerInterface $logger, private readonly PhoneNumberHelperInterface $phonenumberHelper) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index 3dc5928d6..2735a265f 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -20,7 +20,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Workflow\Event\Event; -final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface +final readonly class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface { public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) { diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php index 2f5356e6e..6c45cef3d 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php +++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php @@ -20,7 +20,7 @@ class EntityWorkflowManager /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private iterable $handlers, private Registry $registry) + public function __construct(private readonly iterable $handlers, private readonly Registry $registry) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php index 3657e4f53..981c798dd 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php @@ -25,7 +25,7 @@ use function array_key_exists; class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterface { - public function __construct(private LoggerInterface $chillLogger, private Security $security, private UserRender $userRender) + public function __construct(private readonly LoggerInterface $chillLogger, private readonly Security $security, private readonly UserRender $userRender) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index ceeb3023f..78b165a85 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -25,7 +25,7 @@ use function in_array; class NotificationOnTransition implements EventSubscriberInterface { - public function __construct(private EntityManagerInterface $entityManager, private EngineInterface $engine, private MetadataExtractor $metadataExtractor, private Security $security, private Registry $registry) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EngineInterface $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php index b1ce5074c..adf19fb92 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php @@ -21,7 +21,7 @@ use Symfony\Component\Workflow\Registry; class SendAccessKeyEventSubscriber { - public function __construct(private EngineInterface $engine, private MetadataExtractor $metadataExtractor, private Registry $registry, private EntityWorkflowManager $entityWorkflowManager, private MailerInterface $mailer) + public function __construct(private readonly EngineInterface $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index 87026e920..9adffec8e 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -20,7 +20,7 @@ use function array_key_exists; class MetadataExtractor { - public function __construct(private Registry $registry, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php index 9f286508c..bf55d8542 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php @@ -20,7 +20,7 @@ use Symfony\Component\Security\Core\Security; class WorkflowNotificationHandler implements NotificationHandlerInterface { - public function __construct(private EntityWorkflowRepository $entityWorkflowRepository, private EntityWorkflowManager $entityWorkflowManager, private Security $security) + public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Security $security) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php index d1381a397..e9edb11d9 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php @@ -23,7 +23,7 @@ use Twig\Extension\RuntimeExtensionInterface; class WorkflowTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private EntityWorkflowManager $entityWorkflowManager, private Registry $registry, private EntityWorkflowRepository $repository, private MetadataExtractor $metadataExtractor, private NormalizerInterface $normalizer) + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly EntityWorkflowRepository $repository, private readonly MetadataExtractor $metadataExtractor, private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php index eb035358d..e55eb6915 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php @@ -22,7 +22,7 @@ use function count; class EntityWorkflowCreationValidator extends \Symfony\Component\Validator\ConstraintValidator { - public function __construct(private EntityWorkflowManager $entityWorkflowManager) + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager) { } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index a24d8adb4..ce26780a4 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonAddressMoveEventSubscriber implements EventSubscriberInterface { - public function __construct(private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister, private Security $security, private TranslatorInterface $translator) + public function __construct(private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index cefc348c2..b8ca31835 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserRefEventSubscriber implements EventSubscriberInterface { - public function __construct(private Security $security, private TranslatorInterface $translator, private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister) + public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister) { } diff --git a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php index b3a335ce7..c0935b995 100644 --- a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php +++ b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php @@ -18,9 +18,9 @@ use Symfony\Component\EventDispatcher\Event; */ class ActionEvent extends Event { - public const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY'; + final public const DELETE = 'CHILL_PERSON.DELETE_ASSOCIATED_ENTITY'; - public const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY'; + final public const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY'; /** * @var string[] diff --git a/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php b/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php index f9c53712a..52599e162 100644 --- a/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php +++ b/src/Bundle/ChillPersonBundle/CRUD/Controller/OneToOneEntityPersonCRUDController.php @@ -22,7 +22,7 @@ use Symfony\Component\HttpFoundation\Response; class OneToOneEntityPersonCRUDController extends CRUDController { - protected function generateRedirectOnCreateRoute($action, Request $request, $entity) + protected function generateRedirectOnCreateRoute($action, Request $request, $entity): never { throw new BadMethodCallException('Not implemented yet.'); } diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index 42b8f6cac..4817e3819 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -26,9 +26,9 @@ use function ctype_digit; final class ChillPersonMoveCommand extends Command { public function __construct( - private PersonMove $mover, - private EntityManagerInterface $em, - private LoggerInterface $chillLogger + private readonly PersonMove $mover, + private readonly EntityManagerInterface $em, + private readonly LoggerInterface $chillLogger ) { parent::__construct('chill:person:move'); } @@ -116,7 +116,7 @@ final class ChillPersonMoveCommand extends Command } $id = $input->getOption($name); - if (ctype_digit($id) === false) { + if (ctype_digit((string) $id) === false) { throw new RuntimeException("The id in \"{$name}\" field does not contains " . "only digits: {$id}"); } diff --git a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php index ac6551bd2..b903b84b3 100644 --- a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php @@ -22,7 +22,7 @@ use Symfony\Component\Console\Output\OutputInterface; class RemoveOldDraftAccompanyingPeriodCommand extends Command { - public function __construct(private LoggerInterface $logger, private OldDraftAccompanyingPeriodRemoverInterface $remover) + public function __construct(private readonly LoggerInterface $logger, private readonly OldDraftAccompanyingPeriodRemoverInterface $remover) { parent::__construct('chill:person:remove-old-draft-period'); } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 10329a87c..027279d04 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -51,7 +51,7 @@ use function count; final class AccompanyingCourseApiController extends ApiController { - public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private EventDispatcherInterface $eventDispatcher, private ReferralsSuggestionInterface $referralAvailable, private Registry $registry, private ValidatorInterface $validator) + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index 99608d640..73c018052 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -32,7 +32,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseCommentController extends AbstractController { - public function __construct(private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private TranslatorInterface $translator) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 41e4a9b90..344b52642 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -41,7 +41,7 @@ use function is_array; */ class AccompanyingCourseController extends Controller { - public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private AccompanyingPeriodWorkRepository $workRepository, private Registry $registry, private TranslatorInterface $translator) + public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index f57ad0c56..8573f547b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -23,7 +23,7 @@ use Symfony\Component\Routing\Annotation\Route; class AccompanyingCourseWorkApiController extends ApiController { - public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) + public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index a36ad67b0..d4f316068 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -28,7 +28,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseWorkController extends AbstractController { - public function __construct(private TranslatorInterface $trans, private SerializerInterface $serializer, private AccompanyingPeriodWorkRepository $workRepository, private PaginatorFactory $paginator, private LoggerInterface $chillLogger) + public function __construct(private readonly TranslatorInterface $trans, private readonly SerializerInterface $serializer, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly PaginatorFactory $paginator, private readonly LoggerInterface $chillLogger) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index 34aeb835a..5ce844a90 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -32,7 +32,7 @@ use Symfony\Component\Templating\EngineInterface; class AccompanyingPeriodRegulationListController { - public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 9a4b5e15a..914c8afde 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -32,7 +32,7 @@ use function in_array; class AccompanyingPeriodWorkEvaluationApiController { - public function __construct(private AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private SerializerInterface $serializer, private PaginatorFactory $paginatorFactory, private Security $security) + public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index 695caa976..8d6072132 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -35,7 +35,7 @@ use function array_values; class HouseholdApiController extends ApiController { - public function __construct(private EventDispatcherInterface $eventDispatcher, private HouseholdRepository $householdRepository, private HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 1abb6290f..01810feeb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -36,7 +36,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdCompositionController extends AbstractController { - public function __construct(private Security $security, private HouseholdCompositionRepository $householdCompositionRepository, private HouseholdRepository $householdRepository, private PaginatorFactory $paginatorFactory, private FormFactoryInterface $formFactory, private EntityManagerInterface $entityManager, private TranslatorInterface $translator, private EngineInterface $engine, private UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 9c4ae1441..ea120920c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -37,7 +37,7 @@ use function count; */ class HouseholdController extends AbstractController { - public function __construct(private TranslatorInterface $translator, private PositionRepository $positionRepository, private SerializerInterface $serializer, private Security $security) + public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index 24cda5fc1..0506feda1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -32,7 +32,7 @@ use function count; class HouseholdMemberController extends ApiController { - public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private AccompanyingPeriodRepository $periodRepository) + public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly AccompanyingPeriodRepository $periodRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index a3513fc1a..f7265537d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -27,11 +27,11 @@ use function in_array; class PersonApiController extends ApiController { - private bool $showCenters; + private readonly bool $showCenters; public function __construct( - private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation, - private ConfigPersonAltNamesHelper $configPersonAltNameHelper, + private readonly AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation, + private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, ParameterBagInterface $parameterBag ) { $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 016577130..448eb4f01 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -48,7 +48,7 @@ use function is_array; final class PersonController extends AbstractController { public function __construct( - private AuthorizationHelperInterface $authorizationHelper, + private readonly AuthorizationHelperInterface $authorizationHelper, protected SimilarPersonMatcher $similarPersonMatcher, protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, @@ -57,9 +57,9 @@ final class PersonController extends AbstractController */ protected PersonRepository $personRepository, protected ConfigPersonAltNamesHelper $configPersonAltNameHelper, - private LoggerInterface $logger, - private ValidatorInterface $validator, - private EntityManagerInterface $em + private readonly LoggerInterface $logger, + private readonly ValidatorInterface $validator, + private readonly EntityManagerInterface $em ) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index d699937f4..aa7171639 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -34,7 +34,7 @@ use function count; class PersonDuplicateController extends Controller { - public function __construct(private SimilarPersonMatcher $similarPersonMatcher, private TranslatorInterface $translator, private PersonRepository $personRepository, private PersonMove $personMove, private EventDispatcherInterface $eventDispatcher) + public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index a1b852ba0..432852331 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -25,7 +25,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceController extends AbstractController { - public function __construct(private PersonResourceRepository $personResourceRepository, private PersonRepository $personRepository, private EntityManagerInterface $em, private TranslatorInterface $translator) + public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index 2a90c57a8..6bfd7ac86 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -40,7 +40,7 @@ use function is_int; class ReassignAccompanyingPeriodController extends AbstractController { - public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private UserRepository $userRepository, private AccompanyingPeriodRepository $courseRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private UserRender $userRender, private EntityManagerInterface $em) + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) { } @@ -84,7 +84,7 @@ class ReassignAccompanyingPeriodController extends AbstractController $assignForm->handleRequest($request); if ($assignForm->isSubmitted() && $assignForm->isValid()) { - $assignPeriodIds = json_decode($assignForm->get('periods')->getData(), true, 512, JSON_THROW_ON_ERROR); + $assignPeriodIds = json_decode((string) $assignForm->get('periods')->getData(), true, 512, JSON_THROW_ON_ERROR); $userTo = $assignForm->get('userTo')->getData(); $userFrom = $assignForm->get('userFrom')->getData(); diff --git a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php index 4d11e2620..eac149245 100644 --- a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php @@ -21,7 +21,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class RelationshipApiController extends ApiController { - public function __construct(private ValidatorInterface $validator, private RelationshipRepository $repository) + public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index 7daf926fc..6d2b92438 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class ResidentialAddressController extends AbstractController { - public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private ResidentialAddressRepository $residentialAddressRepository) + public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index 8bfc90c0b..56ca54564 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -22,7 +22,7 @@ use Symfony\Component\Routing\Annotation\Route; class SocialWorkEvaluationApiController extends AbstractController { - public function __construct(private PaginatorFactory $paginatorFactory) + public function __construct(private readonly PaginatorFactory $paginatorFactory) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php index 45165eec4..cbbd9a748 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkGoalApiController extends ApiController { - public function __construct(private GoalRepository $goalRepository, private PaginatorFactory $paginator) + public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php index 397164707..aaedfd330 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkResultApiController extends ApiController { - public function __construct(private ResultRepository $resultRepository) + public function __construct(private readonly ResultRepository $resultRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php index 09f34dce9..dc28d0f1b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php @@ -23,7 +23,7 @@ use function count; class SocialWorkSocialActionApiController extends ApiController { - public function __construct(private SocialIssueRepository $socialIssueRepository, private PaginatorFactory $paginator) + public function __construct(private readonly SocialIssueRepository $socialIssueRepository, private readonly PaginatorFactory $paginator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 4a8580d30..bee1c6262 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -19,7 +19,7 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private PaginatorFactory $paginatorFactory) + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) { } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php index e55acc13b..84a2d835c 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php @@ -21,7 +21,7 @@ use Doctrine\Persistence\ObjectManager; */ class LoadAccompanyingPeriodOrigin extends AbstractFixture implements OrderedFixtureInterface { - public const ACCOMPANYING_PERIOD_ORIGIN = 'accompanying_period_origin'; + final public const ACCOMPANYING_PERIOD_ORIGIN = 'accompanying_period_origin'; public static $references = []; diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php index 06e1aab71..64fc73d3e 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php @@ -31,7 +31,7 @@ class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture */ private array $cacheEvaluations = []; - public function __construct(private AccompanyingPeriodRepository $periodRepository, private EvaluationRepository $evaluationRepository) + public function __construct(private readonly AccompanyingPeriodRepository $periodRepository, private readonly EvaluationRepository $evaluationRepository) { } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php index e229fb877..e200bc1f8 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php @@ -49,7 +49,7 @@ class LoadCustomFields extends AbstractFixture implements /** * LoadCustomFields constructor. */ - public function __construct(private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php index b619de76d..274aa7638 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php @@ -37,11 +37,11 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface { private const NUMBER_OF_HOUSEHOLD = 10; - private NativeLoader $loader; + private readonly NativeLoader $loader; private array $personIds; - public function __construct(private MembersEditorFactory $editorFactory, private EntityManagerInterface $em) + public function __construct(private readonly MembersEditorFactory $editorFactory, private readonly EntityManagerInterface $em) { $this->loader = new NativeLoader(); } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdCompositionType.php index 720e7ca38..c985f26d3 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdCompositionType.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectManager; class LoadHouseholdCompositionType extends AbstractFixture implements FixtureGroupInterface { - public const TYPES = [ + final public const TYPES = [ ['fr' => 'Couple avec enfant(s)'], ['fr' => 'Couple sans enfant'], ['fr' => 'Mère seule'], diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php index cb1affa85..f5c28c8c2 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php @@ -17,13 +17,13 @@ use Doctrine\Persistence\ObjectManager; class LoadHouseholdPosition extends Fixture { - public const ADULT = 'position_adulte'; + final public const ADULT = 'position_adulte'; - public const CHILD = 'position_enfant'; + final public const CHILD = 'position_enfant'; - public const CHILD_OUT = 'position_enfant_hors'; + final public const CHILD_OUT = 'position_enfant_hors'; - public const POSITIONS_DATA = [ + final public const POSITIONS_DATA = [ ['Adulte', true, true, 1.0, self::ADULT], ['Enfant', true, false, 2.0, self::CHILD], ['Enfant hors ménage', false, false, 3.0, self::CHILD_OUT], diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php index c658a6510..4ef2fde7f 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php @@ -54,7 +54,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord { use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - public const PERSON = 'person'; + final public const PERSON = 'person'; /** * @var array|Center[] diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelations.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelations.php index 480238639..7a05f7f6a 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelations.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelations.php @@ -18,9 +18,9 @@ use Doctrine\Persistence\ObjectManager; class LoadRelations extends Fixture implements FixtureGroupInterface { - public const RELATION_KEY = 'relations'; + final public const RELATION_KEY = 'relations'; - public const RELATIONS = [ + final public const RELATIONS = [ ['title' => ['fr' => 'Parent'], 'reverseTitle' => ['fr' => 'Enfant']], ['title' => ['fr' => 'En couple'], 'reverseTitle' => ['fr' => 'En couple']], ['title' => ['fr' => 'Beau parent'], 'reverseTitle' => ['fr' => 'Belle-fille·beau-fils']], diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 65d79b243..151ecf0c2 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -28,7 +28,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface { use PersonRandomHelper; - public function __construct(private EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php index 9605ce6f6..2ad47fc20 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php @@ -21,7 +21,7 @@ use Throwable; class LoadSocialWorkMetadata extends Fixture implements OrderedFixtureInterface { - public function __construct(private SocialWorkMetadata $importer) + public function __construct(private readonly SocialWorkMetadata $importer) { } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index f4c36e7b7..6b3d9c078 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -77,21 +77,21 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface { - public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR]; + final public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR]; /** * Mark an accompanying period as "occasional". * * used in INTENSITY */ - public const INTENSITY_OCCASIONAL = 'occasional'; + final public const INTENSITY_OCCASIONAL = 'occasional'; /** * Mark an accompanying period as "regular". * * used in INTENSITY */ - public const INTENSITY_REGULAR = 'regular'; + final public const INTENSITY_REGULAR = 'regular'; /** * Mark an accompanying period as "closed". @@ -99,7 +99,7 @@ class AccompanyingPeriod implements * This means that the accompanying period **is** * closed by the creator */ - public const STEP_CLOSED = 'CLOSED'; + final public const STEP_CLOSED = 'CLOSED'; /** * Mark an accompanying period as "confirmed". @@ -107,7 +107,7 @@ class AccompanyingPeriod implements * This means that the accompanying period **is** * confirmed by the creator */ - public const STEP_CONFIRMED = 'CONFIRMED'; + final public const STEP_CONFIRMED = 'CONFIRMED'; /** * Mark an accompanying period as "draft". @@ -115,7 +115,7 @@ class AccompanyingPeriod implements * This means that the accompanying period is not yet * confirmed by the creator */ - public const STEP_DRAFT = 'DRAFT'; + final public const STEP_DRAFT = 'DRAFT'; /** * @ORM\ManyToOne( diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php index e2325aaa0..5224722e7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -38,23 +38,19 @@ class UserHistory implements TrackCreationInterface */ private ?int $id = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ - private DateTimeImmutable $startDate; - - public function __construct(/** - * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories") - * @ORM\JoinColumn(nullable=false) - */ - private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, /** - * @ORM\ManyToOne(targetEntity=User::class) - * @ORM\JoinColumn(nullable=false) - */ + public function __construct( + /** + * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories") + * @ORM\JoinColumn(nullable=false) + */ + private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, + /** + * @ORM\ManyToOne(targetEntity=User::class) + * @ORM\JoinColumn(nullable=false) + */ private User $user, - ?DateTimeImmutable $startDate = null + private DateTimeImmutable $startDate = new DateTimeImmutable('now') ) { - $this->startDate = $startDate ?? new DateTimeImmutable('now'); } public function getAccompanyingPeriod(): AccompanyingPeriod diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index ac8988c26..89996a18e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -76,18 +76,18 @@ use function in_array; */ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable { - public const BOTH_GENDER = 'both'; + final public const BOTH_GENDER = 'both'; // have days in commun - public const ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD = 2; // where there exist + final public const ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD = 2; // where there exist - public const ERROR_PERIODS_ARE_COLLAPSING = 1; // when two different periods + final public const ERROR_PERIODS_ARE_COLLAPSING = 1; // when two different periods - public const FEMALE_GENDER = 'woman'; + final public const FEMALE_GENDER = 'woman'; - public const MALE_GENDER = 'man'; + final public const MALE_GENDER = 'man'; - public const NO_INFORMATION = 'unknown'; + final public const NO_INFORMATION = 'unknown'; /** * Accept receiving email. diff --git a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php index 1242e61ef..5968832c2 100644 --- a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php +++ b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php @@ -21,7 +21,7 @@ use Symfony\Contracts\EventDispatcher\Event; class PersonAddressMoveEvent extends Event { - public const PERSON_MOVE_POST = 'chill_person.person_move_post'; + final public const PERSON_MOVE_POST = 'chill_person.person_move_post'; private ?Address $nextAddress = null; @@ -31,7 +31,7 @@ class PersonAddressMoveEvent extends Event private ?HouseholdMember $previousMembership = null; - public function __construct(private Person $person) + public function __construct(private readonly Person $person) { } diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index 2776faf43..60d521424 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodWorkEventListener { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index d01190ba4..27b0c9b93 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -21,7 +21,7 @@ use function in_array; class AdministrativeLocationAggregator implements AggregatorInterface { - public function __construct(private LocationRepository $locationRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly LocationRepository $locationRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index b2703836e..758e93a9d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveAggregator implements AggregatorInterface { - public function __construct(private ClosingMotiveRepositoryInterface $motiveRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ClosingMotiveRepositoryInterface $motiveRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index a4279fc05..ed1f2727c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ConfidentialAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index 87e119419..edd6239f5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -21,7 +21,7 @@ use function in_array; class CreatorJobAggregator implements AggregatorInterface { - public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly UserJobRepository $jobRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index ce61739f0..a5eba39fa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class DurationAggregator implements AggregatorInterface +final readonly class DurationAggregator implements AggregatorInterface { private const CHOICES = [ 'month', diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index aeb369b5a..6a791b8ab 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index 47656c1d0..d9f873225 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class EvaluationAggregator implements AggregatorInterface +final readonly class EvaluationAggregator implements AggregatorInterface { public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index 3395247de..b05e9557c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -27,7 +27,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use UnexpectedValueException; -final class GeographicalUnitStatAggregator implements AggregatorInterface +final readonly class GeographicalUnitStatAggregator implements AggregatorInterface { public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index 2d9adc801..88ad95fb2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class IntensityAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index e6cb9cac6..c0e92eca9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -23,11 +23,11 @@ use function in_array; final class OriginAggregator implements AggregatorInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct( EntityManagerInterface $em, - private TranslatableStringHelper $translatableStringHelper + private readonly TranslatableStringHelper $translatableStringHelper ) { $this->repository = $em->getRepository(Origin::class); } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index db12bbb0c..1e1b24aae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -21,7 +21,7 @@ use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -final class ReferrerAggregator implements AggregatorInterface +final readonly class ReferrerAggregator implements AggregatorInterface { private const A = 'acp_ref_agg_uhistory'; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index 6e788d714..84670ee01 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -26,7 +26,7 @@ class ReferrerScopeAggregator implements AggregatorInterface { private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name'; - public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 5555671d3..0c3292d68 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -18,7 +18,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -final class RequestorAggregator implements AggregatorInterface +final readonly class RequestorAggregator implements AggregatorInterface { public function __construct(private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index d3f7783f3..3ee220255 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ScopeAggregator implements AggregatorInterface +final readonly class ScopeAggregator implements AggregatorInterface { public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index e088be7ce..771e29396 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class SocialActionAggregator implements AggregatorInterface +final readonly class SocialActionAggregator implements AggregatorInterface { public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 4ce7dfcd0..ad3197d38 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class SocialIssueAggregator implements AggregatorInterface +final readonly class SocialIssueAggregator implements AggregatorInterface { public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index 4fb7a38b8..5a49df05c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -final class StepAggregator implements AggregatorInterface +final readonly class StepAggregator implements AggregatorInterface { private const A = 'acpstephistories'; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php index 97a8b228e..e75482bff 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class UserJobAggregator implements AggregatorInterface +final readonly class UserJobAggregator implements AggregatorInterface { public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php index c8dd3b611..0113de714 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php @@ -29,8 +29,6 @@ class ByEndDateAggregator implements AggregatorInterface private const DEFAULT_CHOICE = 'year'; - private TranslatorInterface $translator; - public function addRole(): ?string { return null; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php index 07498f026..56f71c297 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php @@ -29,8 +29,6 @@ class ByMaxDateAggregator implements AggregatorInterface private const DEFAULT_CHOICE = 'year'; - private TranslatorInterface $translator; - public function addRole(): ?string { return null; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php index d5317feb6..d2ea6a559 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php @@ -29,8 +29,6 @@ class ByStartDateAggregator implements AggregatorInterface private const DEFAULT_CHOICE = 'year'; - private TranslatorInterface $translator; - public function addRole(): ?string { return null; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index 2201cd747..2980e3d90 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationTypeAggregator implements AggregatorInterface { - public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly EvaluationRepository $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php index 9bc91f099..c0c31a5fd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HavingEndDateAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index 7b4b3c646..2037716aa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -24,7 +24,7 @@ use function in_array; class ChildrenNumberAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 1d38dddd4..946844f4b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -25,7 +25,7 @@ use function in_array; class CompositionAggregator implements AggregatorInterface { - public function __construct(private HouseholdCompositionTypeRepository $typeRepository, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly HouseholdCompositionTypeRepository $typeRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 88cf2363a..5d361fc8f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface +final readonly class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface { public function __construct(private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php index ccb4710e0..8f4191352 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php @@ -27,7 +27,7 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface { private const PREFIX = 'acp_by_household_compo_agg'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter, private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index 25b01b3f7..de3747582 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface +final readonly class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface { public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index 60ab87fed..988639571 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -19,7 +19,7 @@ use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class GenderAggregator implements AggregatorInterface +final readonly class GenderAggregator implements AggregatorInterface { public function __construct(private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php index e86524670..2911fc868 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php @@ -26,7 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitAggregator implements AggregatorInterface { - public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index 48a08b190..120f50722 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -27,7 +27,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface +final readonly class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface { public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 98049357a..96615a29d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class MaritalStatusAggregator implements AggregatorInterface +final readonly class MaritalStatusAggregator implements AggregatorInterface { public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index 14f5a5dd5..22c3e9ce7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface +final readonly class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface { public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index a1b384ffa..a5be01391 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -22,7 +22,7 @@ use LogicException; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ActionTypeAggregator implements AggregatorInterface +final readonly class ActionTypeAggregator implements AggregatorInterface { public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php index 30d272c15..9bb252f07 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php @@ -20,7 +20,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CurrentActionAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index a63580cf7..9ac183b0d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class GoalAggregator implements AggregatorInterface +final readonly class GoalAggregator implements AggregatorInterface { public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php index 7d3610c71..c6894ab8b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php @@ -23,7 +23,7 @@ use function in_array; class GoalResultAggregator implements AggregatorInterface { - public function __construct(private ResultRepository $resultRepository, private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ResultRepository $resultRepository, private readonly GoalRepository $goalRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index 314149829..eae7e8789 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class JobAggregator implements AggregatorInterface +final readonly class JobAggregator implements AggregatorInterface { public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index a7adf6802..5d301c5be 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ReferrerAggregator implements AggregatorInterface +final readonly class ReferrerAggregator implements AggregatorInterface { public function __construct(private UserRepository $userRepository, private UserRender $userRender) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index c621b0899..3a8b10581 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ResultAggregator implements AggregatorInterface +final readonly class ResultAggregator implements AggregatorInterface { public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 1a085828f..9ec248caa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; -final class ScopeAggregator implements AggregatorInterface +final readonly class ScopeAggregator implements AggregatorInterface { public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index 507f02041..a512700ee 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -16,15 +16,15 @@ namespace Chill\PersonBundle\Export; */ abstract class Declarations { - public const ACP_TYPE = 'accompanying_period'; + final public const ACP_TYPE = 'accompanying_period'; - public const EVAL_TYPE = 'evaluation'; + final public const EVAL_TYPE = 'evaluation'; - public const HOUSEHOLD_TYPE = 'household'; + final public const HOUSEHOLD_TYPE = 'household'; - public const PERSON_IMPLIED_IN = 'person_implied_in'; + final public const PERSON_IMPLIED_IN = 'person_implied_in'; - public const PERSON_TYPE = 'person'; + final public const PERSON_TYPE = 'person'; - public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; + final public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 74d4bb4ff..b25f24c8c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -25,7 +25,7 @@ use Symfony\Component\Form\FormBuilderInterface; class CountEvaluation implements ExportInterface, GroupedExportInterface { - public function __construct(private EntityManagerInterface $entityManager) + public function __construct(private readonly EntityManagerInterface $entityManager) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 778f19812..823ea703e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -30,7 +30,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface { private const TR_PREFIX = 'export.export.nb_household_with_course.'; - public function __construct(private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index e52cc83b1..c887a9468 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -27,7 +27,7 @@ use function in_array; class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExportInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct( EntityManagerInterface $em diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 57e92f818..6c78f1494 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -78,7 +78,7 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface 'updatedBy', ]; - public function __construct(private ExportAddressHelper $addressHelper, private DateTimeHelper $dateTimeHelper, private EntityManagerInterface $entityManager, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender, private SocialIssueRepository $socialIssueRepository, private SocialIssueRender $socialIssueRender, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, private UserHelper $userHelper) + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly DateTimeHelper $dateTimeHelper, private readonly EntityManagerInterface $entityManager, private readonly PersonRenderInterface $personRender, private readonly PersonRepository $personRepository, private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender, private readonly SocialIssueRepository $socialIssueRepository, private readonly SocialIssueRender $socialIssueRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly UserHelper $userHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php index 0625d1552..33761de88 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php @@ -76,7 +76,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac 'updatedBy', ]; - public function __construct(private EntityManagerInterface $entityManager, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private LabelThirdPartyHelper $thirdPartyHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private RollingDateConverterInterface $rollingDateConverter, private AggregateStringHelper $aggregateStringHelper, private SocialActionRepository $socialActionRepository) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly DateTimeHelper $dateTimeHelper, private readonly UserHelper $userHelper, private readonly LabelPersonHelper $personHelper, private readonly LabelThirdPartyHelper $thirdPartyHelper, private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private readonly SocialIssueRender $socialIssueRender, private readonly SocialIssueRepository $socialIssueRepository, private readonly SocialActionRender $socialActionRender, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly AggregateStringHelper $aggregateStringHelper, private readonly SocialActionRepository $socialActionRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index ebe3911a9..548054c58 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -68,7 +68,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface 'updatedBy', ]; - public function __construct(private EntityManagerInterface $entityManager, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository, private SocialActionRender $socialActionRender, private SocialActionRepository $socialActionRepository, private UserHelper $userHelper, private LabelPersonHelper $personHelper, private DateTimeHelper $dateTimeHelper, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private AggregateStringHelper $aggregateStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly SocialIssueRender $socialIssueRender, private readonly SocialIssueRepository $socialIssueRepository, private readonly SocialActionRender $socialActionRender, private readonly SocialActionRepository $socialActionRepository, private readonly UserHelper $userHelper, private readonly LabelPersonHelper $personHelper, private readonly DateTimeHelper $dateTimeHelper, private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private readonly AggregateStringHelper $aggregateStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php index 06d79d6fc..a140d166e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php @@ -45,7 +45,7 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface 'compositionType', ]; - public function __construct(private ExportAddressHelper $addressHelper, private AggregateStringHelper $aggregateStringHelper, private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringExportLabelHelper $translatableStringHelper) + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly AggregateStringHelper $aggregateStringHelper, private readonly EntityManagerInterface $entityManager, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringExportLabelHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index 02c0722d4..919e83049 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -50,7 +50,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou { private $slugs = []; - public function __construct(private ExportAddressHelper $addressHelper, private CustomFieldProvider $customFieldProvider, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly CustomFieldProvider $customFieldProvider, private readonly ListPersonHelper $listPersonHelper, private readonly EntityManagerInterface $entityManager, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 4181098b2..e986ef43c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -49,8 +49,8 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat public function __construct( EntityManagerInterface $em, - private TranslatorInterface $translator, - private UrlGeneratorInterface $router, + private readonly TranslatorInterface $translator, + private readonly UrlGeneratorInterface $router, $routeParameters ) { $this->entityManager = $em; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php index 9676a9437..57e943bc0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php @@ -37,7 +37,7 @@ use function strlen; class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface { - public function __construct(private ExportAddressHelper $addressHelper, private ListPersonHelper $listPersonHelper, private EntityManagerInterface $entityManager) + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly ListPersonHelper $listPersonHelper, private readonly EntityManagerInterface $entityManager) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 1d0161b24..5b6bea62a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -29,7 +29,7 @@ use Symfony\Component\Form\FormBuilderInterface; class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct( EntityManagerInterface $em diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 3f5a25053..3ca897e61 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOnDateFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index ff1ac7653..cf1703254 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOneDayBetweenDatesFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index d4e74d165..871d56ce7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index a8fb0b48e..59d7a7f38 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 1803e8067..e8f5c76da 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -28,7 +28,7 @@ class ConfidentialFilter implements FilterInterface private const DEFAULT_CHOICE = false; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index 79412bb61..9f77729d2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -23,7 +23,7 @@ use function in_array; class CreatorJobFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index b680299a1..04a9d5e0e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -28,7 +28,7 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = false; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index e4e895555..c762db932 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -23,7 +23,7 @@ use function in_array; class EvaluationFilter implements FilterInterface { - public function __construct(private EvaluationRepositoryInterface $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 31a449a35..83ba64949 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -32,7 +32,7 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php index 43503a6b9..b20ef28e7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HasNoReferrerFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 9ef7f012f..36aa711bd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HasTemporaryLocationFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index 1f215bce9..3bdadb75d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -28,7 +28,7 @@ class IntensityFilter implements FilterInterface private const DEFAULT_CHOICE = 'occasional'; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 23823467f..d74b7d433 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class OpenBetweenDatesFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index f3b927f68..97390621b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class OriginFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index ee79ca8f8..9bb0e8f45 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -29,7 +29,7 @@ class ReferrerFilter implements FilterInterface private const PU = 'acp_referrer_filter_users'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 60fc9e5ec..7e8aa2de4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -final class RequestorFilter implements FilterInterface +final readonly class RequestorFilter implements FilterInterface { private const DEFAULT_CHOICE = 'participation'; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index fd4d4ac64..64d7c4848 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -23,7 +23,7 @@ use function in_array; class SocialActionFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private SocialActionRender $actionRender) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly SocialActionRender $actionRender) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index ee9ebfc79..88b45e7be 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -30,7 +30,7 @@ class SocialIssueFilter implements FilterInterface public function __construct( TranslatorInterface $translator, - private SocialIssueRender $socialIssueRender + private readonly SocialIssueRender $socialIssueRender ) { $this->translator = $translator; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php index e217cdab0..0549bc7a1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php @@ -37,7 +37,7 @@ class StepFilter implements FilterInterface 'Closed' => AccompanyingPeriod::STEP_CLOSED, ]; - public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index 7e8a3ecc3..b63c5c8f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -34,7 +34,7 @@ class UserJobFilter implements FilterInterface private const PJ = 'acp_ujob_filter_job'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private UserJobRepositoryInterface $userJobRepository, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php index 58a935a0e..5abbdeec4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php @@ -35,7 +35,7 @@ class UserScopeFilter implements FilterInterface private const PS = 'acp_uscope_filter_scopes'; - public function __construct(private ScopeRepositoryInterface $scopeRepository, private Security $security, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly Security $security, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php index 553e58a39..41e2ffc0a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByEndDateFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php index 7485020ce..f44acf6cc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByStartDateFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index 1062b8a12..5a4f3a2e0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -20,7 +20,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -final class EvaluationTypeFilter implements FilterInterface +final readonly class EvaluationTypeFilter implements FilterInterface { public function __construct(private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 1ca3f3f99..f020e24f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -25,7 +25,7 @@ class MaxDateFilter implements FilterInterface 'maxdate is not specified' => false, ]; - public function __construct(private TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index dcf98f307..4e18e0adc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -26,7 +26,7 @@ use function in_array; class CompositionFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php index b4001b3c4..9d0568f02 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index da3c4a7f2..89a4dac56 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -26,7 +26,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index 46946e41e..4724b2987 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -24,7 +24,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php index 63ee441af..8307d7d70 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php @@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ByHouseholdCompositionFilter implements FilterInterface { - public function __construct(private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index 7daf1c9e1..c37d06da9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; class DeadOrAliveFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php index 04675054f..a47893316 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php @@ -24,7 +24,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php index 509bb3ab0..5776d0588 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php @@ -26,7 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private GeographicalUnitRepositoryInterface $geographicalUnitRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index 279b693f6..6fa4987bb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -19,7 +19,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; class MaritalStatusFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index 4463f433f..75fe4e2d4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -26,7 +26,7 @@ class NationalityFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index 4afc3fd71..2418671cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -27,7 +27,7 @@ use function in_array; class ResidentialAddressAtThirdpartyFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index e6b55904e..05e7cc630 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -24,7 +24,7 @@ use function in_array; class ResidentialAddressAtUserFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php index 702b8a7b0..d1ed0bbf2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; class WithoutHouseholdComposition implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 36b671d54..cd65f16a5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -24,7 +24,7 @@ use function in_array; class JobFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index f393354b1..2d75c1ae2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -24,7 +24,7 @@ use function in_array; class ScopeFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper) + public function __construct(protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 83fea8223..c717372d8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -28,7 +28,7 @@ use function in_array; class SocialWorkTypeFilter implements FilterInterface { - public function __construct(private SocialActionRender $socialActionRender, private TranslatableStringHelper $translatableStringHelper, private EntityManagerInterface $em) + public function __construct(private readonly SocialActionRender $socialActionRender, private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php index 5afde9986..20029b296 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php @@ -18,7 +18,7 @@ use const SORT_NUMERIC; class LabelPersonHelper { - public function __construct(private PersonRepository $personRepository, private PersonRenderInterface $personRender) + public function __construct(private readonly PersonRepository $personRepository, private readonly PersonRenderInterface $personRender) { } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 600aaa60b..0f8d6d4ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -41,7 +41,7 @@ use function strlen; */ class ListPersonHelper { - public const FIELDS = [ + final public const FIELDS = [ 'id', 'civility', 'firstName', @@ -73,7 +73,7 @@ class ListPersonHelper 'lifecycleUpdate', ]; - public function __construct(private ExportAddressHelper $addressHelper, private CenterRepositoryInterface $centerRepository, private CivilityRepositoryInterface $civilityRepository, private CountryRepository $countryRepository, private LanguageRepositoryInterface $languageRepository, private MaritalStatusRepositoryInterface $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) + public function __construct(private readonly ExportAddressHelper $addressHelper, private readonly CenterRepositoryInterface $centerRepository, private readonly CivilityRepositoryInterface $civilityRepository, private readonly CountryRepository $countryRepository, private readonly LanguageRepositoryInterface $languageRepository, private readonly MaritalStatusRepositoryInterface $maritalStatusRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator, private readonly UserRepositoryInterface $userRepository) { } @@ -201,7 +201,7 @@ class ListPersonHelper public function getLabels($key, array $values, $data): callable { - if (str_starts_with($key, 'address_fields')) { + if (str_starts_with((string) $key, 'address_fields')) { return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); } diff --git a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php index 8f1f0ba43..01814af38 100644 --- a/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/CreationPersonType.php @@ -40,11 +40,11 @@ final class CreationPersonType extends AbstractType // TODO: See if this is still valid and update accordingly. public const NAME = 'chill_personbundle_person_creation'; - private bool $askCenters; + private readonly bool $askCenters; public function __construct( - private ConfigPersonAltNamesHelper $configPersonAltNamesHelper, - private EventDispatcherInterface $dispatcher, + private readonly ConfigPersonAltNamesHelper $configPersonAltNamesHelper, + private readonly EventDispatcherInterface $dispatcher, ParameterBagInterface $parameterBag ) { $this->askCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; @@ -114,7 +114,7 @@ final class CreationPersonType extends AbstractType $resolver->setDefaults([ 'data_class' => Person::class, 'constraints' => [ - new Callback([$this, 'validateCheckedAddress']), + new Callback($this->validateCheckedAddress(...)), ], ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php index 4dc2e1a73..0fe60cbe9 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class HouseholdCompositionType extends AbstractType { - public function __construct(private HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 3790cb03a..a4946b52d 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -29,7 +29,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private ResourceKindRender $resourceKindRender, private PersonRenderInterface $personRender, private ThirdPartyRender $thirdPartyRender, private TranslatorInterface $translator) + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index db5635f97..6ba4cafaf 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -64,7 +64,7 @@ class PersonType extends AbstractType array $personFieldsConfiguration, ConfigPersonAltNamesHelper $configAltNamesHelper, protected TranslatableStringHelperInterface $translatableStringHelper, - private ParameterBagInterface $parameterBag + private readonly ParameterBagInterface $parameterBag ) { $this->config = $personFieldsConfiguration; $this->configAltNamesHelper = $configAltNamesHelper; diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php index 0c7efe647..17aad8bd0 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php @@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonAltNameType extends AbstractType { - public function __construct(private ConfigPersonAltNamesHelper $configHelper, private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly ConfigPersonAltNamesHelper $configHelper, private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index db51d507a..a55721011 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonPhoneType extends AbstractType { - public function __construct(private PhonenumberHelper $phonenumberHelper, private EntityManagerInterface $em) + public function __construct(private readonly PhonenumberHelper $phonenumberHelper, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php index 4c3139c8e..440b6568c 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php @@ -26,7 +26,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickPersonDynamicType extends AbstractType { - public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php index b2e3c6d9b..0fe09e56a 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php @@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialActionType extends AbstractType { - public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php index 31cd44ab1..3e6ae1e97 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php @@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialIssueType extends AbstractType { - public function __construct(private SocialIssueRender $issueRender, private SocialIssueRepository $issueRepository) + public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php index a4e6c46c9..69823c07c 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php @@ -28,7 +28,7 @@ use const SORT_STRING; */ class Select2MaritalStatusType extends AbstractType { - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EntityManagerInterface $em) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index 92f1bba5c..50807bcff 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -28,11 +28,11 @@ use function spl_object_hash; class MembersEditor { - public const VALIDATION_GROUP_AFFECTED = 'household_memberships'; + final public const VALIDATION_GROUP_AFFECTED = 'household_memberships'; - public const VALIDATION_GROUP_COMPOSITION = 'household_composition'; + final public const VALIDATION_GROUP_COMPOSITION = 'household_composition'; - public const VALIDATION_GROUP_CREATED = 'household_memberships_created'; + final public const VALIDATION_GROUP_CREATED = 'household_memberships_created'; private array $events = []; @@ -42,7 +42,7 @@ class MembersEditor private array $persistables = []; - public function __construct(private ValidatorInterface $validator, private ?\Chill\PersonBundle\Entity\Household\Household $household, private EventDispatcherInterface $eventDispatcher) + public function __construct(private readonly ValidatorInterface $validator, private readonly ?\Chill\PersonBundle\Entity\Household\Household $household, private readonly EventDispatcherInterface $eventDispatcher) { } diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php index 9fae0dc82..cb6f7d4ea 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php @@ -17,7 +17,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class MembersEditorFactory { - public function __construct(private EventDispatcherInterface $eventDispatcher, private ValidatorInterface $validator) + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator) { } diff --git a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php index dde404de0..2bbd47527 100644 --- a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php @@ -40,9 +40,9 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface public function __construct( ParameterBagInterface $parameterBag, - private Security $security, + private readonly Security $security, protected TranslatorInterface $translator, - private ResidentialAddressRepository $residentialAddressRepo + private readonly ResidentialAddressRepository $residentialAddressRepo ) { $this->showAccompanyingPeriod = $parameterBag->get('chill_person.accompanying_period'); } diff --git a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php index acbdd6d3c..c562545bb 100644 --- a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php @@ -28,7 +28,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface /** * SectionMenuBuilder constructor. */ - public function __construct(protected ParameterBagInterface $parameterBag, private Security $security, protected TranslatorInterface $translator) + public function __construct(protected ParameterBagInterface $parameterBag, private readonly Security $security, protected TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php index 85e18633d..ddcae7d97 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php @@ -16,7 +16,7 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; -final class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface +final readonly class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface { public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) { diff --git a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php index 957461b55..1475c35ec 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php @@ -36,7 +36,7 @@ use Symfony\Component\EventDispatcher\Event; class AccompanyingPeriodPrivacyEvent extends Event { - public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; + final public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; public function __construct(protected $period, protected $args = []) { diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php index 27861944c..c021a0b8f 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php @@ -44,7 +44,7 @@ use function count; */ class PrivacyEvent extends Event { - public const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event'; + final public const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event'; /** * @var array @@ -54,7 +54,7 @@ class PrivacyEvent extends Event /** * PrivacyEvent constructor. */ - public function __construct(private Person $person, private array $args = ['action' => 'show']) + public function __construct(private readonly Person $person, private readonly array $args = ['action' => 'show']) { } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php index 7aa8fde00..193509890 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocumentRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; class AccompanyingPeriodWorkEvaluationDocumentRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php index 3cd9284df..28cbca270 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationRepository.php @@ -21,7 +21,7 @@ use Doctrine\Persistence\ObjectRepository; class AccompanyingPeriodWorkEvaluationRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php index a80964325..4e092beb0 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php @@ -23,7 +23,7 @@ use Doctrine\ORM\EntityRepository; */ final class AccompanyingPeriodWorkGoalRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index 85c382a49..eaacaf333 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -23,7 +23,7 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; -final class AccompanyingPeriodWorkRepository implements ObjectRepository +final readonly class AccompanyingPeriodWorkRepository implements ObjectRepository { private EntityRepository $repository; diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php index 7983596c7..4a50de12b 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php @@ -16,7 +16,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query\ResultSetMappingBuilder; -final class ClosingMotiveRepository implements ClosingMotiveRepositoryInterface +final readonly class ClosingMotiveRepository implements ClosingMotiveRepositoryInterface { private EntityRepository $repository; diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php index 207864ae2..3759cf2cd 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class CommentRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php index 3b3b6283d..1668b456e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class OriginRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php index d8bc4e306..a5dbf4b69 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class ResourceRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index 2b70da0a1..0c65a4e5a 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -33,7 +33,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Security\Core\Security; use function count; -final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface +final readonly class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface { public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private Security $security, private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php index 5384a1cdd..616c56eb0 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class AccompanyingPeriodParticipationRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 6b7311207..36af2c763 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -21,7 +21,7 @@ use Doctrine\Persistence\ObjectRepository; final class AccompanyingPeriodRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php index 33a17dfa1..7cc9e7dbe 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php @@ -20,7 +20,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Security\Core\Security; -final class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryInterface +final readonly class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryInterface { public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php index e25d0c867..5a0dee15d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionRepository.php @@ -18,7 +18,7 @@ use Doctrine\ORM\EntityRepository; final class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php index 04110942b..1e2c4a67f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdCompositionTypeRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdMembersRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdMembersRepository.php index 564c17732..e76e88fc3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdMembersRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdMembersRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class HouseholdMembersRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php index 5123e8eb1..95fbda3ee 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php @@ -42,9 +42,9 @@ final class HouseholdRepository implements ObjectRepository SELECT {select} FROM households {limits} SQL; - private EntityManagerInterface $em; + private readonly EntityManagerInterface $em; - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php index bc8fddf4e..ebcfabe4f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class PersonHouseholdAddressRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php index 734d83156..99e7338f9 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php @@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository; final class PositionRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php index 8697f9346..3324ee444 100644 --- a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class MaritalStatusRepository implements MaritalStatusRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php index a29c4f93a..b6d80a721 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; class PersonCenterHistoryRepository implements PersonCenterHistoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index dd82b6b96..cd68796f0 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -32,7 +32,7 @@ use function count; use function explode; use function implode; -final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface +final readonly class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface { public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php index 41a9efe63..4a1ee1dd6 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class PersonAltNameRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php index 146357715..6694f0e32 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php @@ -18,7 +18,7 @@ use Doctrine\ORM\EntityRepository; final class PersonNotDuplicateRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index a38df8787..39b4dc306 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -24,7 +24,7 @@ use function str_replace; final class PersonRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php index 75f205cbc..9280ade69 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonResourceRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; final class PersonResourceRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php index 111f122a7..d3fe813dc 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php @@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository; class RelationRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php index 442ce1c55..932b872c5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php @@ -20,9 +20,9 @@ use Doctrine\Persistence\ObjectRepository; class RelationshipRepository implements ObjectRepository { - private EntityManagerInterface $em; + private readonly EntityManagerInterface $em; - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php index e8de5a278..a7b739f7d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php @@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository; final class EvaluationRepository implements EvaluationRepositoryInterface { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php index c667eafbf..a798c8388 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php @@ -21,7 +21,7 @@ use Doctrine\Persistence\ObjectRepository; final class GoalRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php index 747611500..407626afe 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php @@ -21,7 +21,7 @@ use Doctrine\Persistence\ObjectRepository; final class ResultRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php index 62ca3d853..b4df922a1 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php @@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository; final class SocialActionRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php index 63dfcc510..f645a4ac4 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php @@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository; final class SocialIssueRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index 05b55dd23..205023f19 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -38,14 +38,14 @@ use function array_merge; class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterface { - public const NAME = 'person_regular'; + final public const NAME = 'person_regular'; private const POSSIBLE_KEYS = [ '_default', 'firstname', 'lastname', 'birthdate', 'birthdate-before', 'birthdate-after', 'gender', 'nationality', 'phonenumber', 'city', ]; - public function __construct(private EngineInterface $templating, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private PaginatorFactory $paginatorFactory, private PersonACLAwareRepositoryInterface $personACLAwareRepository) + public function __construct(private readonly EngineInterface $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository) { } @@ -101,7 +101,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf foreach (['firstname', 'lastname', 'gender', 'city'] as $key) { $string .= !isset($data[$key]) ? '' : $key . ':' . // add quote if contains spaces - (str_contains($data[$key], ' ') ? '"' . $data[$key] . '"' : $data[$key]) + (str_contains((string) $data[$key], ' ') ? '"' . $data[$key] . '"' : $data[$key]) . ' '; } diff --git a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php index 5dcb3e7b3..fd8bc9557 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php @@ -26,7 +26,7 @@ use function in_array; class SearchHouseholdApiProvider implements SearchApiInterface { - public function __construct(private HouseholdRepository $householdRepository, private PersonACLAwareRepositoryInterface $personACLAwareRepository, private Security $security, private AuthorizationHelperInterface $authorizationHelper, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) + public function __construct(private readonly HouseholdRepository $householdRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) { } diff --git a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php index 9e2e9d6f5..5ad51f842 100644 --- a/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php +++ b/src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php @@ -26,7 +26,7 @@ use function in_array; class SearchPersonApiProvider implements SearchApiInterface { - public function __construct(private PersonRepository $personRepository, private PersonACLAwareRepositoryInterface $personACLAwareRepository, private Security $security, private AuthorizationHelperInterface $authorizationHelper, private ExtractDateFromPattern $extractDateFromPattern, private ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) + public function __construct(private readonly PersonRepository $personRepository, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository, private readonly Security $security, private readonly AuthorizationHelperInterface $authorizationHelper, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern) { } diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 4da00c5fa..03b46957c 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -23,9 +23,9 @@ use function count; class SimilarPersonMatcher { - public const SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL = 'alphabetical'; + final public const SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL = 'alphabetical'; - public const SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity'; + final public const SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity'; /** * @var AuthorizationHelper diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php index e8a06a8b3..613a3a514 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodCommentVoter.php @@ -19,11 +19,11 @@ use UnexpectedValueException; class AccompanyingPeriodCommentVoter extends Voter { - public const DELETE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_DELETE'; + final public const DELETE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_DELETE'; - public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT'; + final public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT'; - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php index 432c142fe..38c3c8633 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodResourceVoter.php @@ -19,9 +19,9 @@ use UnexpectedValueException; class AccompanyingPeriodResourceVoter extends Voter { - public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_RESOURCE_EDIT'; + final public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_RESOURCE_EDIT'; - public function __construct(private AccessDecisionManagerInterface $accessDecisionManager) + public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) { } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index 817873738..c99ee0da4 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -29,7 +29,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH /** * all the roles that are linked to an accompanying period. */ - public const ALL = [ + final public const ALL = [ self::SEE, self::SEE_DETAILS, self::CREATE, @@ -44,28 +44,28 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH /** * Give the ability to see all confidential courses. */ - public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL'; + final public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL'; - public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE'; + final public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE'; /** * role to DELETE the course. * * Will be true only for the creator, and if the course is still at DRAFT step. */ - public const DELETE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE'; + final public const DELETE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE'; /** * role to EDIT the course. * * If the course is closed, it will be always false. */ - public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE'; + final public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE'; /** * Give all the right above. */ - public const FULL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_FULL'; + final public const FULL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_FULL'; /** * Reopen a closed course. @@ -73,43 +73,43 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH * This forward to the EDIT role, without taking into account that the course * is closed */ - public const RE_OPEN_COURSE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_REOPEN'; + final public const RE_OPEN_COURSE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_REOPEN'; /** * Allow user to bulk reassign the courses. */ - public const REASSIGN_BULK = 'CHILL_PERSON_ACCOMPANYING_COURSE_REASSIGN_BULK'; + final public const REASSIGN_BULK = 'CHILL_PERSON_ACCOMPANYING_COURSE_REASSIGN_BULK'; - public const SEE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE'; + final public const SEE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE'; /** * details are for seeing:. * * * SocialIssues */ - public const SEE_DETAILS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS'; + final public const SEE_DETAILS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS'; /** * Give the ability to see statistics. */ - public const STATS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_STATS'; + final public const STATS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_STATS'; /** * Right to toggle confidentiality. */ - public const TOGGLE_CONFIDENTIAL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL'; + final public const TOGGLE_CONFIDENTIAL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL'; - public const TOGGLE_CONFIDENTIAL_ALL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL_ALL'; + final public const TOGGLE_CONFIDENTIAL_ALL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL_ALL'; /** * Right to toggle urgency of parcours. */ - public const TOGGLE_INTENSITY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_INTENSITY'; + final public const TOGGLE_INTENSITY = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_INTENSITY'; - private VoterHelperInterface $voterHelper; + private readonly VoterHelperInterface $voterHelper; public function __construct( - private Security $security, + private readonly Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { $this->voterHelper = $voterHelperFactory diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php index 8591a044f..dffe3a89c 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationDocumentVoter.php @@ -24,9 +24,9 @@ use UnexpectedValueException; */ class AccompanyingPeriodWorkEvaluationDocumentVoter extends Voter { - public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_DOCUMENT_SHOW'; + final public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_DOCUMENT_SHOW'; - public function __construct(private AccessDecisionManagerInterface $accessDecisionManager) + public function __construct(private readonly AccessDecisionManagerInterface $accessDecisionManager) { } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php index 955d199ff..2588443cb 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkEvaluationVoter.php @@ -21,16 +21,16 @@ use function in_array; class AccompanyingPeriodWorkEvaluationVoter extends Voter implements ChillVoterInterface { - public const ALL = [ + final public const ALL = [ self::SEE, self::STATS, ]; - public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_SHOW'; + final public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_SHOW'; - public const STATS = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_STATS'; + final public const STATS = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_EVALUATION_STATS'; - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php index 43a99e7e1..69f90fa12 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php @@ -27,25 +27,25 @@ use function in_array; class AccompanyingPeriodWorkVoter extends Voter implements ProvideRoleHierarchyInterface, ChillVoterInterface { - public const ALL = [ + final public const ALL = [ self::SEE, self::CREATE, self::UPDATE, self::DELETE, ]; - public const CREATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE'; + final public const CREATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE'; - public const DELETE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE'; + final public const DELETE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE'; - public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE'; + final public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE'; - public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE'; + final public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE'; - private VoterHelperInterface $voterHelper; + private readonly VoterHelperInterface $voterHelper; public function __construct( - private Security $security, + private readonly Security $security, VoterHelperFactoryInterface $voterHelperFactory ) { $this->voterHelper = $voterHelperFactory diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php index 74eee07f6..7000730a7 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php @@ -26,16 +26,16 @@ use function in_array; class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, ChillVoterInterface { - public const EDIT = 'CHILL_PERSON_HOUSEHOLD_EDIT'; + final public const EDIT = 'CHILL_PERSON_HOUSEHOLD_EDIT'; - public const SEE = 'CHILL_PERSON_HOUSEHOLD_SEE'; + final public const SEE = 'CHILL_PERSON_HOUSEHOLD_SEE'; /** * @deprecated use @see{self::SEE} instead */ - public const SHOW = self::SEE; + final public const SHOW = self::SEE; - public const STATS = 'CHILL_PERSON_HOUSEHOLD_STATS'; + final public const STATS = 'CHILL_PERSON_HOUSEHOLD_STATS'; private const ALL = [ self::SEE, @@ -43,9 +43,9 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi self::STATS, ]; - private VoterHelperInterface $helper; + private readonly VoterHelperInterface $helper; - public function __construct(private Security $security, VoterHelperFactoryInterface $voterHelperFactory) + public function __construct(private readonly Security $security, VoterHelperFactoryInterface $voterHelperFactory) { $this->helper = $voterHelperFactory ->generate(self::class) diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/PersonVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/PersonVoter.php index 95f10458b..2de8a1554 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/PersonVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/PersonVoter.php @@ -21,17 +21,17 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; class PersonVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_PERSON_CREATE'; + final public const CREATE = 'CHILL_PERSON_CREATE'; - public const DUPLICATE = 'CHILL_PERSON_DUPLICATE'; + final public const DUPLICATE = 'CHILL_PERSON_DUPLICATE'; - public const LISTS = 'CHILL_PERSON_LISTS'; + final public const LISTS = 'CHILL_PERSON_LISTS'; - public const SEE = 'CHILL_PERSON_SEE'; + final public const SEE = 'CHILL_PERSON_SEE'; - public const STATS = 'CHILL_PERSON_STATS'; + final public const STATS = 'CHILL_PERSON_STATS'; - public const UPDATE = 'CHILL_PERSON_UPDATE'; + final public const UPDATE = 'CHILL_PERSON_UPDATE'; protected VoterHelperInterface $voter; diff --git a/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php b/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php index 8b649f8f0..ae5f5281b 100644 --- a/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php +++ b/src/Bundle/ChillPersonBundle/Security/AuthorizedCenterOnPersonCreation.php @@ -17,9 +17,9 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; class AuthorizedCenterOnPersonCreation implements AuthorizedCenterOnPersonCreationInterface { - private bool $showCenters; + private readonly bool $showCenters; - public function __construct(private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, ParameterBagInterface $parameterBag) + public function __construct(private readonly AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, ParameterBagInterface $parameterBag) { $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index 0bb3d68b6..c4257e04d 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -74,7 +74,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'pinnedComment' => AccompanyingPeriod\Comment::class, ]; - public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private SocialIssueRender $socialIssueRender, private ClosingMotiveRender $closingMotiveRender, private ScopeResolverDispatcher $scopeResolverDispatcher) + public function __construct(private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SocialIssueRender $socialIssueRender, private readonly ClosingMotiveRender $closingMotiveRender, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index c2a723274..29912618f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -32,7 +32,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface use ObjectToPopulateTrait; - public function __construct(private ResourceRepository $repository) + public function __construct(private readonly ResourceRepository $repository) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php index e0697a6fd..1dfed604f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php @@ -36,11 +36,11 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte use ObjectToPopulateTrait; - public const GROUP_CREATE = 'accompanying_period_work:create'; + final public const GROUP_CREATE = 'accompanying_period_work:create'; - public const GROUP_EDIT = 'accompanying_period_work:edit'; + final public const GROUP_EDIT = 'accompanying_period_work:edit'; - public function __construct(private AccompanyingPeriodWorkRepository $workRepository, private EntityManagerInterface $em) + public function __construct(private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php index 7850cc1c8..768e8e45f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php @@ -26,7 +26,7 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware private const SKIP = 'accompanying_period_work_evaluation_document_skip'; - public function __construct(private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor, private Registry $registry) + public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 512dc6370..1c1076620 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -27,7 +27,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz private const IGNORE_EVALUATION = 'evaluation:ignore'; - public function __construct(private Registry $registry, private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor) + public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php index 12652ce2a..8dc4fc726 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php @@ -30,7 +30,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac private const IGNORE_WORK = 'ignore:work'; - public function __construct(private Registry $registry, private EntityWorkflowRepository $entityWorkflowRepository, private MetadataExtractor $metadataExtractor) + public function __construct(private readonly Registry $registry, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly MetadataExtractor $metadataExtractor) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index 6185c018d..ad5ef161a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -31,7 +31,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize { use DenormalizerAwareTrait; - public function __construct(private MembersEditorFactory $factory) + public function __construct(private readonly MembersEditorFactory $factory) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 390d938d9..121c7fedf 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -47,7 +47,7 @@ class PersonDocGenNormalizer implements private const CIRCULAR_KEY = 'person:circular'; - public function __construct(private PersonRenderInterface $personRender, private RelationshipRepository $relationshipRepository, private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private SummaryBudgetInterface $summaryBudget) + public function __construct(private readonly PersonRenderInterface $personRender, private readonly RelationshipRepository $relationshipRepository, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SummaryBudgetInterface $summaryBudget) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 57f666f05..1420a5bf9 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -48,12 +48,12 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar use ObjectToPopulateTrait; public function __construct( - private ChillEntityRenderExtension $render, + private readonly ChillEntityRenderExtension $render, /* TODO: replace by PersonRenderInterface, as sthis is the only one required */ - private PersonRepository $repository, - private CenterResolverManagerInterface $centerResolverManager, - private ResidentialAddressRepository $residentialAddressRepository, - private PhoneNumberHelperInterface $phoneNumberHelper + private readonly PersonRepository $repository, + private readonly CenterResolverManagerInterface $centerResolverManager, + private readonly ResidentialAddressRepository $residentialAddressRepository, + private readonly PhoneNumberHelperInterface $phoneNumberHelper ) { } @@ -214,14 +214,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar return $data; } - return array_merge($data, [ - 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), - 'altNames' => $this->normalizeAltNames($person->getAltNames()), - 'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, - 'current_residential_addresses' => $currentResidentialAddresses ? - $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : - null, - ]); + return [...$data, 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null, 'current_residential_addresses' => $currentResidentialAddresses ? + $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : + null]; } public function supportsDenormalization($data, $type, $format = null) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php index 42bccba06..23ee8aeb0 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php @@ -22,7 +22,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N { use NormalizerAwareTrait; - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php index 494c82735..12c36b286 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php @@ -21,7 +21,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - public function __construct(private SocialActionRender $render) + public function __construct(private readonly SocialActionRender $render) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php index 7c8c8b226..1882ef7d6 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php @@ -21,7 +21,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz { use NormalizerAwareTrait; - public function __construct(private SocialIssueRender $render) + public function __construct(private readonly SocialIssueRender $render) { } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php index b5cbeda07..bce0e3423 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php @@ -27,7 +27,7 @@ class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerA private const IGNORE_ENTITY_WORKFLOW = 'ignore:entity_workflow'; - public function __construct(private Registry $registry, private MetadataExtractor $metadataExtractor) + public function __construct(private readonly Registry $registry, private readonly MetadataExtractor $metadataExtractor) { } diff --git a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php index 745568ed7..cfc765548 100644 --- a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php +++ b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php @@ -22,7 +22,7 @@ use Psr\Log\LoggerInterface; class OldDraftAccompanyingPeriodRemover implements OldDraftAccompanyingPeriodRemoverInterface { - public function __construct(private EntityManagerInterface $em, private LoggerInterface $logger) + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger) { } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index f4c161a98..eff9c2636 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -46,7 +46,7 @@ class AccompanyingPeriodContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private DocumentCategoryRepository $documentCategoryRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper, private EntityManagerInterface $em, private PersonRenderInterface $personRender, private PersonRepository $personRepository, private TranslatorInterface $translator, private BaseContextData $baseContextData) + public function __construct(private readonly DocumentCategoryRepository $documentCategoryRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly EntityManagerInterface $em, private readonly PersonRenderInterface $personRender, private readonly PersonRepository $personRepository, private readonly TranslatorInterface $translator, private readonly BaseContextData $baseContextData) { } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php index 0bc61d19f..e8a81012e 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkContext.php @@ -29,7 +29,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ class AccompanyingPeriodWorkContext implements DocGeneratorContextWithPublicFormInterface { - public function __construct(private AccompanyingPeriodContext $periodContext, private NormalizerInterface $normalizer) + public function __construct(private readonly AccompanyingPeriodContext $periodContext, private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index 209251cd0..5a06acdbf 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -33,7 +33,7 @@ class AccompanyingPeriodWorkEvaluationContext implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, private EntityManagerInterface $em, private EvaluationRepository $evaluationRepository, private NormalizerInterface $normalizer, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext, private readonly EntityManagerInterface $em, private readonly EvaluationRepository $evaluationRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php index ecbbe28db..b894f7e55 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php @@ -45,20 +45,20 @@ use function count; final class PersonContext implements PersonContextInterface { - private bool $showScopes; + private readonly bool $showScopes; public function __construct( - private AuthorizationHelperInterface $authorizationHelper, - private BaseContextData $baseContextData, - private CenterResolverManagerInterface $centerResolverManager, - private DocumentCategoryRepository $documentCategoryRepository, - private EntityManagerInterface $em, - private NormalizerInterface $normalizer, + private readonly AuthorizationHelperInterface $authorizationHelper, + private readonly BaseContextData $baseContextData, + private readonly CenterResolverManagerInterface $centerResolverManager, + private readonly DocumentCategoryRepository $documentCategoryRepository, + private readonly EntityManagerInterface $em, + private readonly NormalizerInterface $normalizer, ParameterBagInterface $parameterBag, - private ScopeRepositoryInterface $scopeRepository, - private Security $security, - private TranslatorInterface $translator, - private TranslatableStringHelperInterface $translatableStringHelper + private readonly ScopeRepositoryInterface $scopeRepository, + private readonly Security $security, + private readonly TranslatorInterface $translator, + private readonly TranslatableStringHelperInterface $translatableStringHelper ) { $this->showScopes = $parameterBag->get('chill_main')['acl']['form_show_scopes']; } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php index c8e15be12..662984011 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContextWithThirdParty.php @@ -27,7 +27,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ class PersonContextWithThirdParty implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface { - public function __construct(private PersonContextInterface $personContext, private NormalizerInterface $normalizer, private ThirdPartyRepository $thirdPartyRepository) + public function __construct(private readonly PersonContextInterface $personContext, private readonly NormalizerInterface $normalizer, private readonly ThirdPartyRepository $thirdPartyRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index 017c90b73..80197f769 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -28,7 +28,7 @@ use Exception; use function count; -final class SocialWorkMetadata implements SocialWorkMetadataInterface +final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface { public function __construct(private SocialIssueRepository $socialIssueRepository, private SocialActionRepository $socialActionRepository, private GoalRepository $goalRepository, private ResultRepository $resultRepository, private EvaluationRepository $evaluationRepository, private EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php index 8ebc89c04..67171aaba 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php @@ -27,7 +27,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface use BoxUtilsChillEntityRenderTrait; private const SEPARATOR = ' > '; - public function __construct(private TranslatableStringHelper $translatableStringHelper) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 8d50f03ac..c41a94779 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -28,7 +28,7 @@ class PersonRender implements PersonRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private ConfigPersonAltNamesHelper $configAltNamesHelper, private EngineInterface $engine, private TranslatorInterface $translator) + public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php index 925c174cc..802ff6d8e 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ResourceKindRender.php @@ -18,7 +18,7 @@ use Chill\PersonBundle\Entity\Person\PersonResourceKind; /** * @implements ChillEntityRenderInterface */ -final class ResourceKindRender implements ChillEntityRenderInterface +final readonly class ResourceKindRender implements ChillEntityRenderInterface { public function __construct(private TranslatableStringHelper $translatableStringHelper) { diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php index 2d8b1ea92..e4253f52e 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php @@ -25,9 +25,9 @@ use function implode; */ class SocialActionRender implements ChillEntityRenderInterface { - public const AND_CHILDREN_MENTION = 'show_and_children_mention'; + final public const AND_CHILDREN_MENTION = 'show_and_children_mention'; - public const DEFAULT_ARGS = [ + final public const DEFAULT_ARGS = [ self::SEPARATOR_KEY => ' > ', self::NO_BADGE => false, self::SHOW_AND_CHILDREN => false, @@ -37,17 +37,17 @@ class SocialActionRender implements ChillEntityRenderInterface /** * if true, the action will not be encapsulated into a "badge". */ - public const NO_BADGE = 'no-badge'; + final public const NO_BADGE = 'no-badge'; - public const SEPARATOR_KEY = 'default.separator'; + final public const SEPARATOR_KEY = 'default.separator'; /** * Show a mention "and children" on each SocialAction, if the social action * has at least one child. */ - public const SHOW_AND_CHILDREN = 'show_and_children'; + final public const SHOW_AND_CHILDREN = 'show_and_children'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index 381f80ef9..f815afc43 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -22,7 +22,7 @@ use function implode; /** * @implements ChillEntityRenderInterface */ -final class SocialIssueRender implements ChillEntityRenderInterface +final readonly class SocialIssueRender implements ChillEntityRenderInterface { public const AND_CHILDREN_MENTION = 'show_and_children_mention'; diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php index dc5c5c2ce..93f773113 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php @@ -86,7 +86,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase } } - public function testConfidentialValid() + public function testConfidentialValid(): never { $this->markTestIncomplete( 'Marked as incomplete because of a problem in the dataprovider, at line 81.' diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php index 560928bff..60d29d8b0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php @@ -316,7 +316,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -338,7 +338,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase } $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), null, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR); // check that the person id is contained $participationsPersonsIds = array_map( @@ -358,7 +358,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -394,7 +394,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase $this->markTestSkipped('the next tests should appears only on valid accompanying period'); } - $data = json_decode($this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertArrayHasKey('id', $data); $this->assertArrayHasKey('type', $data); $this->assertEquals('social_issue', $data['type']); @@ -425,7 +425,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase $this->markTestSkipped('the next tests should appears only on valid accompanying period'); } - $data = json_decode($response->getContent(), null, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR); $this->assertEquals( $data->id, $periodId, @@ -487,7 +487,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'accompanying_period_comment', 'content' => 'this is a text']) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -506,7 +506,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'accompanying_period_comment', 'id' => $data['id']], JSON_THROW_ON_ERROR) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); } @@ -563,7 +563,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -590,7 +590,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'thirdparty', 'id' => $thirdPartyId], JSON_THROW_ON_ERROR) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -644,7 +644,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'person', 'id' => $personId]]) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); @@ -688,7 +688,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'thirdparty', 'id' => $thirdPartyId]]) ); $response = $this->client->getResponse(); - $data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR); + $data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertTrue(in_array($response->getStatusCode(), [200, 422], true)); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php index a7d98bd97..a4b11fdb6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseControllerTest.php @@ -70,7 +70,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase $this->assertResponseRedirects(); $location = $this->client->getResponse()->headers->get('Location'); - $this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', $location)); + $this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location)); } /** @@ -89,7 +89,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase $location = $this->client->getResponse()->headers->get('Location'); $matches = []; - $this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', $location, $matches)); + $this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches)); $id = $matches[1]; $period = self::$container->get(EntityManagerInterface::class) diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php index 0fbdad9d8..79e803a13 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php @@ -270,7 +270,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase * Then the response should not redirect to any page * and an error element is shown */ - public function testCreatePeriodWithClosingAfterCurrentFails() + public function testCreatePeriodWithClosingAfterCurrentFails(): never { $this->markTestSkipped('Multiple period may now cover. This test is kept ' . 'in case of a configuration may add this feature again'); @@ -438,7 +438,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase * Then the response should not redirect to any page * and an error element is shown */ - public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails() + public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails(): never { $this->markTestSkipped('Multiple period may now cover. This test is kept ' . 'in case of a configuration may add this feature again'); @@ -470,7 +470,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase /** * @group reopening */ - public function testReOpeningPeriod() + public function testReOpeningPeriod(): never { // test that re-opening a period which is opened does not work $this->client->request( diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php index f4722d685..d6bbb461f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php @@ -69,7 +69,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase * * @group configurable_fields */ - public function testViewPerson() + public function testViewPerson(): never { $this->markTestSkipped('This configuration does not allow multiple environnements'); $client = self::createClient( diff --git a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php index 83071bcbd..f5e4639c2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Form/Type/PickPersonTypeTest.php @@ -51,7 +51,7 @@ final class PickPersonTypeTest extends KernelTestCase /** * test with an invalid center type in the option 'centers' (in an array). */ - public function testWithInvalidOptionCenters() + public function testWithInvalidOptionCenters(): never { $this->expectException(RuntimeException::class); @@ -128,7 +128,7 @@ final class PickPersonTypeTest extends KernelTestCase ); } - public function testWithOptionRoleInvalid() + public function testWithOptionRoleInvalid(): never { $this->markTestSkipped('need to inject locale into url generator without request'); $form = $this->formFactory diff --git a/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php b/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php index 64143e7db..05ca5918d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Search/PersonSearchTest.php @@ -21,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ final class PersonSearchTest extends WebTestCase { - public function testDefaultAccented() + public function testDefaultAccented(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawlerSpecial = $this->generateCrawlerForSearch('@person manço'); @@ -135,7 +135,7 @@ final class PersonSearchTest extends WebTestCase $this->assertMatchesRegularExpression('/DEPARDIEU/', $crawler->filter('.list-with-period')->text()); } - public function testSearchCombineBirthdateAndLastName() + public function testSearchCombineBirthdateAndLastName(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27 lastname:(Van Snick)'); @@ -144,7 +144,7 @@ final class PersonSearchTest extends WebTestCase $this->assertDoesNotMatchRegularExpression('/DEPARDIEU/', $crawler->filter('.list-with-period')->text()); } - public function testSearchCombineGenderAndLastName() + public function testSearchCombineGenderAndLastName(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawler = $this->generateCrawlerForSearch('@person gender:woman lastname:(Depardieu)'); @@ -153,7 +153,7 @@ final class PersonSearchTest extends WebTestCase $this->assertDoesNotMatchRegularExpression('/Gérard/', $crawler->filter('.list-with-period')->text()); } - public function testSearchCombineLastnameAndFirstName() + public function testSearchCombineLastnameAndFirstName(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawler = $this->generateCrawlerForSearch('@person lastname:Depardieu firstname:Jean'); @@ -167,7 +167,7 @@ final class PersonSearchTest extends WebTestCase ); } - public function testSearchCombineLastnameAndNationality() + public function testSearchCombineLastnameAndNationality(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawler = $this->generateCrawlerForSearch('@person lastname:Depardieu nationality:RU'); @@ -181,7 +181,7 @@ final class PersonSearchTest extends WebTestCase ); } - public function testSearchMultipleTrigramUseAndClauseInDefault() + public function testSearchMultipleTrigramUseAndClauseInDefault(): never { $this->markTestSkipped('skipped until adapted to new fixtures'); $crawler = $this->generateCrawlerForSearch('@person cha dep'); diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizerTest.php index 8b2cf2ffb..b56cb1fd9 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizerTest.php @@ -96,7 +96,7 @@ final class AccompanyingPeriodWorkEvaluationDenormalizerTest extends TestCase "id": 382 }'; - public function testAssociatedDocumentIsTheSame() + public function testAssociatedDocumentIsTheSame(): never { $this->markTestIncomplete('not yet finished'); $evaluation = new AccompanyingPeriodWorkEvaluation(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php index acd4119a1..5f29588c2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php @@ -30,7 +30,7 @@ final class HouseholdNormalizerTest extends KernelTestCase private ?NormalizerInterface $normalizer; - private array $toDelete; + private readonly array $toDelete; protected function setUp(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php index 90ceddb04..bf4031970 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonDocGenNormalizerTest.php @@ -95,11 +95,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase ->setFirstName('Renaud') ->setLastName('Mégane'); - $expected = array_merge( - self::BLANK, - ['firstName' => 'Renaud', 'lastName' => 'Mégane', - 'text' => 'Renaud Mégane', ] - ); + $expected = [...self::BLANK, 'firstName' => 'Renaud', 'lastName' => 'Mégane', 'text' => 'Renaud Mégane']; yield [$person, $expected, 'partial normalization for a person']; diff --git a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php index be368e28c..7560b8fb1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Timeline/TimelineAccompanyingPeriodTest.php @@ -59,7 +59,7 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase /** * @dataProvider provideDataPersonWithAccompanyingPeriod */ - public function testEntriesAreShown(mixed $personId) + public function testEntriesAreShown(mixed $personId): never { $this->markTestSkipped('page does not work'); diff --git a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php index 2e11a4f4f..03ebbb7a2 100644 --- a/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php @@ -35,7 +35,7 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt { private const SUPPORTED_CONTEXTS = ['person', 'center']; - public function __construct(protected EntityManager $em, private Security $security, private AuthorizationHelper $authorizationHelper) + public function __construct(protected EntityManager $em, private readonly Security $security, private readonly AuthorizationHelper $authorizationHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php index f7d533d0e..5e20a10f3 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php @@ -25,7 +25,7 @@ use function in_array; class AccompanyingPeriodValidityValidator extends ConstraintValidator { - public function __construct(private ActivityRepository $activityRepository, private SocialIssueRender $socialIssueRender, private TokenStorageInterface $token) + public function __construct(private readonly ActivityRepository $activityRepository, private readonly SocialIssueRender $socialIssueRender, private readonly TokenStorageInterface $token) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php index 50ef5059c..c01c02cc6 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php @@ -20,7 +20,7 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class LocationValidityValidator extends ConstraintValidator { - public function __construct(private PersonRenderInterface $render) + public function __construct(private readonly PersonRenderInterface $render) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index 2589a1751..5e3d5ba7c 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -26,7 +26,7 @@ class ParticipationOverlapValidator extends ConstraintValidator { private const MAX_PARTICIPATION = 1; - public function __construct(private PersonRenderInterface $personRender, private ThirdPartyRender $thirdpartyRender) + public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index a9d339286..7333abf2c 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -24,7 +24,7 @@ use function in_array; class ResourceDuplicateCheckValidator extends ConstraintValidator { - public function __construct(private PersonRenderInterface $personRender, private ThirdPartyRender $thirdpartyRender) + public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index edabface7..ebf87b12c 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -26,7 +26,7 @@ use function count; */ class HouseholdMembershipSequentialValidator extends ConstraintValidator { - public function __construct(private PersonRenderInterface $render) + public function __construct(private readonly PersonRenderInterface $render) { } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/Birthdate.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/Birthdate.php index 15fb22728..c1c805adf 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/Birthdate.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/Birthdate.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Constraint; */ class Birthdate extends Constraint { - public const BIRTHDATE_INVALID_CODE = '3f42fd96-0b2d-11ec-8cf3-0f3b1b1ca1c4'; + final public const BIRTHDATE_INVALID_CODE = '3f42fd96-0b2d-11ec-8cf3-0f3b1b1ca1c4'; public $message = 'The birthdate must be before %date%'; } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php index 48fab3787..0d7ba3b17 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/PersonHasCenterValidator.php @@ -20,9 +20,9 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class PersonHasCenterValidator extends ConstraintValidator { - private bool $centerRequired; + private readonly bool $centerRequired; - public function __construct(ParameterBagInterface $parameterBag, private CenterResolverManagerInterface $centerResolverManager) + public function __construct(ParameterBagInterface $parameterBag, private readonly CenterResolverManagerInterface $centerResolverManager) { $this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required']; } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php index bec92b9c0..0a64aa891 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Relationship/RelationshipNoDuplicateValidator.php @@ -20,7 +20,7 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class RelationshipNoDuplicateValidator extends ConstraintValidator { - public function __construct(private RelationshipRepository $relationshipRepository) + public function __construct(private readonly RelationshipRepository $relationshipRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php index c224cb166..1b85c3cb5 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php @@ -21,7 +21,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly AccompanyingPeriodWorkEvaluationDocumentRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php index b5869c35f..70b23f9f7 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php @@ -22,7 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private AccompanyingPeriodWorkEvaluationRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index 203fd60d2..0f9b05ac9 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -23,7 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInterface { - public function __construct(private AccompanyingPeriodWorkRepository $repository, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly AccompanyingPeriodWorkRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index dbaa1abea..c893d084a 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -325,7 +325,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface switch ($f) { case 'person_countryOfBirth': case 'person_nationality': - $suffix = substr($f, 7); + $suffix = substr((string) $f, 7); $qb->addSelect(sprintf('IDENTITY(person.%s) as %s', $suffix, $f)); break; @@ -338,7 +338,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface case 'person_address_country_name': case 'person_address_country_code': // remove 'person_' - $suffix = substr($f, 7); + $suffix = substr((string) $f, 7); $qb->addSelect(sprintf( 'GET_PERSON_ADDRESS_%s(person.id, :address_date) AS %s', @@ -361,8 +361,8 @@ class ReportList implements ExportElementValidatedInterface, ListInterface break; default: - $prefix = substr($f, 0, 7); - $suffix = substr($f, 7); + $prefix = substr((string) $f, 0, 7); + $suffix = substr((string) $f, 7); match ($prefix) { 'person_' => $qb->addSelect(sprintf('person.%s as %s', $suffix, $f)), diff --git a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php index 6117d2f48..d11c5cc70 100644 --- a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php +++ b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php @@ -19,7 +19,7 @@ use Doctrine\ORM\Query\Expr; class ReportDateFilter implements FilterInterface { - public function __construct(private RollingDateConverterInterface $rollingDateConverter) + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) { } diff --git a/src/Bundle/ChillReportBundle/Search/ReportSearch.php b/src/Bundle/ChillReportBundle/Search/ReportSearch.php index 8fbc24e16..3c5e7f4ad 100644 --- a/src/Bundle/ChillReportBundle/Search/ReportSearch.php +++ b/src/Bundle/ChillReportBundle/Search/ReportSearch.php @@ -37,8 +37,8 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface private $user; public function __construct( - private EntityManagerInterface $em, - private AuthorizationHelper $helper, + private readonly EntityManagerInterface $em, + private readonly AuthorizationHelper $helper, TokenStorageInterface $tokenStorage ) { if (!$tokenStorage->getToken()->getUser() instanceof \Chill\MainBundle\Entity\User) { diff --git a/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php b/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php index ae4d1be55..2caf57305 100644 --- a/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php +++ b/src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php @@ -23,13 +23,13 @@ use function in_array; class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_REPORT_CREATE'; + final public const CREATE = 'CHILL_REPORT_CREATE'; - public const LISTS = 'CHILL_REPORT_LISTS'; + final public const LISTS = 'CHILL_REPORT_LISTS'; - public const SEE = 'CHILL_REPORT_SEE'; + final public const SEE = 'CHILL_REPORT_SEE'; - public const UPDATE = 'CHILL_REPORT_UPDATE'; + final public const UPDATE = 'CHILL_REPORT_UPDATE'; /** * @var AuthorizationHelper diff --git a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php index 69ccd3d54..10f4f14c0 100644 --- a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php +++ b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php @@ -160,7 +160,7 @@ final class ReportControllerTest extends WebTestCase * * @depends testNewReportPage */ - public function testInvalidDate(Form $form) + public function testInvalidDate(Form $form): never { $client = $this->getAuthenticatedClient(); $this->markTestSkipped('This test raise an error since symfony 2.7. ' @@ -379,7 +379,7 @@ final class ReportControllerTest extends WebTestCase $matches = []; preg_match( '|/report/([0-9]*)/view$|', - $client->getHistory()->current()->getUri(), + (string) $client->getHistory()->current()->getUri(), $matches ); diff --git a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php index d2e856131..a5f62debc 100644 --- a/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php +++ b/src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php @@ -35,7 +35,7 @@ use function strtr; */ class TimelineReportProvider implements TimelineProviderInterface { - public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) + public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) { } diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index a1085657a..d8afbc65d 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -47,7 +47,7 @@ use function array_merge; final class SingleTaskController extends AbstractController { - public function __construct(private CenterResolverDispatcherInterface $centerResolverDispatcher, private PaginatorFactory $paginatorFactory, private SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository, private TranslatorInterface $translator, private EventDispatcherInterface $eventDispatcher, private TimelineBuilder $timelineBuilder, private LoggerInterface $logger, private FilterOrderHelperFactoryInterface $filterOrderHelperFactory) + public function __construct(private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly PaginatorFactory $paginatorFactory, private readonly SingleTaskAclAwareRepositoryInterface $singleTaskAclAwareRepository, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly TimelineBuilder $timelineBuilder, private readonly LoggerInterface $logger, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory) { } diff --git a/src/Bundle/ChillTaskBundle/Event/TaskEvent.php b/src/Bundle/ChillTaskBundle/Event/TaskEvent.php index 57e8329c9..01cae799c 100644 --- a/src/Bundle/ChillTaskBundle/Event/TaskEvent.php +++ b/src/Bundle/ChillTaskBundle/Event/TaskEvent.php @@ -16,7 +16,7 @@ use Symfony\Component\EventDispatcher\Event; class TaskEvent extends Event { - public const PERSIST = 'chill_task.task_persist'; + final public const PERSIST = 'chill_task.task_persist'; /** * @var AbstractTask diff --git a/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php b/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php index ac88a1d3a..e0414948b 100644 --- a/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php +++ b/src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php @@ -19,11 +19,11 @@ use Symfony\Component\Workflow\Transition; class UIEvent extends Event { - public const EDIT_FORM = 'chill_task.edit_form'; + final public const EDIT_FORM = 'chill_task.edit_form'; - public const EDIT_PAGE = 'chill_task.edit_page'; + final public const EDIT_PAGE = 'chill_task.edit_page'; - public const SHOW_TRANSITION_PAGE = 'chill_task.show_transition_page'; + final public const SHOW_TRANSITION_PAGE = 'chill_task.show_transition_page'; /** * @var FormInterface|null diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php index 4378696d0..65417f21e 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php @@ -28,7 +28,7 @@ use Symfony\Component\Security\Core\Role\Role; class SingleTaskType extends AbstractType { - public function __construct(private ParameterBagInterface $parameterBag, private CenterResolverDispatcherInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher) + public function __construct(private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) { } diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index 8c95aa9ee..5ae44c499 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -27,7 +27,7 @@ use Symfony\Component\Security\Core\Security; use function count; use function substr; -final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface +final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface { public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper) { @@ -103,8 +103,8 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository break; - case str_starts_with($flag, 'state_'): - $state = substr($flag, 6); + case str_starts_with((string) $flag, 'state_'): + $state = substr((string) $flag, 6); $orXState ->add( "JSONB_EXISTS_IN_ARRAY(t.currentStates, :state_{$key}) = 'TRUE'" diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php index e3eb634cd..0a95e3b25 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php @@ -31,15 +31,15 @@ use function count; */ class SingleTaskRepository extends EntityRepository { - public const DATE_STATUS_CURRENT = 'current'; + final public const DATE_STATUS_CURRENT = 'current'; - public const DATE_STATUS_ENDED = 'ended'; + final public const DATE_STATUS_ENDED = 'ended'; - public const DATE_STATUS_NOT_STARTED = 'not_started'; + final public const DATE_STATUS_NOT_STARTED = 'not_started'; - public const DATE_STATUS_WARNING = 'warning'; + final public const DATE_STATUS_WARNING = 'warning'; - public const DATE_STATUSES = [ + final public const DATE_STATUSES = [ self::DATE_STATUS_ENDED, self::DATE_STATUS_WARNING, self::DATE_STATUS_CURRENT, diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php index d7ccc0db9..60c7f3d5a 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php @@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; class AuthorizationEvent extends Event { - public const VOTE = 'chill_task.vote'; + final public const VOTE = 'chill_task.vote'; /** * @var bool @@ -27,9 +27,9 @@ class AuthorizationEvent extends Event protected $vote; public function __construct( - private Person|AbstractTask|AccompanyingPeriod|null $subject, - private string $attribute, - private TokenInterface $token + private readonly Person|AbstractTask|AccompanyingPeriod|null $subject, + private readonly string $attribute, + private readonly TokenInterface $token ) { } diff --git a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php index 6031f64d1..9575bfcfa 100644 --- a/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php +++ b/src/Bundle/ChillTaskBundle/Security/Authorization/TaskVoter.php @@ -48,12 +48,12 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy public const UPDATE = 'CHILL_TASK_TASK_UPDATE'; - private VoterHelperInterface $voter; + private readonly VoterHelperInterface $voter; public function __construct( - private AccessDecisionManagerInterface $accessDecisionManager, - private EventDispatcherInterface $eventDispatcher, - private LoggerInterface $logger, + private readonly AccessDecisionManagerInterface $accessDecisionManager, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly LoggerInterface $logger, VoterHelperFactoryInterface $voterFactory ) { $this->voter = $voterFactory diff --git a/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php b/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php index 8b1646435..affaab8c7 100644 --- a/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php +++ b/src/Bundle/ChillTaskBundle/Templating/TaskTwigExtension.php @@ -31,7 +31,7 @@ class TaskTwigExtension extends AbstractExtension public function getFunctions() { return [ - new TwigFunction('task_workflow_metadata', [$this, 'getWorkflowMetadata']), + new TwigFunction('task_workflow_metadata', $this->getWorkflowMetadata(...)), ]; } diff --git a/src/Bundle/ChillTaskBundle/Templating/UI/CountNotificationTask.php b/src/Bundle/ChillTaskBundle/Templating/UI/CountNotificationTask.php index 08a4177e1..783f41529 100644 --- a/src/Bundle/ChillTaskBundle/Templating/UI/CountNotificationTask.php +++ b/src/Bundle/ChillTaskBundle/Templating/UI/CountNotificationTask.php @@ -22,7 +22,7 @@ use function array_merge; class CountNotificationTask implements NotificationCounterInterface { - public const CACHE_KEY = 'chill_task.count_notifications.user.%d.%s'; + final public const CACHE_KEY = 'chill_task.count_notifications.user.%d.%s'; /** * @var CacheItempPoolInterface @@ -104,7 +104,7 @@ class CountNotificationTask implements NotificationCounterInterface ]; $sum = $this->singleTaskRepository->countByParameters( - array_merge($params, ['date_status' => $status]) + [...$params, 'date_status' => $status] ); $sumCache->set($sum); diff --git a/src/Bundle/ChillTaskBundle/Tests/Repository/SingleTaskACLAwareRepositoryTest.php b/src/Bundle/ChillTaskBundle/Tests/Repository/SingleTaskACLAwareRepositoryTest.php index 0bab53764..4d5520ca5 100644 --- a/src/Bundle/ChillTaskBundle/Tests/Repository/SingleTaskACLAwareRepositoryTest.php +++ b/src/Bundle/ChillTaskBundle/Tests/Repository/SingleTaskACLAwareRepositoryTest.php @@ -40,7 +40,7 @@ final class SingleTaskACLAwareRepositoryTest extends KernelTestCase use ProphecyTrait; - private AuthorizationHelperInterface $authorizationHelper; + private readonly AuthorizationHelperInterface $authorizationHelper; private CenterRepositoryInterface $centerRepository; diff --git a/src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php index 9a8fcf6bd..8b2e5c707 100644 --- a/src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php +++ b/src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php @@ -28,7 +28,7 @@ use function array_map; */ class SingleTaskTaskLifeCycleEventTimelineProvider implements TimelineProviderInterface { - public const TYPE = 'chill_task.transition'; + final public const TYPE = 'chill_task.transition'; /** * @var EntityManagerInterface diff --git a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php index 4efe57c7c..1fa818f41 100644 --- a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php +++ b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php @@ -38,7 +38,7 @@ use function strtr; */ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface { - public const TYPE = 'chill_task.transition'; + final public const TYPE = 'chill_task.transition'; public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security) { diff --git a/src/Bundle/ChillTaskBundle/Workflow/Definition/DefaultTaskDefinition.php b/src/Bundle/ChillTaskBundle/Workflow/Definition/DefaultTaskDefinition.php index a68e8c9b9..02d3facda 100644 --- a/src/Bundle/ChillTaskBundle/Workflow/Definition/DefaultTaskDefinition.php +++ b/src/Bundle/ChillTaskBundle/Workflow/Definition/DefaultTaskDefinition.php @@ -23,11 +23,11 @@ use function implode; class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDefinition { - public const DEFINITION_METADATA = [ + final public const DEFINITION_METADATA = [ 'name' => 'Default task', ]; - public const TRANSITION_METADATA = [ + final public const TRANSITION_METADATA = [ 'close' => [ 'verb' => 'close', 'class' => 'btn btn-task-label btn-task-close', diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index da806a750..821f6c7ef 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -32,7 +32,7 @@ use function array_merge; final class ThirdPartyController extends CRUDController { - private bool $askCenter; + private readonly bool $askCenter; public function __construct( protected AuthorizationHelper $authorizationHelper, diff --git a/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php b/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php index e813cbd7f..119446f13 100644 --- a/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/DataFixtures/ORM/LoadThirdParty.php @@ -30,7 +30,7 @@ use function count; class LoadThirdParty extends Fixture implements DependentFixtureInterface { - private PhoneNumberUtil $phoneNumberUtil; + private readonly PhoneNumberUtil $phoneNumberUtil; public function __construct() { diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php index f5fa9d05a..11095df7f 100644 --- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php +++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php @@ -25,7 +25,7 @@ use function in_array; */ class ThirdPartyTypeCompilerPass implements CompilerPassInterface { - public const TAG = 'chill_3party.provider'; + final public const TAG = 'chill_3party.provider'; public function process(ContainerBuilder $container) { diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index b8ea8126c..2d4818ea6 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -90,11 +90,11 @@ use function spl_object_hash; */ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Stringable { - public const KIND_CHILD = 'child'; + final public const KIND_CHILD = 'child'; - public const KIND_COMPANY = 'company'; + final public const KIND_COMPANY = 'company'; - public const KIND_CONTACT = 'contact'; + final public const KIND_CONTACT = 'contact'; /** * [fr] Sigle. diff --git a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php index 61fb03226..be275b22a 100644 --- a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php +++ b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php @@ -18,7 +18,7 @@ use const SORT_NUMERIC; class LabelThirdPartyHelper { - public function __construct(private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository) + public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository) { } diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index 91e915e09..e8a26d3fd 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -38,7 +38,7 @@ use function array_key_exists; class ThirdPartyType extends AbstractType { - private bool $askCenter; + private readonly bool $askCenter; public function __construct( protected AuthorizationHelper $authorizationHelper, diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php index a02785545..4e0477bcc 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdPartyTypeCategoryType.php @@ -30,7 +30,7 @@ class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractTyp { private const PREFIX_TYPE = 'chill_3party.key_label.'; - public function __construct(private ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private ThirdPartyTypeManager $thirdPartyTypeManager, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + public function __construct(private readonly ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private readonly ThirdPartyTypeManager $thirdPartyTypeManager, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php index 8ae1702ce..9022fb6dc 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/Type/PickThirdpartyDynamicType.php @@ -26,7 +26,7 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickThirdpartyDynamicType extends AbstractType { - public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer) + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) { } diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php index 283622e56..30f9be556 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyACLAwareRepository.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Security\Core\Security; -final class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface +final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface { public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository) { diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php index 76e15ef17..c9d1d856f 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php @@ -23,7 +23,7 @@ use function array_key_exists; final class ThirdPartyRepository implements ObjectRepository { - private EntityRepository $repository; + private readonly EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 8b0a26849..12d5ba95c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -49,7 +49,7 @@ FROM rows, searches */ class ThirdPartyApiSearch implements SearchApiInterface { - public function __construct(private ThirdPartyRepository $thirdPartyRepository) + public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository) { } diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php index 0421d0f34..c60f97413 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php @@ -26,7 +26,7 @@ use Symfony\Component\Security\Core\Role\Role; */ class ThirdPartySearch implements SearchInterface { - public const NAME = '3party'; + final public const NAME = '3party'; /** * @var AuthorizationHelper @@ -53,7 +53,7 @@ class ThirdPartySearch implements SearchInterface TokenStorageInterface $tokenStorage, AuthorizationHelper $authorizationHelper, PaginatorFactory $paginatorFactory, - private ThirdPartyRepository $thirdPartyRepository + private readonly ThirdPartyRepository $thirdPartyRepository ) { $this->em = $em; $this->tokenStorage = $tokenStorage; diff --git a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php index e1dae28b9..9e346ebf5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php +++ b/src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php @@ -28,11 +28,11 @@ use function in_array; */ class ThirdPartyVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface { - public const CREATE = 'CHILL_3PARTY_3PARTY_CREATE'; + final public const CREATE = 'CHILL_3PARTY_3PARTY_CREATE'; - public const SHOW = 'CHILL_3PARTY_3PARTY_SHOW'; + final public const SHOW = 'CHILL_3PARTY_3PARTY_SHOW'; - public const UPDATE = 'CHILL_3PARTY_3PARTY_UPDATE'; + final public const UPDATE = 'CHILL_3PARTY_3PARTY_UPDATE'; /** * @var AuthorizationHelper diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index b3f898a76..b2271e8df 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -24,7 +24,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf { use NormalizerAwareTrait; - public function __construct(private ThirdPartyRender $thirdPartyRender, private TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillThirdPartyBundle/ThirdPartyType/ThirdPartyTypeManager.php b/src/Bundle/ChillThirdPartyBundle/ThirdPartyType/ThirdPartyTypeManager.php index cc8081aaa..714cb6455 100644 --- a/src/Bundle/ChillThirdPartyBundle/ThirdPartyType/ThirdPartyTypeManager.php +++ b/src/Bundle/ChillThirdPartyBundle/ThirdPartyType/ThirdPartyTypeManager.php @@ -21,7 +21,7 @@ class ThirdPartyTypeManager /** * The prefix used to translate the key of provider. */ - public const THIRD_PARTY_TRANSLATOR_KEY = 'chill_3party.key_label.'; + final public const THIRD_PARTY_TRANSLATOR_KEY = 'chill_3party.key_label.'; /** * @var ThirdPartyTypeProviderInterface[] diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php index d7e90e46a..665386ffe 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php @@ -35,17 +35,17 @@ class Convert { private const LOG_PREFIX = '[convert] '; - private string $collaboraDomain; + private readonly string $collaboraDomain; /** * @param StoredObjectManager $storedObjectManager */ public function __construct( - private HttpClientInterface $httpClient, - private RequestStack $requestStack, - private Security $security, - private StoredObjectManagerInterface $storedObjectManager, - private LoggerInterface $logger, + private readonly HttpClientInterface $httpClient, + private readonly RequestStack $requestStack, + private readonly Security $security, + private readonly StoredObjectManagerInterface $storedObjectManager, + private readonly LoggerInterface $logger, ParameterBagInterface $parameters ) { $this->collaboraDomain = $parameters->get('wopi')['server']; diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php index ec10cc973..7280e7fca 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php @@ -36,7 +36,7 @@ use Twig\Environment; * @internal * @coversNothing */ -final class Editor +final readonly class Editor { public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private EngineInterface $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) { diff --git a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php index af22cf952..b85d1b8b3 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Controller/Responder.php @@ -20,7 +20,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Serializer\SerializerInterface; use Twig\Environment; -final class Responder implements ResponderInterface +final readonly class Responder implements ResponderInterface { public function __construct(private Environment $twig, private UrlGeneratorInterface $urlGenerator, private SerializerInterface $serializer) { @@ -51,12 +51,7 @@ final class Responder implements ResponderInterface ->serialize( $data, 'json', - array_merge( - [ - 'json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS, - ], - $context - ) + ['json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS, ...$context] ), $status, $headers, diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php index 08cdec97e..53e9ad819 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/AuthorizationManager.php @@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\Security; class AuthorizationManager implements \ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface { - public function __construct(private JWTTokenManagerInterface $tokenManager, private Security $security) + public function __construct(private readonly JWTTokenManagerInterface $tokenManager, private readonly Security $security) { } diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php index 358831f87..148b1fc8e 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php @@ -26,7 +26,7 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface */ private const LOCK_GRACEFUL_DURATION_TIME = 3; - public function __construct(private ChillRedis $redis) + public function __construct(private readonly ChillRedis $redis) { } diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php index 6084d4785..0963cf903 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentManager.php @@ -34,16 +34,16 @@ use function strlen; final class ChillDocumentManager implements DocumentManagerInterface { - private RequestInterface $request; + private readonly RequestInterface $request; public function __construct( - private DocumentLockManagerInterface $documentLockManager, - private EntityManagerInterface $entityManager, + private readonly DocumentLockManagerInterface $documentLockManager, + private readonly EntityManagerInterface $entityManager, HttpMessageFactoryInterface $httpMessageFactory, - private Psr17Interface $psr17, + private readonly Psr17Interface $psr17, RequestStack $requestStack, - private StoredObjectManagerInterface $storedObjectManager, - private StoredObjectRepository $storedObjectRepository + private readonly StoredObjectManagerInterface $storedObjectManager, + private readonly StoredObjectRepository $storedObjectRepository ) { $this->request = $httpMessageFactory->createRequest($requestStack->getCurrentRequest()); } diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php index 88f863cd1..189b780b2 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillWopi.php @@ -15,7 +15,7 @@ use ChampsLibres\WopiLib\Contract\Service\WopiInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -final class ChillWopi implements WopiInterface +final readonly class ChillWopi implements WopiInterface { public function __construct(private WopiInterface $wopi) { diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php index 96ed5c651..4a0857521 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/UserManager.php @@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\Security; class UserManager implements \ChampsLibres\WopiBundle\Contracts\UserManagerInterface { - public function __construct(private Security $security) + public function __construct(private readonly Security $security) { } From 4ab4554e631a162e5018cb1623fe4355fff0f1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 3 May 2023 22:30:20 +0200 Subject: [PATCH 012/750] DX: embed test app inside bundle --- .env.test | 35 +++++++++++ .gitmodules | 3 - composer.json | 6 +- phpunit.xml.dist | 4 +- .../Tests/Form/CalendarTypeTest.php | 4 +- .../DataFixtures/ORM/LoadRelationships.php | 1 + .../DataFixtures/ORM/LoadReports.php | 4 ++ tests/Kernel.php | 55 ++++++++++++++++++ tests/app | 1 - tests/app/config/bootstrap.php | 23 ++++++++ tests/app/config/bundles.php | 39 +++++++++++++ tests/app/config/packages/assets.yaml | 3 + tests/app/config/packages/cache.yaml | 33 +++++++++++ tests/app/config/packages/champs-libres.yaml | 14 +++++ tests/app/config/packages/chill.yaml | 23 ++++++++ tests/app/config/packages/chill_budget.yaml | 14 +++++ tests/app/config/packages/dev/debug.yaml | 4 ++ tests/app/config/packages/dev/monolog.yaml | 21 +++++++ tests/app/config/packages/doctrine.yaml | 18 ++++++ .../config/packages/doctrine_migrations.yaml | 30 ++++++++++ tests/app/config/packages/framework.yaml | 30 ++++++++++ .../packages/lexik_jwt_authentication.yaml | 12 ++++ tests/app/config/packages/loophp_psr17.yaml | 8 +++ tests/app/config/packages/nyholm_psr7.yaml | 21 +++++++ .../config/packages/prod/deprecations.yaml | 8 +++ tests/app/config/packages/prod/doctrine.yaml | 20 +++++++ tests/app/config/packages/prod/monolog.yaml | 14 +++++ tests/app/config/packages/prod/routing.yaml | 3 + .../config/packages/prod/webpack_encore.yaml | 4 ++ .../config/packages/ramsey_uuid_doctrine.yaml | 4 ++ tests/app/config/packages/routing.yaml | 7 +++ tests/app/config/packages/security.yaml | 58 +++++++++++++++++++ .../packages/sensio_framework_extra.yaml | 3 + tests/app/config/packages/test/chill.yaml | 5 ++ tests/app/config/packages/test/framework.yaml | 6 ++ tests/app/config/packages/test/mailer.yaml | 5 ++ tests/app/config/packages/test/monolog.yaml | 12 ++++ tests/app/config/packages/test/security.yaml | 8 +++ tests/app/config/packages/test/twig.yaml | 2 + tests/app/config/packages/test/validator.yaml | 3 + .../config/packages/test/webpack_encore.yaml | 2 + tests/app/config/packages/translation.yaml | 7 +++ tests/app/config/packages/twig.yaml | 17 ++++++ tests/app/config/packages/validator.yaml | 8 +++ tests/app/config/packages/webpack_encore.yaml | 33 +++++++++++ tests/app/config/packages/workflow.yaml | 2 + tests/app/config/preload.php | 9 +++ tests/app/config/routes.yaml | 8 +++ tests/app/config/routes/annotations.yaml | 3 + tests/app/config/routes/dev/framework.yaml | 3 + tests/app/config/routes/dev/web_profiler.yaml | 7 +++ tests/app/config/services.yaml | 15 +++++ tests/bootstrap.php | 11 ++++ tests/console | 42 ++++++++++++++ 54 files changed, 723 insertions(+), 12 deletions(-) create mode 100644 tests/Kernel.php delete mode 160000 tests/app create mode 100644 tests/app/config/bootstrap.php create mode 100644 tests/app/config/bundles.php create mode 100644 tests/app/config/packages/assets.yaml create mode 100644 tests/app/config/packages/cache.yaml create mode 100644 tests/app/config/packages/champs-libres.yaml create mode 100644 tests/app/config/packages/chill.yaml create mode 100644 tests/app/config/packages/chill_budget.yaml create mode 100644 tests/app/config/packages/dev/debug.yaml create mode 100644 tests/app/config/packages/dev/monolog.yaml create mode 100644 tests/app/config/packages/doctrine.yaml create mode 100644 tests/app/config/packages/doctrine_migrations.yaml create mode 100644 tests/app/config/packages/framework.yaml create mode 100644 tests/app/config/packages/lexik_jwt_authentication.yaml create mode 100644 tests/app/config/packages/loophp_psr17.yaml create mode 100644 tests/app/config/packages/nyholm_psr7.yaml create mode 100644 tests/app/config/packages/prod/deprecations.yaml create mode 100644 tests/app/config/packages/prod/doctrine.yaml create mode 100644 tests/app/config/packages/prod/monolog.yaml create mode 100644 tests/app/config/packages/prod/routing.yaml create mode 100644 tests/app/config/packages/prod/webpack_encore.yaml create mode 100644 tests/app/config/packages/ramsey_uuid_doctrine.yaml create mode 100644 tests/app/config/packages/routing.yaml create mode 100644 tests/app/config/packages/security.yaml create mode 100644 tests/app/config/packages/sensio_framework_extra.yaml create mode 100644 tests/app/config/packages/test/chill.yaml create mode 100644 tests/app/config/packages/test/framework.yaml create mode 100644 tests/app/config/packages/test/mailer.yaml create mode 100644 tests/app/config/packages/test/monolog.yaml create mode 100644 tests/app/config/packages/test/security.yaml create mode 100644 tests/app/config/packages/test/twig.yaml create mode 100644 tests/app/config/packages/test/validator.yaml create mode 100644 tests/app/config/packages/test/webpack_encore.yaml create mode 100644 tests/app/config/packages/translation.yaml create mode 100644 tests/app/config/packages/twig.yaml create mode 100644 tests/app/config/packages/validator.yaml create mode 100644 tests/app/config/packages/webpack_encore.yaml create mode 100644 tests/app/config/packages/workflow.yaml create mode 100644 tests/app/config/preload.php create mode 100644 tests/app/config/routes.yaml create mode 100644 tests/app/config/routes/annotations.yaml create mode 100644 tests/app/config/routes/dev/framework.yaml create mode 100644 tests/app/config/routes/dev/web_profiler.yaml create mode 100644 tests/app/config/services.yaml create mode 100644 tests/bootstrap.php create mode 100755 tests/console diff --git a/.env.test b/.env.test index 914deb541..d431ad16c 100644 --- a/.env.test +++ b/.env.test @@ -3,3 +3,38 @@ # Run tests from root to adapt your own environment KERNEL_CLASS='App\Kernel' APP_SECRET='$ecretf0rt3st' + +ADMIN_PASSWORD=admin + +LOCALE=fr +REDIS_URL=redis +REDIS_PORT=6379 +REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT} + +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=2a30f6ba26521a2613821da35f28386e + +TWILIO_SID=~ +TWILIO_SECRET=~ +DEFAULT_CARRIER_CODE=BE + +ADD_ADDRESS_DEFAULT_COUNTRY=BE + +ADD_ADDRESS_MAP_CENTER_X=50.8443 +ADD_ADDRESS_MAP_CENTER_Y=4.3523 +ADD_ADDRESS_MAP_CENTER_Z=15 + +SHORT_MESSAGE_DSN=null://null +MESSENGER_TRANSPORT_DSN=sync:// +###< symfony/messenger ### + +###> doctrine/doctrine-bundle ### +# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +# +DATABASE_URL="postgresql://postgres:postgres@db:5432/test?serverVersion=14&charset=utf8" + +ASYNC_UPLOAD_TEMP_URL_KEY= +ASYNC_UPLOAD_TEMP_URL_BASE_PATH= +ASYNC_UPLOAD_TEMP_URL_CONTAINER= diff --git a/.gitmodules b/.gitmodules index 560ba7980..7bc519c88 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "_exts/sphinx-php"] path = _exts/sphinx-php url = https://github.com/fabpot/sphinx-php.git -[submodule "tests/app"] - path = tests/app - url = https://gitlab.com/Chill-projet/chill-app.git diff --git a/composer.json b/composer.json index b47856954..c5cd9c982 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ }, "autoload-dev": { "psr-4": { - "App\\": "tests/app/src/", + "App\\": "tests/", "Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests", "Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests" } @@ -123,12 +123,10 @@ }, "bin-dir": "bin", "optimize-autoloader": true, - "sort-packages": true, - "vendor-dir": "tests/app/vendor" + "sort-packages": true }, "scripts": { "auto-scripts": { - "assets:install %PUBLIC_DIR%": "symfony-cmd", "cache:clear": "symfony-cmd" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8f157fcc5..996eae432 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,10 +2,10 @@ diff --git a/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php b/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php index f9392ba57..5adce17b2 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Form/CalendarTypeTest.php @@ -97,9 +97,9 @@ final class CalendarTypeTest extends TypeTestCase $calendar = new Calendar(); $calendar->setMainUser(new class () extends User { - public function getId() + public function getId(): ?int { - return '1'; + return 1; } }); diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 151ecf0c2..7024e732b 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -42,6 +42,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface public function load(ObjectManager $manager): void { + return; $existing = []; for ($i = 0; 20 > $i; ++$i) { diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index 2dcf69c50..565266a5e 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -198,6 +198,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or return $result; } + + return $picked; } else { $picked = $this->pickChoice($choices); @@ -210,6 +212,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or return $result; } + + return $picked; } throw new \LogicException("should not happens"); diff --git a/tests/Kernel.php b/tests/Kernel.php new file mode 100644 index 000000000..5047bfa32 --- /dev/null +++ b/tests/Kernel.php @@ -0,0 +1,55 @@ + $envs) { + if ($envs[$this->environment] ?? $envs['all'] ?? false) { + yield new $class(); + } + } + } + + public function getProjectDir() + { + return \dirname(__DIR__); + } + + protected function configureRoutes(RouteCollectionBuilder $routes) + { + $confDir = $this->getProjectDir().'/tests/app/config'; + + $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); + $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); + } + + protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) + { + $container->addResource(new FileResource($this->getProjectDir().'/tests/app/config/bundles.php')); + $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); + $container->setParameter('container.dumper.inline_factories', true); + $confDir = $this->getProjectDir().'/tests/app/config'; + + $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); + $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob'); + $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); + $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); + } +} diff --git a/tests/app b/tests/app deleted file mode 160000 index 5e478fdfb..000000000 --- a/tests/app +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5e478fdfbf429baf3ce852ae69eb1f7101b1b416 diff --git a/tests/app/config/bootstrap.php b/tests/app/config/bootstrap.php new file mode 100644 index 000000000..10c196e4e --- /dev/null +++ b/tests/app/config/bootstrap.php @@ -0,0 +1,23 @@ +=1.2) +if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) { + (new Dotenv(false))->populate($env); +} else { + // load all the .env files + (new Dotenv(false))->loadEnv(dirname(__DIR__).'/../../.env.test'); +} + +$_SERVER += $_ENV; +$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; +$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/tests/app/config/bundles.php b/tests/app/config/bundles.php new file mode 100644 index 000000000..970afaa99 --- /dev/null +++ b/tests/app/config/bundles.php @@ -0,0 +1,39 @@ + ['all' => true], + Chill\ActivityBundle\ChillActivityBundle::class => ['all' => true], + Chill\AsideActivityBundle\ChillAsideActivityBundle::class => ['all' => true], + Chill\CalendarBundle\ChillCalendarBundle::class => ['all' => true], + Chill\CustomFieldsBundle\ChillCustomFieldsBundle::class => ['all' => true], + Chill\DocGeneratorBundle\ChillDocGeneratorBundle::class => ['all' => true], + Chill\DocStoreBundle\ChillDocStoreBundle::class => ['all' => true], + Chill\EventBundle\ChillEventBundle::class => ['all' => true], + Chill\MainBundle\ChillMainBundle::class => ['all' => true], + Chill\PersonBundle\ChillPersonBundle::class => ['all' => true], + Chill\ReportBundle\ChillReportBundle::class => ['all' => true], + Chill\TaskBundle\ChillTaskBundle::class => ['all' => true], + Chill\ThirdPartyBundle\ChillThirdPartyBundle::class => ['all' => true], + Chill\BudgetBundle\ChillBudgetBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], + Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], + Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], + Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + //Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], + Knp\Bundle\TimeBundle\KnpTimeBundle::class => ['all' => true], + Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], + loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true], + \Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true], + ChampsLibres\WopiBundle\WopiBundle::class => ['all' => true], + Chill\WopiBundle\ChillWopiBundle::class => ['all' => true], + \Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], + +]; diff --git a/tests/app/config/packages/assets.yaml b/tests/app/config/packages/assets.yaml new file mode 100644 index 000000000..051d36dce --- /dev/null +++ b/tests/app/config/packages/assets.yaml @@ -0,0 +1,3 @@ +framework: + assets: + json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' diff --git a/tests/app/config/packages/cache.yaml b/tests/app/config/packages/cache.yaml new file mode 100644 index 000000000..c7a5f169d --- /dev/null +++ b/tests/app/config/packages/cache.yaml @@ -0,0 +1,33 @@ +framework: + cache: + # Unique name of your app: used to compute stable namespaces for cache keys. + #prefix_seed: your_vendor_name/app_name + + # The "app" cache stores to the filesystem by default. + # The data in this cache should persist between deploys. + # Other options include: + + # Redis + #app: cache.adapter.redis + #default_redis_provider: redis://localhost + + # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) + #app: cache.adapter.apcu + + # Namespaced pools use the above "app" backend by default + #pools: + #my.dedicated.cache: null + + default_redis_provider: '%env(resolve:REDIS_URL)%' + + pools: + cache.user_data: + adapter: cache.adapter.redis + public: true + default_lifetime: 300 # 5 minutes + + # will be used in chill_main.tag_aware_cache service + cache.tags: + adapter: cache.adapter.redis + public: false + default_lifetime: 300 diff --git a/tests/app/config/packages/champs-libres.yaml b/tests/app/config/packages/champs-libres.yaml new file mode 100644 index 000000000..ebea3ef58 --- /dev/null +++ b/tests/app/config/packages/champs-libres.yaml @@ -0,0 +1,14 @@ +champs_libres_async_uploader: + openstack: + os_username: '%env(resolve:OS_USERNAME)%' # Required + os_password: '%env(resolve:OS_PASSWORD)%' # Required + os_tenant_id: '%env(resolve:OS_TENANT_ID)%' # Required + os_region_name: '%env(resolve:OS_REGION_NAME)%' # Required + os_auth_url: '%env(resolve:OS_AUTH_URL)%' # Required + temp_url: + temp_url_key: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_KEY)%' # Required + container: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_CONTAINER)%' # Required + temp_url_base_path: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_BASE_PATH)%' # Required. Do not forget a trailing slash + max_post_file_size: 15000000 # 15Mo (bytes) + max_expires_delay: 180 + max_submit_delay: 3600 diff --git a/tests/app/config/packages/chill.yaml b/tests/app/config/packages/chill.yaml new file mode 100644 index 000000000..92dbd0769 --- /dev/null +++ b/tests/app/config/packages/chill.yaml @@ -0,0 +1,23 @@ +chill_main: + available_languages: [ '%env(resolve:LOCALE)%' ] + notifications: + from_email: 'test@yopmail.com' + from_name: 'TEST CHILL' + host: 'localhost' + redis: + host: '%env(resolve:REDIS_HOST)%' + port: '%env(resolve:REDIS_PORT)%' + phone_helper: + twilio_sid: '%env(resolve:TWILIO_SID)%' + twilio_secret: '%env(resolve:TWILIO_SECRET)%' + default_carrier_code: '%env(resolve:DEFAULT_CARRIER_CODE)%' + +chill_custom_fields: + show_empty_values_in_views: false + +# Enable/disable specific libraries (css and js) +twig: + globals: + active_bootstrap: false + active_forkawesome: true + active_ckeditor: false diff --git a/tests/app/config/packages/chill_budget.yaml b/tests/app/config/packages/chill_budget.yaml new file mode 100644 index 000000000..dfb50ac9f --- /dev/null +++ b/tests/app/config/packages/chill_budget.yaml @@ -0,0 +1,14 @@ +#chill_amli_budget: +# resources: +# - { key: travail-temporaire, labels: [{ lang: fr, label: "Travail temporaire" }]} +# - { key: chomage, labels: [{ lang: fr, label: "Allocation de chômage"}]} +# - { key: cpas, labels: [{ lang: fr, label: "CPAS"}]} +# - { key: mutuelle, labels: [{ lang: fr, label: "Mutuelle"}]} +# - { key: pension-alimentaire, labels: [{ lang: fr, label: "Pension alimentaire"}]} +# - { key: allocation-fam, labels: [{ lang: fr, label: "Allocations familiales"}]} +# charges: +# - { key: charge-communes, labels: [{ lang: fr, label: "Charges communes" }]} +# - { key: electricity, labels: [{ lang: fr, label: "Électricité" }]} +# - { key: gaz, labels: [{ lang: fr, label: "Gaz" }]} +# - { key: water, labels: [{ lang: fr, label: "Eau" }]} +# - { key: autres, labels: [ { lang: fr, label: "Autres"}]} diff --git a/tests/app/config/packages/dev/debug.yaml b/tests/app/config/packages/dev/debug.yaml new file mode 100644 index 000000000..26d4e53d2 --- /dev/null +++ b/tests/app/config/packages/dev/debug.yaml @@ -0,0 +1,4 @@ +debug: + # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. + # See the "server:dump" command to start a new server. + dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" diff --git a/tests/app/config/packages/dev/monolog.yaml b/tests/app/config/packages/dev/monolog.yaml new file mode 100644 index 000000000..423fc10df --- /dev/null +++ b/tests/app/config/packages/dev/monolog.yaml @@ -0,0 +1,21 @@ +monolog: + handlers: + main: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + channels: ["!event"] + # uncomment to get logging in your browser + # you may have to allow bigger header sizes in your Web server configuration + #firephp: + # type: firephp + # level: info + #chromephp: + # type: chromephp + # level: info + console: + type: console + process_psr_3_messages: false + channels: ['!event', '!doctrine', '!console'] + bubble: false + diff --git a/tests/app/config/packages/doctrine.yaml b/tests/app/config/packages/doctrine.yaml new file mode 100644 index 000000000..9046f2e44 --- /dev/null +++ b/tests/app/config/packages/doctrine.yaml @@ -0,0 +1,18 @@ +doctrine: + dbal: + url: '%env(resolve:DATABASE_URL)%' + + # IMPORTANT: You MUST configure your server version, + # either here or in the DATABASE_URL env var (see .env file) + #server_version: '5.7' + orm: + auto_generate_proxy_classes: true + naming_strategy: doctrine.orm.naming_strategy.default + auto_mapping: true + #mappings: + # App: + # is_bundle: false + # type: annotation + # dir: '%kernel.project_dir%/src/Entity' + # prefix: 'App\Entity' + # alias: App diff --git a/tests/app/config/packages/doctrine_migrations.yaml b/tests/app/config/packages/doctrine_migrations.yaml new file mode 100644 index 000000000..a559780d3 --- /dev/null +++ b/tests/app/config/packages/doctrine_migrations.yaml @@ -0,0 +1,30 @@ +doctrine_migrations: + migrations_paths: + # migrations for default chill modules + 'Chill\Migrations\Main': '@ChillMainBundle/migrations' + 'Chill\Migrations\Activity': '@ChillActivityBundle/migrations' + 'Chill\Migrations\DocStore': '@ChillDocStoreBundle/migrations' + 'Chill\Migrations\CustomFields': '@ChillCustomFieldsBundle/migrations' + 'Chill\Migrations\Event': '@ChillEventBundle/migrations' + 'Chill\Migrations\Person': '@ChillPersonBundle/migrations' + 'Chill\Migrations\Report': '@ChillReportBundle/migrations' + 'Chill\Migrations\Task': '@ChillTaskBundle/migrations' + 'Chill\Migrations\ThirdParty': '@ChillThirdPartyBundle/migrations' + 'Chill\Migrations\AsideActivity': '@ChillAsideActivityBundle/migrations' + 'Chill\Migrations\DocGenerator': '@ChillDocGeneratorBundle/migrations' + 'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations' + 'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations' + + all_or_nothing: + true + + services: + 'Doctrine\Migrations\Version\Comparator': 'Chill\MainBundle\Doctrine\Migrations\VersionComparator' + + storage: + table_storage: + table_name: 'migration_versions' + version_column_name: 'version' + version_column_length: 1024 + executed_at_column_name: 'executed_at' + execution_time_column_name: 'execution_time' diff --git a/tests/app/config/packages/framework.yaml b/tests/app/config/packages/framework.yaml new file mode 100644 index 000000000..1ce5cb7ac --- /dev/null +++ b/tests/app/config/packages/framework.yaml @@ -0,0 +1,30 @@ +# see https://symfony.com/doc/current/reference/configuration/framework.html +framework: + secret: '%env(APP_SECRET)%' + + # DIRTY FIX un bug dans symfony4 empêche de récupérer un tableau de variables depuis .env + # cfr. https://github.com/symfony/symfony/issues/28599 + trusted_hosts: + - '^(localhost|127.0.0.1)$' + + #csrf_protection: true + #http_method_override: true + + # Enables session support. Note that the session will ONLY be started if you read or write from it. + # Remove or comment this section to explicitly disable session support. + session: + handler_id: null + cookie_secure: auto + cookie_samesite: lax + + #esi: true + #fragments: true + php_errors: + log: true + + ## sf4 check: ou à déplacer dans un chill.yaml + assets: + json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' + + templating: + engines: ['twig'] diff --git a/tests/app/config/packages/lexik_jwt_authentication.yaml b/tests/app/config/packages/lexik_jwt_authentication.yaml new file mode 100644 index 000000000..93041d0a2 --- /dev/null +++ b/tests/app/config/packages/lexik_jwt_authentication.yaml @@ -0,0 +1,12 @@ +lexik_jwt_authentication: + secret_key: '%env(resolve:JWT_SECRET_KEY)%' + public_key: '%env(resolve:JWT_PUBLIC_KEY)%' + pass_phrase: '%env(JWT_PASSPHRASE)%' + + # required for wopi - recommended duration + token_ttl: 36000 + + token_extractors: + query_parameter: + enabled: true + name: access_token diff --git a/tests/app/config/packages/loophp_psr17.yaml b/tests/app/config/packages/loophp_psr17.yaml new file mode 100644 index 000000000..b5481376d --- /dev/null +++ b/tests/app/config/packages/loophp_psr17.yaml @@ -0,0 +1,8 @@ +services: + # Register loophp/psr17/Psr17 class and autowire/autoconfigure it. + loophp\psr17\Psr17: + autowire: true + autoconfigure: true + + # Alias the service to the Psr17 interface. + loophp\psr17\Psr17Interface: '@loophp\psr17\Psr17' diff --git a/tests/app/config/packages/nyholm_psr7.yaml b/tests/app/config/packages/nyholm_psr7.yaml new file mode 100644 index 000000000..f1357233b --- /dev/null +++ b/tests/app/config/packages/nyholm_psr7.yaml @@ -0,0 +1,21 @@ +services: + # Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories) + Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory' + Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory' + Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory' + Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory' + Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory' + Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory' + + # Register nyholm/psr7 services for autowiring with HTTPlug factories + Http\Message\MessageFactory: '@nyholm.psr7.httplug_factory' + Http\Message\RequestFactory: '@nyholm.psr7.httplug_factory' + Http\Message\ResponseFactory: '@nyholm.psr7.httplug_factory' + Http\Message\StreamFactory: '@nyholm.psr7.httplug_factory' + Http\Message\UriFactory: '@nyholm.psr7.httplug_factory' + + nyholm.psr7.psr17_factory: + class: Nyholm\Psr7\Factory\Psr17Factory + + nyholm.psr7.httplug_factory: + class: Nyholm\Psr7\Factory\HttplugFactory diff --git a/tests/app/config/packages/prod/deprecations.yaml b/tests/app/config/packages/prod/deprecations.yaml new file mode 100644 index 000000000..920a06197 --- /dev/null +++ b/tests/app/config/packages/prod/deprecations.yaml @@ -0,0 +1,8 @@ +# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists +#monolog: +# channels: [deprecation] +# handlers: +# deprecation: +# type: stream +# channels: [deprecation] +# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" diff --git a/tests/app/config/packages/prod/doctrine.yaml b/tests/app/config/packages/prod/doctrine.yaml new file mode 100644 index 000000000..084f59a05 --- /dev/null +++ b/tests/app/config/packages/prod/doctrine.yaml @@ -0,0 +1,20 @@ +doctrine: + orm: + auto_generate_proxy_classes: false + metadata_cache_driver: + type: pool + pool: doctrine.system_cache_pool + query_cache_driver: + type: pool + pool: doctrine.system_cache_pool + result_cache_driver: + type: pool + pool: doctrine.result_cache_pool + +framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/tests/app/config/packages/prod/monolog.yaml b/tests/app/config/packages/prod/monolog.yaml new file mode 100644 index 000000000..8fb26a524 --- /dev/null +++ b/tests/app/config/packages/prod/monolog.yaml @@ -0,0 +1,14 @@ +monolog: + handlers: + graylog: + type: gelf + publisher: + hostname: "%env(resolve:GELF_HOST)%" + port: "%env(resolve:GELF_PORT)%" + level: warning + channels: ['!event'] + console: + type: console + process_psr_3_messages: false + channels: ['!event', '!doctrine', '!console'] + bubble: false diff --git a/tests/app/config/packages/prod/routing.yaml b/tests/app/config/packages/prod/routing.yaml new file mode 100644 index 000000000..b3e6a0af2 --- /dev/null +++ b/tests/app/config/packages/prod/routing.yaml @@ -0,0 +1,3 @@ +framework: + router: + strict_requirements: null diff --git a/tests/app/config/packages/prod/webpack_encore.yaml b/tests/app/config/packages/prod/webpack_encore.yaml new file mode 100644 index 000000000..d0b3ba81e --- /dev/null +++ b/tests/app/config/packages/prod/webpack_encore.yaml @@ -0,0 +1,4 @@ +#webpack_encore: + # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) + # Available in version 1.2 + #cache: true diff --git a/tests/app/config/packages/ramsey_uuid_doctrine.yaml b/tests/app/config/packages/ramsey_uuid_doctrine.yaml new file mode 100644 index 000000000..cfc3036f9 --- /dev/null +++ b/tests/app/config/packages/ramsey_uuid_doctrine.yaml @@ -0,0 +1,4 @@ +doctrine: + dbal: + types: + uuid: 'Ramsey\Uuid\Doctrine\UuidType' diff --git a/tests/app/config/packages/routing.yaml b/tests/app/config/packages/routing.yaml new file mode 100644 index 000000000..b45c1cec7 --- /dev/null +++ b/tests/app/config/packages/routing.yaml @@ -0,0 +1,7 @@ +framework: + router: + utf8: true + + # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. + # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands + #default_uri: http://localhost diff --git a/tests/app/config/packages/security.yaml b/tests/app/config/packages/security.yaml new file mode 100644 index 000000000..f93eb04c3 --- /dev/null +++ b/tests/app/config/packages/security.yaml @@ -0,0 +1,58 @@ +security: + + # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers + providers: + + chain_provider: + chain : + providers: [in_memory, users] + in_memory: + memory: + users: + admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'] } + users: + id: chill.main.user_provider + + encoders: + + Chill\MainBundle\Entity\User: + algorithm: bcrypt + Symfony\Component\Security\Core\User\User: plaintext + + firewalls: + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + default: + anonymous: ~ + provider: chain_provider + form_login: + csrf_parameter: _csrf_token + csrf_token_id: authenticate + #csrf_provider: security.csrf.token_manager + logout_on_user_change: true + logout: ~ + + # uncomment to enable impersonate mode in Chill + # https://symfony.com/doc/current/security/impersonating_user.html + # switch_user: true + + # activate different ways to authenticate + # https://symfony.com/doc/current/security.html#firewalls-authentication + + # Easy way to control access for large sections of your site + # Note: Only the *first* access control that matches will be used + access_control: + - { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY } + # access for homepage, the homepage redirect admin to admin section + - { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] } + - { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] } + # idem + - { path: ^/([a-z]+/)?homepage, roles: [ IS_AUTHENTICATED_REMEMBERED ] } + # admin section, only for admin + - { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN } + # other pages, only for regular user (no admin) + - { path: ^/, roles: ROLE_USER } diff --git a/tests/app/config/packages/sensio_framework_extra.yaml b/tests/app/config/packages/sensio_framework_extra.yaml new file mode 100644 index 000000000..1821ccc07 --- /dev/null +++ b/tests/app/config/packages/sensio_framework_extra.yaml @@ -0,0 +1,3 @@ +sensio_framework_extra: + router: + annotations: false diff --git a/tests/app/config/packages/test/chill.yaml b/tests/app/config/packages/test/chill.yaml new file mode 100644 index 000000000..a6a68dee4 --- /dev/null +++ b/tests/app/config/packages/test/chill.yaml @@ -0,0 +1,5 @@ +--- +chill_main: + available_languages: + - 'fr' + - 'en' diff --git a/tests/app/config/packages/test/framework.yaml b/tests/app/config/packages/test/framework.yaml new file mode 100644 index 000000000..23906ec36 --- /dev/null +++ b/tests/app/config/packages/test/framework.yaml @@ -0,0 +1,6 @@ +framework: + test: true + session: + storage_id: session.storage.mock_file + assets: + json_manifest_path: NULL diff --git a/tests/app/config/packages/test/mailer.yaml b/tests/app/config/packages/test/mailer.yaml new file mode 100644 index 000000000..52b99299c --- /dev/null +++ b/tests/app/config/packages/test/mailer.yaml @@ -0,0 +1,5 @@ +framework: + mailer: + dsn: 'null://null' + envelope: + sender: 'test@chill.social' diff --git a/tests/app/config/packages/test/monolog.yaml b/tests/app/config/packages/test/monolog.yaml new file mode 100644 index 000000000..fc40641dc --- /dev/null +++ b/tests/app/config/packages/test/monolog.yaml @@ -0,0 +1,12 @@ +monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [404, 405] + channels: ["!event"] + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug diff --git a/tests/app/config/packages/test/security.yaml b/tests/app/config/packages/test/security.yaml new file mode 100644 index 000000000..4ff914485 --- /dev/null +++ b/tests/app/config/packages/test/security.yaml @@ -0,0 +1,8 @@ +--- +# config/packages/test/security.yaml +security: + firewalls: + default: + http_basic: ~ + role_hierarchy: + CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1] diff --git a/tests/app/config/packages/test/twig.yaml b/tests/app/config/packages/test/twig.yaml new file mode 100644 index 000000000..8c6e0b401 --- /dev/null +++ b/tests/app/config/packages/test/twig.yaml @@ -0,0 +1,2 @@ +twig: + strict_variables: true diff --git a/tests/app/config/packages/test/validator.yaml b/tests/app/config/packages/test/validator.yaml new file mode 100644 index 000000000..1e5ab7880 --- /dev/null +++ b/tests/app/config/packages/test/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + not_compromised_password: false diff --git a/tests/app/config/packages/test/webpack_encore.yaml b/tests/app/config/packages/test/webpack_encore.yaml new file mode 100644 index 000000000..9ad967357 --- /dev/null +++ b/tests/app/config/packages/test/webpack_encore.yaml @@ -0,0 +1,2 @@ +webpack_encore: + strict_mode: false diff --git a/tests/app/config/packages/translation.yaml b/tests/app/config/packages/translation.yaml new file mode 100644 index 000000000..58f048218 --- /dev/null +++ b/tests/app/config/packages/translation.yaml @@ -0,0 +1,7 @@ +framework: + + default_locale: '%env(resolve:LOCALE)%' + + translator: + default_path: '%kernel.project_dir%/translations' + fallbacks: [ '%env(resolve:LOCALE)%' ] diff --git a/tests/app/config/packages/twig.yaml b/tests/app/config/packages/twig.yaml new file mode 100644 index 000000000..02d862922 --- /dev/null +++ b/tests/app/config/packages/twig.yaml @@ -0,0 +1,17 @@ +twig: + default_path: '%kernel.project_dir%/templates' + debug: '%kernel.debug%' + strict_variables: '%kernel.debug%' + exception_controller: null + + ## In Symfony 5, bootstrap_5 theme is supported. But not yet in sf4 !! + # see sf5 https://symfony.com/doc/current/form/form_themes.html + # see sf4 https://symfony.com/doc/4.4/form/form_themes.html + # + # While waiting for the upgrade, we get the form theme file + # (https://github.com/symfony/symfony/tree/5.4/src/Symfony/Bridge/Twig/Resources/views/Form), + # put it in ChillMainBundle/Resources/views/Form/bootstrap5/ + # and adapt it lightly. + # + form_themes: ['@ChillMain/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig'] + #form_themes: ['bootstrap_5_horizontal_layout.html.twig'] diff --git a/tests/app/config/packages/validator.yaml b/tests/app/config/packages/validator.yaml new file mode 100644 index 000000000..350786a13 --- /dev/null +++ b/tests/app/config/packages/validator.yaml @@ -0,0 +1,8 @@ +framework: + validation: + email_validation_mode: html5 + + # Enables validator auto-mapping support. + # For instance, basic validation constraints will be inferred from Doctrine's metadata. + #auto_mapping: + # App\Entity\: [] diff --git a/tests/app/config/packages/webpack_encore.yaml b/tests/app/config/packages/webpack_encore.yaml new file mode 100644 index 000000000..709531205 --- /dev/null +++ b/tests/app/config/packages/webpack_encore.yaml @@ -0,0 +1,33 @@ +--- +webpack_encore: + # The path where Encore is building the assets - i.e. Encore.setOutputPath() + output_path: '%kernel.project_dir%/public/build' + + # If multiple builds are defined (as shown below), you can disable the default build: + # output_path: false + + # Set attributes that will be rendered on all script and link tags + script_attributes: + defer: true + # link_attributes: + # + + # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials') + # crossorigin: 'anonymous' + + # Preload all rendered script and link tags automatically via the HTTP/2 Link header + # preload: true + + # Throw an exception if the entrypoints.json file is missing or an entry is missing from the data + # strict_mode: false + + # If you have multiple builds: + # builds: + # pass "frontend" as the 3rg arg to the Twig functions + # {{ encore_entry_script_tags('entry1', null, 'frontend') }} + + # frontend: '%kernel.project_dir%/public/frontend/build' + + # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) + # Put in config/packages/prod/webpack_encore.yaml + # cache: true diff --git a/tests/app/config/packages/workflow.yaml b/tests/app/config/packages/workflow.yaml new file mode 100644 index 000000000..855df59cd --- /dev/null +++ b/tests/app/config/packages/workflow.yaml @@ -0,0 +1,2 @@ +framework: + workflows: null diff --git a/tests/app/config/preload.php b/tests/app/config/preload.php new file mode 100644 index 000000000..064bdcd6a --- /dev/null +++ b/tests/app/config/preload.php @@ -0,0 +1,9 @@ +bootEnv(dirname(__DIR__).'/.env'); +} diff --git a/tests/console b/tests/console new file mode 100755 index 000000000..264e064a1 --- /dev/null +++ b/tests/console @@ -0,0 +1,42 @@ +#!/usr/bin/env php +getParameterOption(['--env', '-e'], null, true)) { + putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); +} + +if ($input->hasParameterOption('--no-debug', true)) { + putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); +} + +require dirname(__DIR__).'/tests/app/config/bootstrap.php'; + +if ($_SERVER['APP_DEBUG']) { + umask(0000); + + if (class_exists(Debug::class)) { + Debug::enable(); + } +} + +$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); +$application = new Application($kernel); +$application->run($input); From 9252e92da02f801708849b59df35cdf65bfb7fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 3 May 2023 23:00:24 +0200 Subject: [PATCH 013/750] gitlabci to new skeleton --- .gitlab-ci.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f1d75ed5..54c2cbfee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,6 @@ # Select what we should cache between builds cache: paths: - - tests/app/vendor/ - .cache # Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service @@ -28,7 +27,7 @@ variables: REDIS_PORT: 6379 REDIS_URL: redis://redis:6379 # change vendor dir to make the app install into tests/apps - COMPOSER_VENDOR_DIR: tests/app/vendor + #COMPOSER_VENDOR_DIR: /vendor DEFAULT_CARRIER_CODE: BE stages: @@ -49,7 +48,7 @@ build: expire_in: 30 min paths: - bin - - tests/app/vendor/ + - vendor/ code_style: stage: Tests @@ -63,7 +62,7 @@ code_style: expire_in: 30 min paths: - bin - - tests/app/vendor/ + - vendor/ phpstan_tests: stage: Tests @@ -77,7 +76,7 @@ phpstan_tests: expire_in: 30 min paths: - bin - - tests/app/vendor/ + - vendor/ rector_tests: stage: Tests @@ -91,7 +90,7 @@ rector_tests: expire_in: 30 min paths: - bin - - tests/app/vendor/ + - vendor/ # psalm_tests: # stage: Tests @@ -111,13 +110,12 @@ unit_tests: # until we fix testes allow_failure: true script: - - php tests/app/bin/console doctrine:migrations:migrate -n - - php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev - - php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n - - php -d memory_limit=2G tests/app/bin/console cache:clear --env=test + - php tests/console doctrine:migrations:migrate -n + - php -d memory_limit=3G tests/console doctrine:fixtures:load -n + - php -d memory_limit=2G tests/console cache:clear --env=test - php -d memory_limit=4G bin/phpunit --colors=never artifacts: expire_in: 30 min paths: - bin - - tests/app/vendor/ + - vendor/ From f04ef9c9315869e00a45fcaee07f7409105b7942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 5 May 2023 12:11:19 +0200 Subject: [PATCH 014/750] DX: add rector rules "symfony up to 4.4" --- rector.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rector.php b/rector.php index 00147e460..5337c5ece 100644 --- a/rector.php +++ b/rector.php @@ -12,6 +12,8 @@ return static function (RectorConfig $rectorConfig): void { __DIR__ . '/src', ]); + $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/testsApp_KernelDevDebugContainer.xml'); + //$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class); //$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector'); @@ -21,7 +23,8 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_82 + LevelSetList::UP_TO_PHP_82, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_44, ]); // skip some path... From efaa01f4f6c8bc71b8958e4dcb6dc39c5bb75b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 5 May 2023 18:21:09 +0200 Subject: [PATCH 015/750] DX: rector apply rules 'symfony up to 4.4 --- .../src/Templating/Entity/CategoryRender.php | 2 +- .../Templating/BudgetElementTypeRender.php | 2 +- .../AzureGrantAdminConsentAndAcquireToken.php | 2 +- .../SendShortMessageOnEligibleCalendar.php | 2 +- .../Controller/CalendarDocController.php | 2 +- .../MSGraph/RemoteEventConverter.php | 2 +- .../DefaultShortMessageForCalendarBuilder.php | 2 +- .../MSGraph/AddressConverterTest.php | 2 +- ...aultShortMessageForCalendarBuilderTest.php | 2 +- .../Command/CreateFieldsOnGroupCommand.php | 6 ++--- .../CustomFields/CustomFieldLongChoice.php | 2 +- .../ChillEventBundle/Search/EventSearch.php | 2 +- .../Command/ChillImportUsersCommand.php | 3 ++- .../ChillUserSendRenewPasswordCodeCommand.php | 3 ++- .../Command/ExecuteCronJobCommand.php | 2 +- .../Command/LoadAndUpdateLanguagesCommand.php | 3 ++- .../Command/LoadCountriesCommand.php | 3 ++- .../Command/LoadPostalCodesCommand.php | 3 ++- .../Command/SetPasswordCommand.php | 3 ++- .../Controller/SavedExportController.php | 2 +- .../ChillMainBundle/Notification/Mailer.php | 2 +- .../Service/RollingDate/RollingDate.php | 1 - .../Templating/Entity/AddressRender.php | 2 +- .../Templating/Entity/CommentRender.php | 2 +- .../Templating/Entity/UserRender.php | 2 +- .../Templating/Entity/AddressRenderTest.php | 18 +++++++------- .../NotificationOnTransitionTest.php | 2 +- .../NotificationOnTransition.php | 2 +- .../SendAccessKeyEventSubscriber.php | 2 +- .../PersonAddressMoveEventSubscriber.php | 2 +- .../Events/UserRefEventSubscriber.php | 2 +- .../Command/ChillPersonMoveCommand.php | 3 ++- .../Command/ImportSocialWorkMetadata.php | 2 +- ...mpanyingPeriodRegulationListController.php | 2 +- .../HouseholdCompositionController.php | 2 +- .../ReassignAccompanyingPeriodController.php | 2 +- .../DataFixtures/ORM/LoadRelationships.php | 11 +++++---- .../ChillPersonBundle/Search/PersonSearch.php | 2 +- .../Templating/Entity/PersonRender.php | 2 +- .../Templating/Entity/SocialActionRender.php | 2 +- .../Templating/Entity/SocialIssueRender.php | 2 +- .../Events/PersonMoveEventSubscriberTest.php | 4 ++-- .../DataFixtures/ORM/LoadReports.php | 24 ++++++++----------- .../Templating/Entity/ThirdPartyRender.php | 2 +- .../ChillWopiBundle/src/Controller/Editor.php | 2 +- 45 files changed, 75 insertions(+), 74 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index 9094169c2..e4ffd99c0 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -27,7 +27,7 @@ final readonly class CategoryRender implements ChillEntityRenderInterface public const SEPERATOR_KEY = 'default.separator'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) { } diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index c48c952a1..83cfdc1da 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -22,7 +22,7 @@ use Symfony\Component\Templating\EngineInterface; */ final readonly class BudgetElementTypeRender implements ChillEntityRenderInterface { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine) + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private \Twig\Environment $engine) { } diff --git a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php index de9b5477f..110adccdc 100644 --- a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php +++ b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php @@ -34,7 +34,7 @@ class AzureGrantAdminConsentAndAcquireToken extends Command parent::__construct('chill:calendar:msgraph-grant-admin-consent'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { /** @var FormatterHelper $formatter */ $formatter = $this->getHelper('formatter'); diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index 8222d0ace..a027c1bc2 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -35,7 +35,7 @@ class SendShortMessageOnEligibleCalendar extends Command return 'chill:calendar:send-short-messages'; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->messageSender->sendBulkMessageToEligibleCalendars(); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index 6542f5c97..cde6bcfe7 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -33,7 +33,7 @@ use UnexpectedValueException; class CalendarDocController { - public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EngineInterface $engine, private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly \Twig\Environment $engine, private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php index c4d8e0b70..5b52a6ecd 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php @@ -57,7 +57,7 @@ class RemoteEventConverter private readonly DateTimeZone $remoteDateTimeZone; public function __construct( - private readonly EngineInterface $engine, + private readonly \Twig\Environment $engine, private readonly LocationConverter $locationConverter, private readonly LoggerInterface $logger, private readonly PersonRenderInterface $personRender, diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php index 8177be31a..d96cb450e 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php @@ -24,7 +24,7 @@ use Symfony\Component\Templating\EngineInterface; class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface { - public function __construct(private readonly EngineInterface $engine) + public function __construct(private readonly \Twig\Environment $engine) { } diff --git a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/AddressConverterTest.php b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/AddressConverterTest.php index 827e22381..7623cba64 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/AddressConverterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/RemoteCalendar/Connector/MSGraph/AddressConverterTest.php @@ -61,7 +61,7 @@ final class AddressConverterTest extends TestCase private function buildAddressConverter(): AddressConverter { - $engine = $this->prophesize(EngineInterface::class); + $engine = $this->prophesize(\Twig\Environment::class); $translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class); $translatableStringHelper->localize(Argument::type('array'))->will(static fn ($args): string => ($args[0] ?? ['fr' => 'not provided'])['fr'] ?? 'not provided'); diff --git a/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilderTest.php b/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilderTest.php index 6d42540cc..67d124c40 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilderTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilderTest.php @@ -64,7 +64,7 @@ final class DefaultShortMessageForCalendarBuilderTest extends TestCase ->setMobilenumber($this->phoneNumberUtil->parse('+32470123456', 'BE')) ->setAcceptSMS(false); - $engine = $this->prophesize(EngineInterface::class); + $engine = $this->prophesize(\Twig\Environment::class); $engine->render(Argument::exact('@ChillCalendar/CalendarShortMessage/short_message.txt.twig'), Argument::withKey('calendar')) ->willReturn('message content') ->shouldBeCalledTimes(1); diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index 40a946bd2..c6a3fb63c 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -85,10 +85,7 @@ class CreateFieldsOnGroupCommand extends Command } } - /** - * @return int|void|null - */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $helper = $this->getHelperSet()->get('question'); @@ -138,6 +135,7 @@ class CreateFieldsOnGroupCommand extends Command ); $fields = $this->_addFields($customFieldsGroup, $fieldsInput, $output); + return 0; } private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 5f7351372..74115cfd3 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -35,7 +35,7 @@ class CustomFieldLongChoice extends AbstractCustomField public function __construct( private readonly OptionRepository $optionRepository, private readonly TranslatableStringHelper $translatableStringHelper, - private readonly EngineInterface $templating, + private readonly \Twig\Environment $templating, ) { } diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 6b4192004..bb87a2f09 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -49,7 +49,7 @@ class EventSearch extends AbstractSearch TokenStorageInterface $tokenStorage, private readonly EntityRepository $er, private readonly AuthorizationHelper $helper, - private readonly TemplatingEngine $templating, + private readonly \Twig\Environment $templating, private readonly PaginatorFactory $paginationFactory ) { $this->user = $tokenStorage->getToken()->getUser(); diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index 48d460875..03c8b5742 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -198,7 +198,7 @@ class ChillImportUsersCommand extends Command return false; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->tempOutput = $output; $this->tempInput = $input; @@ -218,6 +218,7 @@ class ChillImportUsersCommand extends Command } catch (Exception $e) { throw $e; } + return 0; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index b7ef472a4..cb99db829 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -101,7 +101,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command ->addOption('subject', null, InputOption::VALUE_REQUIRED, 'Subject of the email', 'Recover your password'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = $output; @@ -119,6 +119,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command $this->sendRecoverCode($user); } + return 0; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php index b3f9a9f4d..ec38fa173 100644 --- a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php @@ -34,7 +34,7 @@ class ExecuteCronJobCommand extends Command ->addUsage(''); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { if ([] === $input->getArgument('job')) { $this->cronManager->run(); diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index 729051ea3..096845f47 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -80,7 +80,7 @@ class LoadAndUpdateLanguagesCommand extends Command * * @see \Symfony\Component\Console\Command\Command::execute() */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $em = $this->entityManager; $chillAvailableLanguages = $this->availableLanguages; @@ -130,5 +130,6 @@ class LoadAndUpdateLanguagesCommand extends Command } $em->flush(); + return 0; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index c5cbdd78a..c26c698c1 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -73,7 +73,7 @@ class LoadCountriesCommand extends Command * * @see \Symfony\Component\Console\Command\Command::execute() */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $countries = static::prepareCountryList($this->availableLanguages); $em = $this->entityManager; @@ -90,5 +90,6 @@ class LoadCountriesCommand extends Command } $em->flush(); + return 0; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 7bda1d672..4bbc459a7 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -72,7 +72,7 @@ class LoadPostalCodesCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $csv = $this->getCSVResource($input); @@ -105,6 +105,7 @@ class LoadPostalCodesCommand extends Command $this->entityManager->flush(); $output->writeln('' . $num . ' were added !'); + return 0; } private function addPostalCode($row, OutputInterface $output) diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php index c5eec91be..d27f18848 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -63,7 +63,7 @@ class SetPasswordCommand extends Command ->addArgument('password', InputArgument::OPTIONAL, 'the new password'); } - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $user = $this->_getUser($input->getArgument('username')); @@ -81,5 +81,6 @@ class SetPasswordCommand extends Command } $this->_setPassword($user, $password); + return 0; } } diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 923394da9..0932c199a 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -36,7 +36,7 @@ use function count; class SavedExportController { - public function __construct(private readonly EngineInterface $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index 082bff84c..6e35aecdc 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -40,7 +40,7 @@ class Mailer * @param $routeParameters * @param mixed[] $routeParameters */ - public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly EngineInterface $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly \Twig\Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) { } diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index cc02dc822..35e6211b7 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -64,7 +64,6 @@ class RollingDate final public const T_YEAR_PREVIOUS_START = 'year_previous_start'; /** - * @param string $roll * @param DateTimeImmutable|null $fixedDate Only to insert if $roll equals @see{self::T_FIXED_DATE} * @param DateTimeImmutable $pivotDate Will be "now" if null is given */ diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index c952bb5aa..648d7b734 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -36,7 +36,7 @@ class AddressRender implements ChillEntityRenderInterface 'extended_infos' => false, ]; - public function __construct(private readonly EngineInterface $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly \Twig\Environment $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index ff8ea0dc3..0d42d2601 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -25,7 +25,7 @@ class CommentRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly EngineInterface $engine) + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly \Twig\Environment $engine) { } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index 880ee8587..a83e5369e 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -30,7 +30,7 @@ class UserRender implements ChillEntityRenderInterface 'absence' => true, ]; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php index 62bab9973..c8f062301 100644 --- a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php @@ -220,7 +220,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderComplexAddressBE(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -232,7 +232,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderComplexAddressFR(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -244,7 +244,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderNoFullAddressBE(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -256,7 +256,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderStringSimpleAddressBE(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -268,7 +268,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderStringSimpleAddressFR(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -280,7 +280,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderWithBuildingAddressBE(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -292,7 +292,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderWithBuildingAddressFR(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -304,7 +304,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderWithStepsAddressBE(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); @@ -316,7 +316,7 @@ final class AddressRenderTest extends KernelTestCase */ public function testRenderWithStepsAddressFR(Address $addr, string $expectedString): void { - $engine = self::$container->get(EngineInterface::class); + $engine = self::$container->get(\Twig\Environment::class); $translatableStringHelper = self::$container->get(TranslatableStringHelper::class); $renderer = new AddressRender($engine, $translatableStringHelper); diff --git a/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationOnTransitionTest.php b/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationOnTransitionTest.php index 8cc190e65..c85ff3c05 100644 --- a/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationOnTransitionTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationOnTransitionTest.php @@ -84,7 +84,7 @@ final class NotificationOnTransitionTest extends TestCase } ); - $engine = $this->prophesize(EngineInterface::class); + $engine = $this->prophesize(\Twig\Environment::class); $engine->render(Argument::type('string'), Argument::type('array')) ->willReturn('dummy text'); diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index 78b165a85..a79f726ba 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -25,7 +25,7 @@ use function in_array; class NotificationOnTransition implements EventSubscriberInterface { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EngineInterface $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) { } diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php index adf19fb92..a4e8c6b78 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php @@ -21,7 +21,7 @@ use Symfony\Component\Workflow\Registry; class SendAccessKeyEventSubscriber { - public function __construct(private readonly EngineInterface $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) + public function __construct(private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) { } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index ce26780a4..c532b5553 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonAddressMoveEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) + public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index b8ca31835..9e725b22c 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserRefEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister) + public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister) { } diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index 4817e3819..d587a55e5 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -63,7 +63,7 @@ final class ChillPersonMoveCommand extends Command ->addOption('delete-entity', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'entity to delete', []); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $repository = $this->em->getRepository(Person::class); $from = $repository->find($input->getOption('from')); @@ -100,6 +100,7 @@ final class ChillPersonMoveCommand extends Command $this->chillLogger->notice('Move a person from command line succeeded', $ctxt); } + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php index 643e176c4..8e4009364 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php @@ -41,7 +41,7 @@ final class ImportSocialWorkMetadata extends Command ->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The default language'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $filepath = $input->getOption('filepath'); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index 5ce844a90..3a12cc514 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -32,7 +32,7 @@ use Symfony\Component\Templating\EngineInterface; class AccompanyingPeriodRegulationListController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 01810feeb..ad4743921 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -36,7 +36,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdCompositionController extends AbstractController { - public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index 6bfd7ac86..404082630 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -40,7 +40,7 @@ use function is_int; class ReassignAccompanyingPeriodController extends AbstractController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) { } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 7024e732b..ddf6a7d9c 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -42,7 +42,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface public function load(ObjectManager $manager): void { - return; + /** @var array> $existing */ $existing = []; for ($i = 0; 20 > $i; ++$i) { @@ -60,15 +60,16 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface ->setUpdatedAt($date); // remove the potential duplicates - $set = $relationship->getFromPerson()->getId() < $relationship->getToPerson()->getId() ? - [$relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()] : - [$relationship->getToPerson()->getId(), $relationship->getFromPerson()->getId()]; + $set = [ + min($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()), + max($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()), + ]; if (array_key_exists($set[0], $existing) && array_key_exists($set[1], $existing[$set[0]])) { continue; } + $existing[$set[0]][$set[1]] = 1; - $existing[$set[0]][$existing[$set[1]]] = 1; $manager->persist($relationship); } diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index 205023f19..c5a324855 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -45,7 +45,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf 'birthdate-after', 'gender', 'nationality', 'phonenumber', 'city', ]; - public function __construct(private readonly EngineInterface $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository) + public function __construct(private readonly \Twig\Environment $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index c41a94779..1c3ff56cd 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -28,7 +28,7 @@ class PersonRender implements PersonRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) + public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php index e4253f52e..c2d91483f 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php @@ -47,7 +47,7 @@ class SocialActionRender implements ChillEntityRenderInterface */ final public const SHOW_AND_CHILDREN = 'show_and_children'; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator) + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index f815afc43..79a8c62c4 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -40,7 +40,7 @@ final readonly class SocialIssueRender implements ChillEntityRenderInterface */ public const SHOW_AND_CHILDREN = 'show_and_children'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator) + public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine, private TranslatorInterface $translator) { } diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php index 4f9977b6d..e7fa379f6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php @@ -247,7 +247,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase } private function buildSubscriber( - ?EngineInterface $engine = null, + ?\Twig\Environment $engine = null, ?NotificationPersisterInterface $notificationPersister = null, ?Security $security = null, ?TranslatorInterface $translator = null @@ -264,7 +264,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase } if (null === $engine) { - $double = $this->prophesize(EngineInterface::class); + $double = $this->prophesize(\Twig\Environment::class); $engine = $double->reveal(); } diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index 565266a5e..6dc3c9b8c 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -200,23 +200,21 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or } return $picked; - } else { - $picked = $this->pickChoice($choices); + } + $picked = $this->pickChoice($choices); - if ($other) { - $result = ['_other' => null, '_choices' => $picked]; + if ($other) { + $result = ['_other' => null, '_choices' => $picked]; - if ('_other' === $picked) { - $result['_other'] = $this->faker->realText(70); - } - - return $result; + if ('_other' === $picked) { + $result['_other'] = $this->faker->realText(70); } - return $picked; + return $result; } - throw new \LogicException("should not happens"); + return $picked; + } /** @@ -231,10 +229,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or /** * pick a choice within a 'choices' options (for choice type). - * - * @return the slug of the selected choice */ - private function pickChoice(array $choices) + private function pickChoice(array $choices): string { return $choices[array_rand($choices)]['slug']; } diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index 4432c5045..6e0e80093 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -25,7 +25,7 @@ class ThirdPartyRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(protected EngineInterface $engine, protected TranslatableStringHelper $translatableStringHelper) + public function __construct(protected \Twig\Environment $engine, protected TranslatableStringHelper $translatableStringHelper) { } diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php index 7280e7fca..dc3f32646 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Editor.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Editor.php @@ -38,7 +38,7 @@ use Twig\Environment; */ final readonly class Editor { - public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private EngineInterface $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) + public function __construct(private ConfigurationInterface $wopiConfiguration, private DiscoveryInterface $wopiDiscovery, private DocumentManagerInterface $documentManager, private \Twig\Environment $engine, private JWTTokenManagerInterface $JWTTokenManager, private NormalizerInterface $normalizer, private ResponderInterface $responder, private Security $security, private Psr17Interface $psr17, private RouterInterface $router) { } From ad72192e2431bf7abeeceb7c8e824b11bf124b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 8 Jun 2023 11:24:01 +0200 Subject: [PATCH 016/750] doc: for database printciples --- .changes/unreleased/DX-20230608-112417.yaml | 5 + .../development/database-principles.rst | 84 ++++++++++ .../development/database/table_list.csv | 155 ++++++++++++++++++ docs/source/development/index.rst | 1 + 4 files changed, 245 insertions(+) create mode 100644 .changes/unreleased/DX-20230608-112417.yaml create mode 100644 docs/source/development/database-principles.rst create mode 100644 docs/source/development/database/table_list.csv diff --git a/.changes/unreleased/DX-20230608-112417.yaml b/.changes/unreleased/DX-20230608-112417.yaml new file mode 100644 index 000000000..7091808ec --- /dev/null +++ b/.changes/unreleased/DX-20230608-112417.yaml @@ -0,0 +1,5 @@ +kind: DX +body: Documentation for database principles +time: 2023-06-08T11:24:17.701892874+02:00 +custom: + Issue: "" diff --git a/docs/source/development/database-principles.rst b/docs/source/development/database-principles.rst new file mode 100644 index 000000000..0b4a33f04 --- /dev/null +++ b/docs/source/development/database-principles.rst @@ -0,0 +1,84 @@ + +.. database-principles: + +Principes de la base de données +############################### + +Cette page donne une compréhension globale de la base de donnée de Chill, et explique quelques détails d'implémentations qui permettent d'accélérer les traitements à partir de la base de donnée, ou de l'exploiter plus aisément. + +Cette page est rédigée en français. + +.. note:: + + La stabilité du schéma de la base de donnée n'est pas garantie. + + Toutefois, ce dernier évolue relativement peu. Il est rare que des tables ou des colonnes soient supprimées ou renommées. Mais il n'est pas garanti que cela puisse arriver. + +Généralités +=========== + +Une liste commentée de toutes les tables :download:`est disponible au format CSV <./database/table_list.csv`. + +Schéma et conventions de nommage +-------------------------------- + +Au début de l'histoire de Chill, les schémas postgresql n'étaient pas exploités. Les données étaient stockées dans le schéma :code:`public`. + +Par la suite, des nouveaux bundles sont apparus, et les tables ont été classées dans des schémas dédiés. + +A l'heure actuelle: + +- pour les anciens bundle, ceux qui ont déjà des tables dans le schéma public, les nouvelles tables sont ajoutées à ce schéma. Elles sont préfixées par :code:`chill__`; +- pour les bundles plus récents, les tables sont créées dans le schéma dédié + +Données avec de l'historicité +----------------------------- + +Certaines données sont historisées: + +- les référents d'un parcours; +- les statuts d'un parcours; +- la liaison entre les centres et les usagers; +- etc. + +Dans ces cas-là, Chill crée généralement deux colonnes, qui sont habituellement nommées :code:`startDate` et :code:`endDate`. Lorsque la colonne :code:`endDate` est à :code:`NULL`, cela signifie que la période n'est pas "fermée". La colonne :code:`startDate` n'est pas nullable. + +Dans certains cas, la donnée actuelle (référent d'un parcours, par exemple) est également répétée au niveau de la table en elle-même. Par exemple, la table des parcours :code:`chill_person_accompanying_period` comporte une colonne :code:`step` (le statut du parcours) et :code:`user_id` (id du référent) en plus de l'historique. Bien que redondant, cela simplifie les traitements. + +Relations particulières +======================= + +Usagers, ménages, adresses +-------------------------- + +Les usagers ont une adresse au travers des ménages: dans l'interface, l'adresse est inscrite dans le dossier du ménage, et elle est "donnée" aux usagers membres du ménage, **et** qui partagent l'adresse de ce ménage. En effet, il est possible que des usagers "appartiennent" à un ménage sans y être domicilié: c'est le cas, par exemple, des enfants en garde alternée. + +L'historique de l'appartenance des usagers au ménage est conservée, de même que l'historique des adresses pour un même ménage. + +Les tables en jeu sont les suivantes: + +- la table :code:`chill_person_person` liste les usagers; +- la table :code:`chill_person_household_members` liste les appartenances au ménage: il s'agit de la jointure entre les usagers et les ménages: + - les colonnes :code:`startDate` et :code:`endDate` indiquent la date de début et la date de fin de l'appartenance; + - la colonne :code:`shareHousehold` indique si l'utilisateur partage l'adresse du ménage (si oui, sa valeur est :code:`TRUE`) +- la table :code:`chill_person_household` liste les ménages +- la table :code:`chill_person_household_to_addresses` associe les ménages aux adresses; +- la table :code:`chill_main_address` contient les adresses, en indiquant la date de début de validité (:code:`validFrom`) et la fin de validité (:code:`validTo`). + +Pour simplifier la résolution des adresses et des usagers, deux vues ont été mises en œuvre: + +- la vue :code:`view_chill_person_household_address` reprend, pour chaque usager, l'historique des appartenances au ménage découpée par l'historique des adresses d'un ménage. + Autrement dit, une ligne est créée à chaque fois qu'un usager change de ménage, ou qu'un ménage change d'adresse. Il est donc possible de retrouver l'historique complet des adresses pour un usager donné via cette table. +- la vue :code:`view_chill_person_current_address` reprend l'adresse actuelle des usagers. + +Adresses et unités géographiques +-------------------------------- + +Chill propose des statistiques sur la localisation des adresses par rapport à des zones géographiques (:code:`chill_main_geographical_unit`). + +Comme la résolution géographique des adresses est coûteuse en CPU et en temps de traitement, une vue matérialisée a été créée: :code:`view_chill_main_address_geographical_unit`. Elle est rafraichie quotidiennement dans la base de donnée de production. + +Liste des tables et commentaires +================================ + + diff --git a/docs/source/development/database/table_list.csv b/docs/source/development/database/table_list.csv new file mode 100644 index 000000000..fe688318d --- /dev/null +++ b/docs/source/development/database/table_list.csv @@ -0,0 +1,155 @@ +order,table_schema,table_name,commentaire +1,chill_3party,party_category,Catégorie de tiers +2,chill_3party,party_center,Association entre les tiers et les centres (déprécié) +3,chill_3party,party_profession,Profession du tiers (déprécié) +4,chill_3party,third_party,Tiers +5,chill_3party,thirdparty_category,association tiers - catégories +6,chill_asideactivity,asideactivity,Activités annexes +7,chill_asideactivity,asideactivitycategory,Catégories d'activités annexes +8,chill_budget,charge,Charges du budget +9,chill_budget,charge_type,Types de charges +10,chill_budget,resource,Ressources du budget +11,chill_budget,resource_type,Types de ressources +12,chill_calendar,calendar,Rendez-vous +13,chill_calendar,calendar_doc,Document du rendez-vous +14,chill_calendar,calendar_range,Plage de disponibilité +15,chill_calendar,calendar_to_persons,association rendez-vous - usagers +16,chill_calendar,calendar_to_thirdparties,association rendez-vous - tiers +17,chill_calendar,cancel_reason,Motifs d'annulations +18,chill_calendar,invite,Invitation aux rendez-vous +19,chill_doc,accompanyingcourse_document,Documents associés aux parcours +20,chill_doc,document_category,Catégories de documents +21,chill_doc,person_document,Documents associés à l'usagers +22,chill_doc,stored_object,Documents +23,chill_task,recurring_task,Tâches récurrentes (non utilisé) +24,chill_task,single_task,Tâches +25,chill_task,single_task_place_event,Historique des transitions des tâches +26,chill_vendee,adressederelais, +27,chill_vendee,center_polygon +28,chill_vendee,entourage, +29,chill_vendee,geographical_unit +30,chill_vendee,geographical_unit_association +31,chill_vendee,mobilite +32,chill_vendee,niveauetude +33,chill_vendee,security_profile +34,chill_vendee,security_profile_action +35,chill_vendee,security_profile_jobs +36,chill_vendee,situationprofessionelle +37,chill_vendee,statutlogement +38,chill_vendee,tempsdetravail +39,chill_vendee,titredesejour +40,chill_vendee,vendee_person +41,chill_vendee,vendee_person_mineur +42,chill_vendee,vendeeperson_entourage +43,chill_vendee,vendeepersonmineur_adressederelais +44,public,accompanying_periods_scopes,Services associés aux parcours +45,public,activity,Échanges +46,public,activity_activityreason,s +47,public,activity_person, +48,public,activity_storedobject, +49,public,activity_thirdparty, +50,public,activity_user, +51,public,activityreason,Sujets d'échange +52,public,activityreasoncategory,Catégories de sujets +53,public,activitytpresence,Présence aux échanges +54,public,activitytype,Types d'échanges +55,public,activitytypecategory,Catégories de types d'échanges +56,public,centers,"Centres (territoires, agences, etc.)" +57,public,chill_activity_activity_chill_person_socialaction, +58,public,chill_activity_activity_chill_person_socialissue +59,public,chill_docgen_template,Gabarits de documents +60,public,chill_main_address,Adresses +61,public,chill_main_address_legacy,Anciennes adresses (dépréciés) +62,public,chill_main_address_reference,Adresses de référence +63,public,chill_main_civility,Civilités +64,public,chill_main_cronjob_execution,Dernière exécution des tâche cron +65,public,chill_main_geographical_unit,Unités géographiques +66,public,chill_main_geographical_unit_layer,Couches d'unités géographiques +67,public,chill_main_location,Localisations +68,public,chill_main_location_type,Types de localisations +69,public,chill_main_notification,Notifications +70,public,chill_main_notification_addresses_unread +71,public,chill_main_notification_addresses_user +72,public,chill_main_notification_comment, +73,public,chill_main_postal_code,Code postaux +74,public,chill_main_saved_export,Exports enregistrés +75,public,chill_main_user_job,Métiers +76,public,chill_main_workflow_entity,Workflows +77,public,chill_main_workflow_entity_comment +78,public,chill_main_workflow_entity_step,Etapes du workflow +79,public,chill_main_workflow_entity_step_cc_user, +80,public,chill_main_workflow_entity_step_user +81,public,chill_main_workflow_entity_step_user_by_accesskey, +82,public,chill_main_workflow_entity_subscriber_to_final, +83,public,chill_main_workflow_entity_subscriber_to_step +84,public,chill_person_accompanying_period,Parcours d'accompagnement +85,public,chill_person_accompanying_period_closingmotive,Motifs de cloture des parcours +86,public,chill_person_accompanying_period_comment,Commentaires des parcours +87,public,chill_person_accompanying_period_location_history,Historique de la localisatio ndes parcours +88,public,chill_person_accompanying_period_origin,Origine des parcours +89,public,chill_person_accompanying_period_participation,Appartenance des usagers au parcours +90,public,chill_person_accompanying_period_resource,Personnes ressources d'un parcours +91,public,chill_person_accompanying_period_social_issues, +92,public,chill_person_accompanying_period_step_history +93,public,chill_person_accompanying_period_user_history +94,public,chill_person_accompanying_period_work,Actions d'accompagnements +95,public,chill_person_accompanying_period_work_evaluation,Évaluations (dans les actions d'accompagnements) +96,public,chill_person_accompanying_period_work_evaluation_document,Documents des évaluations +97,public,chill_person_accompanying_period_work_goal,Objectifs d'une actions +98,public,chill_person_accompanying_period_work_goal_result,Objectifs et résultats d'une action +99,public,chill_person_accompanying_period_work_person,Usagers associés à une actions +100,public,chill_person_accompanying_period_work_referrer,Référents d'une actions +101,public,chill_person_accompanying_period_work_result,Résultats d'une action +102,public,chill_person_accompanying_period_work_third_party,Tiers traitants d'une action +103,public,chill_person_alt_name,"Noms supplémentaires d'un usager (nom marital, etc.)" +104,public,chill_person_household,Ménages +105,public,chill_person_household_composition, +106,public,chill_person_household_composition_type,Types de composition de ménage +107,public,chill_person_household_members,Membres du ménages +108,public,chill_person_household_position,Positions dans le ménage +109,public,chill_person_household_to_addresses,Association adresses - ménages +110,public,chill_person_marital_status,Etats civils +111,public,chill_person_not_duplicate, +112,public,chill_person_person,Usagers +113,public,chill_person_person_center_history,Historique des centres d'un usagers +114,public,chill_person_persons_to_addresses,Déprécié +115,public,chill_person_phone,Numéros d etéléphone supplémentaires d'un usager +116,public,chill_person_relations,Types de relations de filiation +117,public,chill_person_relationships,Relations de filiations +118,public,chill_person_residential_address,Adresses de résidences +119,public,chill_person_resource,Personnes ressources (pour les personnes) +120,public,chill_person_resource_kind,Type de personnes ressources +121,public,chill_person_social_action,Liste des actions d'accompagnement +122,public,chill_person_social_action_goal,Objectifs associés à une action +123,public,chill_person_social_action_result,Résultats associés à une action +124,public,chill_person_social_issue,Problématiques sociales +125,public,chill_person_social_work_evaluation,Evaluations disponibles +126,public,chill_person_social_work_evaluation_action,Associations entre les évaluations et les actions +127,public,chill_person_social_work_goal,Objectifs disponibles pour une actions +128,public,chill_person_social_work_goal_result,Objectifs et résultats disponible pour une action +129,public,chill_person_social_work_result,Résultats disponibles pour une action +130,public,country,Pays +131,public,custom_field_long_choice_options, +132,public,customfield +133,public,customfieldsdefaultgroup +134,public,customfieldsgroup +135,public,geography_columns,Table liée à postgis +136,public,geometry_columns,Table liée à postgis +137,public,group_centers, +138,public,language,Langues +139,public,messenger_messages,Table système +140,public,migration_versions,Table système +141,public,permission_groups +142,public,permissionsgroup_rolescope +143,public,persons_spoken_languages +144,public,regroupment,Regroupement de centres +145,public,regroupment_center, +146,public,role_scopes, +147,public,scopes,Services +148,public,spatial_ref_sys,Table système (postgis) +149,public,user_groupcenter, +150,public,users,Utilisateurs +151,public,view_chill_person_accompanying_period_info, +152,public,view_chill_person_current_address +153,public,view_chill_person_household_address +154,public,view_chill_person_person_center_history_current diff --git a/docs/source/development/index.rst b/docs/source/development/index.rst index fd9ae43ba..768d29ce0 100644 --- a/docs/source/development/index.rst +++ b/docs/source/development/index.rst @@ -36,6 +36,7 @@ As Chill rely on the `symfony `_ framework, reading the fram Assets Cron Jobs Info about entities + Info about database (in French) Layout and UI ************** From 659dff3d2c310951bf3a0dce6474ed375e4d5b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 23 Jun 2023 12:19:40 +0200 Subject: [PATCH 017/750] DX: Add features to filterOrder Allow to add single checkboxes and entitychoices to filter order --- .changes/unreleased/DX-20230623-122408.yaml | 5 ++ .../Form/Type/Listing/FilterOrderType.php | 54 ++++++------- .../views/FilterOrder/base.html.twig | 50 ++++++++++-- .../Templating/Listing/FilterOrderHelper.php | 76 +++++++++++++++++-- .../Listing/FilterOrderHelperBuilder.php | 39 ++++++++++ .../Templating/Listing/Templating.php | 39 +++++++++- 6 files changed, 224 insertions(+), 39 deletions(-) create mode 100644 .changes/unreleased/DX-20230623-122408.yaml diff --git a/.changes/unreleased/DX-20230623-122408.yaml b/.changes/unreleased/DX-20230623-122408.yaml new file mode 100644 index 000000000..58dd96180 --- /dev/null +++ b/.changes/unreleased/DX-20230623-122408.yaml @@ -0,0 +1,5 @@ +kind: DX +body: '[FilterOrderHelper] add entity choice and singleCheckbox' +time: 2023-06-23T12:24:08.133491895+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index aaa6afa24..16038515d 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -13,6 +13,8 @@ namespace Chill\MainBundle\Form\Type\Listing; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SearchType; @@ -27,13 +29,6 @@ use function count; final class FilterOrderType extends \Symfony\Component\Form\AbstractType { - private RequestStack $requestStack; - - public function __construct(RequestStack $requestStack) - { - $this->requestStack = $requestStack; - } - public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FilterOrderHelper $helper */ @@ -71,6 +66,25 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $builder->add($checkboxesBuilder); } + if ([] !== $helper->getEntityChoices()) { + $entityChoicesBuilder = $builder->create('entity_choices', null, ['compound' => true]); + + foreach ($helper->getEntityChoices() as $key => [ + 'label' => $label, 'choices' => $choices, 'options' => $opts, 'class' => $class + ]) { + $entityChoicesBuilder->add($key, EntityType::class, [ + 'label' => $label, + 'choices' => $choices, + 'class' => $class, + 'multiple' => true, + 'expanded' => true, + ...$opts, + ]); + } + + $builder->add($entityChoicesBuilder); + } + if (0 < count($helper->getDateRanges())) { $dateRangesBuilder = $builder->create('dateRanges', null, ['compound' => true]); @@ -97,28 +111,14 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $builder->add($dateRangesBuilder); } - foreach ($this->requestStack->getCurrentRequest()->query->getIterator() as $key => $value) { - switch ($key) { - case 'q': - case 'checkboxes' . $key: - case $key . '_from': - case $key . '_to': - break; + if ([] !== $helper->getSingleCheckbox()) { + $singleCheckBoxBuilder = $builder->create('single_checkboxes', null, ['compound' => true]); - case 'page': - $builder->add($key, HiddenType::class, [ - 'data' => 1, - ]); - - break; - - default: - $builder->add($key, HiddenType::class, [ - 'data' => $value, - ]); - - break; + foreach ($helper->getSingleCheckbox() as $name => ['label' => $label]) { + $singleCheckBoxBuilder->add($name, CheckboxType::class, ['label' => $label, 'required' => false]); } + + $builder->add($singleCheckBoxBuilder); } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index 1f1e54c72..d4a6bbdd4 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -13,13 +13,13 @@ {% if form.dateRanges is defined %} {% if form.dateRanges|length > 0 %} {% for dateRangeName, _o in form.dateRanges %} -
+
{% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} -
+
{{ form_label(form.dateRanges[dateRangeName])}}
{% endif %} -
+
{{ 'chill_calendar.From'|trans }} {{ form_widget(form.dateRanges[dateRangeName]['from']) }} @@ -27,7 +27,7 @@ {{ form_widget(form.dateRanges[dateRangeName]['to']) }}
-
+
@@ -37,7 +37,7 @@ {% if form.checkboxes is defined %} {% if form.checkboxes|length > 0 %} {% for checkbox_name, options in form.checkboxes %} -
+
{% for c in form['checkboxes'][checkbox_name].children %}
@@ -61,5 +61,45 @@ {% endfor %} {% endif %} {% endif %} + {% if form.entity_choices is defined %} + {% if form.entity_choices |length > 0 %} + {% for checkbox_name, options in form.entity_choices %} +
+ {% if form.entity_choices[checkbox_name].vars.label is not same as(false) %} +
+ {{ form_label(form.entity_choices[checkbox_name])}} +
+ {% endif %} +
+ {% for c in form['entity_choices'][checkbox_name].children %} +
+ {{ form_widget(c) }} + {{ form_label(c) }} +
+ {% endfor %} +
+
+ +
+
+ {% endfor %} + {% endif %} + {% endif %} + {% if form.single_checkboxes is defined %} + {% for name, _o in form.single_checkboxes %} +
+
+ {{ form_widget(form.single_checkboxes[name]) }} +
+
+ +
+
+ {% endfor %} + {% endif %}
+ + {% for k,v in otherParameters %} + + {% endfor %} {{ form_end(form) }} diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 367cc0861..28cc8e331 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -13,6 +13,8 @@ namespace Chill\MainBundle\Templating\Listing; use Chill\MainBundle\Form\Type\Listing\FilterOrderType; use DateTimeImmutable; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RequestStack; @@ -24,11 +26,16 @@ class FilterOrderHelper { private array $checkboxes = []; + /** + * @var array + */ + private array $singleCheckbox = []; + private array $dateRanges = []; private FormFactoryInterface $formFactory; - private ?string $formName = 'f'; + public const FORM_NAME = 'f'; private array $formOptions = []; @@ -40,6 +47,11 @@ class FilterOrderHelper private ?array $submitted = null; + /** + * @var array + */ + private array $entityChoices = []; + public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack @@ -48,7 +60,29 @@ class FilterOrderHelper $this->requestStack = $requestStack; } - public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = []): self + public function addSingleCheckbox(string $name, string $label): self + { + $this->singleCheckbox[$name] = ['label' => $label]; + + return $this; + } + + /** + * @param class-string $class + */ + public function addEntityChoice(string $name, string $class, string $label, array $choices, array $options = []): self + { + $this->entityChoices[$name] = ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options]; + + return $this; + } + + public function getEntityChoices(): array + { + return $this->entityChoices; + } + + public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = [], array $options = []): self { $missing = count($choices) - count($trans) - 1; $this->checkboxes[$name] = [ @@ -58,6 +92,7 @@ class FilterOrderHelper 0 < $missing ? array_fill(0, $missing, null) : [] ), + ...$options, ]; return $this; @@ -73,7 +108,7 @@ class FilterOrderHelper public function buildForm(): FormInterface { return $this->formFactory - ->createNamed($this->formName, $this->formType, $this->getDefaultData(), array_merge([ + ->createNamed(self::FORM_NAME, $this->formType, $this->getDefaultData(), array_merge([ 'helper' => $this, 'method' => 'GET', 'csrf_protection' => false, @@ -86,13 +121,31 @@ class FilterOrderHelper return $this->getFormData()['checkboxes'][$name]; } + public function getSingleCheckboxData(string $name): ?bool + { + return $this->getFormData()['single_checkboxes'][$name]; + } + + public function getEntityChoiceData($name): mixed + { + return $this->getFormData()['entity_choices'][$name]; + } + public function getCheckboxes(): array { return $this->checkboxes; } /** - * @return array<'to': DateTimeImmutable, 'from': DateTimeImmutable> + * @return array + */ + public function getSingleCheckbox(): array + { + return $this->singleCheckbox; + } + + /** + * @return array{to: ?DateTimeImmutable, from: ?DateTimeImmutable} */ public function getDateRangeData(string $name): array { @@ -123,7 +176,12 @@ class FilterOrderHelper private function getDefaultData(): array { - $r = []; + $r = [ + 'checkboxes' => [], + 'dateRanges' => [], + 'single_checkboxes' => [], + 'entity_choices' => [] + ]; if ($this->hasSearchBox()) { $r['q'] = ''; @@ -138,6 +196,14 @@ class FilterOrderHelper $r['dateRanges'][$name]['to'] = $defaults['to']; } + foreach ($this->singleCheckbox as $name => $c) { + $r['single_checkboxes'][$name] = false; + } + + foreach ($this->entityChoices as $name => $c) { + $r['entity_choices'][$name] = ($c['options']['multiple'] ?? true) ? [] : null; + } + return $r; } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index d68c8c37a..e176e27c6 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -27,6 +27,16 @@ class FilterOrderHelperBuilder private ?array $searchBoxFields = null; + /** + * @var array + */ + private array $singleCheckboxes = []; + + /** + * @var array + */ + private array $entityChoices = []; + public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack @@ -35,6 +45,13 @@ class FilterOrderHelperBuilder $this->requestStack = $requestStack; } + public function addSingleCheckbox(string $name, string $label): self + { + $this->singleCheckboxes[$name] = ['label' => $label]; + + return $this; + } + public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = []): self { $this->checkboxes[$name] = ['choices' => $choices, 'default' => $default, 'trans' => $trans]; @@ -42,6 +59,16 @@ class FilterOrderHelperBuilder return $this; } + /** + * @param class-string $class + */ + public function addEntityChoice(string $name, string $label, string $class, array $choices, ?array $options = []): self + { + $this->entityChoices[$name] = ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options]; + + return $this; + } + public function addDateRange(string $name, ?string $label = null, ?DateTimeImmutable $from = null, ?DateTimeImmutable $to = null): self { $this->dateRanges[$name] = ['from' => $from, 'to' => $to, 'label' => $label]; @@ -75,6 +102,18 @@ class FilterOrderHelperBuilder $helper->addCheckbox($name, $choices, $default, $trans); } + foreach ( + $this->singleCheckboxes as $name => ['label' => $label] + ) { + $helper->addSingleCheckbox($name, $label); + } + + foreach ( + $this->entityChoices as $name => ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options] + ) { + $helper->addEntityChoice($name, $class, $label, $choices, $options); + } + foreach ( $this->dateRanges as $name => [ 'from' => $from, diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index bc256e24f..b91cd86e8 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -11,13 +11,23 @@ declare(strict_types=1); namespace Chill\MainBundle\Templating\Listing; +use Chill\MainBundle\Pagination\PaginatorFactory; +use Symfony\Component\HttpFoundation\RequestStack; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; class Templating extends AbstractExtension { - public function getFilters() + public function __construct( + private readonly RequestStack $requestStack, + ) { + } + + public function getFilters(): array { return [ new TwigFilter('chill_render_filter_order_helper', [$this, 'renderFilterOrderHelper'], [ @@ -26,16 +36,41 @@ class Templating extends AbstractExtension ]; } + /** + * @throws SyntaxError + * @throws RuntimeError + * @throws LoaderError + */ public function renderFilterOrderHelper( Environment $environment, FilterOrderHelper $helper, ?string $template = '@ChillMain/FilterOrder/base.html.twig', ?array $options = [] - ) { + ): string { + $otherParameters = []; + + foreach ($this->requestStack->getCurrentRequest()->query->getIterator() as $key => $value) { + switch ($key) { + case FilterOrderHelper::FORM_NAME: + break; + + case PaginatorFactory::DEFAULT_CURRENT_PAGE_KEY: + // when filtering, go back to page 1 + $otherParameters[PaginatorFactory::DEFAULT_CURRENT_PAGE_KEY] = 1; + + break; + default: + $otherParameters[$key] = $value; + + break; + } + } + return $environment->render($template, [ 'helper' => $helper, 'form' => $helper->buildForm()->createView(), 'options' => $options, + 'otherParameters' => $otherParameters, ]); } } From 51544cfc48418e3492d43b232081efabf5d1772e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 23 Jun 2023 12:21:13 +0200 Subject: [PATCH 018/750] DX: improve typing of a property in UserJob --- src/Bundle/ChillMainBundle/Entity/UserJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php index ed8bc43f3..c6bfe1aa3 100644 --- a/src/Bundle/ChillMainBundle/Entity/UserJob.php +++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php @@ -37,7 +37,7 @@ class UserJob protected ?int $id = null; /** - * @var array|string[]A + * @var array * @ORM\Column(name="label", type="json") * @Serializer\Groups({"read", "docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) From f7c11d356737351d7fda548b3bb5d0acc7b0fac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 23 Jun 2023 12:22:24 +0200 Subject: [PATCH 019/750] Feature: Add filters on activity list --- .../unreleased/Feature-20230623-122530.yaml | 5 + .../unreleased/Feature-20230623-122702.yaml | 6 + .../Controller/ActivityController.php | 138 ++++---- .../Repository/ActivityACLAwareRepository.php | 240 ++++++++++--- .../ActivityACLAwareRepositoryInterface.php | 36 +- .../Repository/ActivityTypeRepository.php | 4 + .../ActivityTypeRepositoryInterface.php | 4 +- .../Resources/views/Activity/list.html.twig | 3 + .../ActivityACLAwareRepositoryTest.php | 325 ++++++++++++++++++ .../translations/messages.fr.yml | 8 + 10 files changed, 648 insertions(+), 121 deletions(-) create mode 100644 .changes/unreleased/Feature-20230623-122530.yaml create mode 100644 .changes/unreleased/Feature-20230623-122702.yaml create mode 100644 src/Bundle/ChillActivityBundle/Tests/Repository/ActivityACLAwareRepositoryTest.php diff --git a/.changes/unreleased/Feature-20230623-122530.yaml b/.changes/unreleased/Feature-20230623-122530.yaml new file mode 100644 index 000000000..922750ea8 --- /dev/null +++ b/.changes/unreleased/Feature-20230623-122530.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[activity list] add filtering for activities list' +time: 2023-06-23T12:25:30.49643551+02:00 +custom: + Issue: "" diff --git a/.changes/unreleased/Feature-20230623-122702.yaml b/.changes/unreleased/Feature-20230623-122702.yaml new file mode 100644 index 000000000..e1d1b0e1f --- /dev/null +++ b/.changes/unreleased/Feature-20230623-122702.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: '[activity list] in person context, show also the activities from the accompanying + periods where the person participates' +time: 2023-06-23T12:27:02.159041095+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 444c663fc..07e4fcf62 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -18,11 +18,16 @@ use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Repository\ActivityTypeCategoryRepository; use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface; +use Chill\ActivityBundle\Repository\ActivityUserJobRepository; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; +use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Repository\LocationRepository; use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; +use Chill\MainBundle\Templating\Listing\FilterOrderHelper; +use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; +use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Privacy\PrivacyEvent; @@ -47,68 +52,25 @@ use function array_key_exists; final class ActivityController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; - - private ActivityACLAwareRepositoryInterface $activityACLAwareRepository; - - private ActivityRepository $activityRepository; - - private ActivityTypeCategoryRepository $activityTypeCategoryRepository; - - private ActivityTypeRepositoryInterface $activityTypeRepository; - - private CenterResolverManagerInterface $centerResolver; - - private EntityManagerInterface $entityManager; - - private EventDispatcherInterface $eventDispatcher; - - private LocationRepository $locationRepository; - - private LoggerInterface $logger; - - private PersonRepository $personRepository; - - private SerializerInterface $serializer; - - private ThirdPartyRepository $thirdPartyRepository; - - private TranslatorInterface $translator; - - private UserRepositoryInterface $userRepository; - public function __construct( - ActivityACLAwareRepositoryInterface $activityACLAwareRepository, - ActivityTypeRepositoryInterface $activityTypeRepository, - ActivityTypeCategoryRepository $activityTypeCategoryRepository, - PersonRepository $personRepository, - ThirdPartyRepository $thirdPartyRepository, - LocationRepository $locationRepository, - ActivityRepository $activityRepository, - AccompanyingPeriodRepository $accompanyingPeriodRepository, - EntityManagerInterface $entityManager, - EventDispatcherInterface $eventDispatcher, - LoggerInterface $logger, - SerializerInterface $serializer, - UserRepositoryInterface $userRepository, - CenterResolverManagerInterface $centerResolver, - TranslatorInterface $translator + private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository, + private readonly ActivityTypeRepositoryInterface $activityTypeRepository, + private readonly ActivityTypeCategoryRepository $activityTypeCategoryRepository, + private readonly PersonRepository $personRepository, + private readonly ThirdPartyRepository $thirdPartyRepository, + private readonly LocationRepository $locationRepository, + private readonly ActivityRepository $activityRepository, + private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, + private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly LoggerInterface $logger, + private readonly SerializerInterface $serializer, + private readonly UserRepositoryInterface $userRepository, + private readonly CenterResolverManagerInterface $centerResolver, + private readonly TranslatorInterface $translator, + private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, + private readonly TranslatableStringHelperInterface $translatableStringHelper, ) { - $this->activityACLAwareRepository = $activityACLAwareRepository; - $this->activityTypeRepository = $activityTypeRepository; - $this->activityTypeCategoryRepository = $activityTypeCategoryRepository; - $this->personRepository = $personRepository; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->locationRepository = $locationRepository; - $this->activityRepository = $activityRepository; - $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; - $this->entityManager = $entityManager; - $this->eventDispatcher = $eventDispatcher; - $this->logger = $logger; - $this->serializer = $serializer; - $this->userRepository = $userRepository; - $this->centerResolver = $centerResolver; - $this->translator = $translator; } /** @@ -292,11 +254,27 @@ final class ActivityController extends AbstractController // TODO: add pagination [$person, $accompanyingPeriod] = $this->getEntity($request); + $filter = $this->buildFilterOrder($person ?? $accompanyingPeriod); + + $filterArgs = [ + 'my_activities' => $filter->getSingleCheckboxData('my_activities'), + 'types' => $filter->getEntityChoiceData('activity_types'), + 'jobs' => $filter->getEntityChoiceData('jobs'), + 'before' => $filter->getDateRangeData('activity_date')['to'], + 'after' => $filter->getDateRangeData('activity_date')['from'], + ]; if ($person instanceof Person) { $this->denyAccessUnlessGranted(ActivityVoter::SEE, $person); $activities = $this->activityACLAwareRepository - ->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); + ->findByPerson( + $person, + ActivityVoter::SEE, + 0, + null, + ['date' => 'DESC', 'id' => 'DESC'], + $filterArgs + ); $event = new PrivacyEvent($person, [ 'element_class' => Activity::class, @@ -309,7 +287,14 @@ final class ActivityController extends AbstractController $this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod); $activities = $this->activityACLAwareRepository - ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); + ->findByAccompanyingPeriod( + $accompanyingPeriod, + ActivityVoter::SEE, + 0, + null, + ['date' => 'DESC', 'id' => 'DESC'], + $filterArgs + ); $view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig'; } @@ -320,10 +305,39 @@ final class ActivityController extends AbstractController 'activities' => $activities, 'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, + 'filter' => $filter, ] ); } + private function buildFilterOrder(AccompanyingPeriod|Person $associated): FilterOrderHelper + { + + $filterBuilder = $this->filterOrderHelperFactory->create(self::class); + $types = $this->activityACLAwareRepository->findActivityTypeByAssociated($associated); + $jobs = $this->activityACLAwareRepository->findUserJobByAssociated($associated); + + $filterBuilder + ->addDateRange('activity_date', 'activity.date') + ->addSingleCheckbox('my_activities', 'activity_filter.My activities') + ->addEntityChoice('activity_types', 'activity_filter.Types', \Chill\ActivityBundle\Entity\ActivityType::class, $types, [ + 'choice_label' => function (\Chill\ActivityBundle\Entity\ActivityType $activityType) { + $text = match ($activityType->hasCategory()) { + true => $this->translatableStringHelper->localize($activityType->getCategory()->getName()) . ' > ', + false => '', + }; + + return $text . $this->translatableStringHelper->localize($activityType->getName()); + } + ]) + ->addEntityChoice('jobs', 'activity_filter.Jobs', UserJob::class, $jobs, [ + 'choice_label' => fn (UserJob $u) => $this->translatableStringHelper->localize($u->getLabel()) + ]) + ; + + return $filterBuilder->build(); + } + public function newAction(Request $request): Response { $view = null; diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 1f2039a2c..1fd0a57d6 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -18,67 +18,159 @@ use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\LocationType; use Chill\MainBundle\Entity\Scope; -use Chill\MainBundle\Security\Authorization\AuthorizationHelper; -use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface; +use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Entity\UserJob; +use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface; +use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\ResultSetMappingBuilder; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Security\Core\Role\Role; +use Doctrine\ORM\QueryBuilder; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Security\Core\Security; use function count; use function in_array; -final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface +final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface { - private AuthorizationHelper $authorizationHelper; - - private CenterResolverDispatcherInterface $centerResolverDispatcher; - - private EntityManagerInterface $em; - - private ActivityRepository $repository; - - private Security $security; - - private TokenStorageInterface $tokenStorage; - public function __construct( - AuthorizationHelper $authorizationHelper, - CenterResolverDispatcherInterface $centerResolverDispatcher, - TokenStorageInterface $tokenStorage, - ActivityRepository $repository, - EntityManagerInterface $em, - Security $security + private AuthorizationHelperForCurrentUserInterface $authorizationHelper, + private CenterResolverManagerInterface $centerResolverManager, + private ActivityRepository $repository, + private EntityManagerInterface $em, + private Security $security, + private RequestStack $requestStack, ) { - $this->authorizationHelper = $authorizationHelper; - $this->centerResolverDispatcher = $centerResolverDispatcher; - $this->tokenStorage = $tokenStorage; - $this->repository = $repository; - $this->em = $em; - $this->security = $security; } - public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array + public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array { - $user = $this->security->getUser(); - $center = $this->centerResolverDispatcher->resolveCenter($period); + $qb = $this->buildBaseQuery($filters); - if (0 === count($orderBy)) { - $orderBy = ['date' => 'DESC']; + $qb->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $period); + + foreach ($orderBy as $field => $order) { + $qb->addOrderBy('a.' . $field, $order); } - $scopes = $this->authorizationHelper - ->getReachableCircles($user, $role, $center); + $qb->setFirstResult(0)->setMaxResults(1000); - return $this->em->getRepository(Activity::class) - ->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy); + return $qb->getQuery()->getResult(); } + public function buildBaseQuery(array $filters): QueryBuilder + { + $qb = $this->repository + ->createQueryBuilder('a') + ; + + if (($filters['my_activities'] ?? false) and ($user = $this->security->getUser()) instanceof User) { + $qb->andWhere( + $qb->expr()->orX( + 'a.createdBy = :user', + 'a.user = :user', + ':user MEMBER OF a.users' + ) + )->setParameter('user', $user); + } + + if ([] !== ($types = $filters['types'] ?? [])) { + $qb->andWhere('a.activityType IN (:types)')->setParameter('types', $types); + } + + if ([] !== ($jobs = $filters['jobs'] ?? [])) { + $qb + ->leftJoin('a.createdBy', 'creator') + ->leftJoin('a.user', 'activity_u') + ->andWhere( + $qb->expr()->orX( + 'creator.userJob IN (:jobs)', + 'activity_u.userJob IN (:jobs)', + 'EXISTS (SELECT 1 FROM ' . User::class . ' activity_user WHERE activity_user MEMBER OF a.users AND activity_user.userJob IN (:jobs))' + ) + ) + ->setParameter('jobs', $jobs); + } + + if (null !== ($after = $filters['after'] ?? null)) { + $qb->andWhere('a.date >= :after')->setParameter('after', $after); + } + + if (null !== ($before = $filters['before'] ?? null)) { + $qb->andWhere('a.date <= :before')->setParameter('before', $before); + } + + return $qb; + } + + /** + * @param AccompanyingPeriod|Person $associated + * @return array + */ + public function findActivityTypeByAssociated(AccompanyingPeriod|Person $associated): array + { + $in = $this->em->createQueryBuilder(); + $in + ->select('1') + ->from(Activity::class, 'a'); + + if ($associated instanceof Person) { + $in = $this->filterBaseQueryByPerson($in, $associated, ActivityVoter::SEE); + } else { + $in->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $associated); + } + + // join between the embedded exist query and the main query + $in->andWhere('a.activityType = t'); + + $qb = $this->em->createQueryBuilder()->setParameters($in->getParameters()); + $qb + ->select('t') + ->from(ActivityType::class, 't') + ->where( + $qb->expr()->exists($in->getDQL()) + ); + + return $qb->getQuery()->getResult(); + } + + public function findUserJobByAssociated(Person|AccompanyingPeriod $associated): array + { + $in = $this->em->createQueryBuilder(); + $in->select('IDENTITY(u.userJob)') + ->from(User::class, 'u') + ->join( + Activity::class, + 'a', + Join::WITH, + 'a.createdBy = u OR a.user = u OR u MEMBER OF a.users' + ); + + if ($associated instanceof Person) { + $in = $this->filterBaseQueryByPerson($in, $associated, ActivityVoter::SEE); + } else { + $in->andWhere('a.accompanyingPeriod = :associated'); + $in->setParameter('associated', $associated); + } + + $qb = $this->em->createQueryBuilder()->setParameters($in->getParameters()); + + $qb->select('ub', 'JSON_EXTRACT(ub.label, :lang) AS HIDDEN lang') + ->from(UserJob::class, 'ub') + ->where($qb->expr()->in('ub.id', $in->getDQL())) + ->setParameter('lang', $this->requestStack->getCurrentRequest()->getLocale()) + ->orderBy('lang') + ; + + return $qb->getQuery()->getResult(); + } + + public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array { $rsm = new ResultSetMappingBuilder($this->em); @@ -159,25 +251,66 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte return $nq->getResult(AbstractQuery::HYDRATE_ARRAY); } - /** - * @param array $orderBy - * - * @return Activity[]|array - */ - public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array + public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): array { - $user = $this->security->getUser(); - $center = $this->centerResolverDispatcher->resolveCenter($person); + $qb = $this->buildBaseQuery($filters); - if (0 === count($orderBy)) { - $orderBy = ['date' => 'DESC']; + $qb = $this->filterBaseQueryByPerson($qb, $person, $role); + + foreach ($orderBy as $field => $direction) { + $qb->addOrderBy('a.' . $field, $direction); } - $reachableScopes = $this->authorizationHelper - ->getReachableCircles($user, $role, $center); + return $qb->getQuery()->getResult(); + } - return $this->em->getRepository(Activity::class) - ->findByPersonImplied($person, $reachableScopes, $orderBy, $limit, $start); + private function filterBaseQueryByPerson(QueryBuilder $qb, Person $person, string $role): QueryBuilder + { + $orX = $qb->expr()->orX(); + $counter = 0; + foreach ($this->centerResolverManager->resolveCenters($person) as $center) { + $scopes = $this->authorizationHelper->getReachableScopes($role, $center); + + if ([] === $scopes) { + continue; + } + + $orX->add(sprintf('a.person = :person AND a.scope IN (:scopes_%d)', $counter)); + $qb->setParameter(sprintf('scopes_%d', $counter), $scopes); + $qb->setParameter('person', $person); + $counter++; + } + + foreach ($person->getAccompanyingPeriodParticipations() as $participation) { + if (!$this->security->isGranted(ActivityVoter::SEE, $participation->getAccompanyingPeriod())) { + continue; + } + + $and = $qb->expr()->andX( + sprintf('a.accompanyingPeriod = :period_%d', $counter), + sprintf('a.date >= :participation_start_%d', $counter) + ); + + $qb + ->setParameter(sprintf('period_%d', $counter), $participation->getAccompanyingPeriod()) + ->setParameter(sprintf('participation_start_%d', $counter), $participation->getStartDate()); + + if (null !== $participation->getEndDate()) { + $and->add(sprintf('a.date < :participation_end_%d', $counter)); + $qb + ->setParameter(sprintf('participation_end_%d', $counter), $participation->getEndDate()); + } + $orX->add($and); + $counter++; + } + + if (0 === $orX->count()) { + $qb->andWhere('FALSE = TRUE'); + } else { + $qb->andWhere($orX); + } + + return $qb; } public function queryTimelineIndexer(string $context, array $args = []): array @@ -226,7 +359,6 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte // acls: $reachableCenters = $this->authorizationHelper->getReachableCenters( - $this->tokenStorage->getToken()->getUser(), ActivityVoter::SEE ); @@ -251,7 +383,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte continue; } // we get all the reachable scopes for this center - $reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), ActivityVoter::SEE, $center); + $reachableScopes = $this->authorizationHelper->getReachableScopes(ActivityVoter::SEE, $center); // we get the ids for those scopes $reachablesScopesId = array_map( static fn (Scope $scope) => $scope->getId(), diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php index 8cdb83524..a046ad218 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php @@ -11,15 +11,22 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Repository; +use Chill\ActivityBundle\Entity\Activity; +use Chill\ActivityBundle\Entity\ActivityType; +use Chill\MainBundle\Entity\UserJob; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; interface ActivityACLAwareRepositoryInterface { /** - * @return Activity[]|array + * Return all the activities associated to an accompanying period and that the user is allowed to apply the given role. + * + * + * @param array{my_activities?: bool, types?: array, jobs?: array, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters + * @return array */ - public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array; + public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array; /** * Return a list of activities, simplified as array (not object). @@ -31,7 +38,28 @@ interface ActivityACLAwareRepositoryInterface public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array; /** - * @return Activity[]|array + * @param array{my_activities?: bool, types?: array, jobs?: array, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters + * @return array */ - public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array; + public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array; + + + /** + * Return a list of the type for the activities associated to person or accompanying period + * + * @return array + */ + public function findActivityTypeByAssociated(AccompanyingPeriod|Person $associated): array; + + /** + * Return a list of the user job for the activities associated to person or accompanying period + * + * Associated mean the job: + * - of the creator; + * - of the user (activity.user) + * - of all the users + * + * @return array + */ + public function findUserJobByAssociated(AccompanyingPeriod|Person $associated): array; } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php index fd5d52fce..10bd1e651 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php @@ -11,9 +11,13 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Repository; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\ActivityType; +use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\Person; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query\Expr\Join; final class ActivityTypeRepository implements ActivityTypeRepositoryInterface { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepositoryInterface.php index 2148a02f5..574faea22 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepositoryInterface.php @@ -12,12 +12,14 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Repository; use Chill\ActivityBundle\Entity\ActivityType; +use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\Person; use Doctrine\Persistence\ObjectRepository; interface ActivityTypeRepositoryInterface extends ObjectRepository { /** - * @return array|ActivityType[] + * @return array */ public function findAllActive(): array; } diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index 79c946f17..17ae0598b 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -86,6 +86,9 @@

{% else %} + + {{ filter|chill_render_filter_order_helper }} +
{% for activity in activities %} {% include 'ChillActivityBundle:Activity:_list_item.html.twig' with { diff --git a/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityACLAwareRepositoryTest.php b/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityACLAwareRepositoryTest.php new file mode 100644 index 000000000..e7b2117d4 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Repository/ActivityACLAwareRepositoryTest.php @@ -0,0 +1,325 @@ +authorizationHelperForCurrentUser = self::$container->get(AuthorizationHelperForCurrentUserInterface::class); + $this->centerResolverManager = self::$container->get(CenterResolverManagerInterface::class); + $this->activityRepository = self::$container->get(ActivityRepository::class); + $this->entityManager = self::$container->get(EntityManagerInterface::class); + $this->security = self::$container->get(Security::class); + + $this->requestStack = $requestStack = new RequestStack(); + $request = $this->prophesize(Request::class); + $request->getLocale()->willReturn('fr'); + $request->getDefaultLocale()->willReturn('fr'); + $requestStack->push($request->reveal()); + } + + /** + * @dataProvider provideDataFindByAccompanyingPeriod + */ + public function testFindByAccompanyingPeriod(AccompanyingPeriod $period, User $user, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): void + { + $security = $this->prophesize(Security::class); + $security->isGranted($role, $period)->willReturn(true); + $security->getUser()->willReturn($user); + + $repository = new ActivityACLAwareRepository( + $this->authorizationHelperForCurrentUser, + $this->centerResolverManager, + $this->activityRepository, + $this->entityManager, + $security->reveal(), + $this->requestStack + ); + + $actual = $repository->findByAccompanyingPeriod($period, $role, $start, $limit, $orderBy, $filters); + + self::assertIsArray($actual); + } + + /** + * @dataProvider provideDataFindByAccompanyingPeriod + */ + public function testFindActivityTypeByAccompanyingPeriod(AccompanyingPeriod $period, User $user, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): void + { + $security = $this->prophesize(Security::class); + $security->isGranted($role, $period)->willReturn(true); + $security->getUser()->willReturn($user); + + $repository = new ActivityACLAwareRepository( + $this->authorizationHelperForCurrentUser, + $this->centerResolverManager, + $this->activityRepository, + $this->entityManager, + $security->reveal(), + $this->requestStack + ); + + $actual = $repository->findActivityTypeByAssociated($period); + + self::assertIsArray($actual); + } + + /** + * @dataProvider provideDataFindByPerson + */ + public function testFindActivityTypeByPerson(Person $person, User $user, array $centers, array $scopes, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): void + { + $role = ActivityVoter::SEE; + $centerResolver = $this->prophesize(CenterResolverManagerInterface::class); + $centerResolver->resolveCenters($person)->willReturn($centers); + + $authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class); + $authorizationHelper->getReachableScopes($role, Argument::type(Center::class)) + ->willReturn($scopes); + + $security = $this->prophesize(Security::class); + $security->isGranted($role, Argument::type(AccompanyingPeriod::class))->willReturn(true); + $security->getUser()->willReturn($user); + + $repository = new ActivityACLAwareRepository( + $authorizationHelper->reveal(), + $centerResolver->reveal(), + $this->activityRepository, + $this->entityManager, + $security->reveal(), + $this->requestStack + ); + + $actual = $repository->findByPerson($person, $role, $start, $limit, $orderBy, $filters); + + self::assertIsArray($actual); + } + + /** + * @dataProvider provideDataFindByPerson + */ + public function testFindByPerson(Person $person, User $user, array $centers, array $scopes, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = [], array $filters = []): void + { + $centerResolver = $this->prophesize(CenterResolverManagerInterface::class); + $centerResolver->resolveCenters($person)->willReturn($centers); + + $authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class); + $authorizationHelper->getReachableScopes($role, Argument::type(Center::class)) + ->willReturn($scopes); + + $security = $this->prophesize(Security::class); + $security->isGranted($role, Argument::type(AccompanyingPeriod::class))->willReturn(true); + $security->getUser()->willReturn($user); + + $repository = new ActivityACLAwareRepository( + $authorizationHelper->reveal(), + $centerResolver->reveal(), + $this->activityRepository, + $this->entityManager, + $security->reveal(), + $this->requestStack + ); + + $actual = $repository->findByPerson($person, $role, $start, $limit, $orderBy, $filters); + + self::assertIsArray($actual); + } + + public function provideDataFindByPerson(): iterable + { + $this->setUp(); + + /** @var Person $person */ + if (null === $person = $this->entityManager->createQueryBuilder() + ->select('p')->from(Person::class, 'p')->setMaxResults(1) + ->getQuery()->getSingleResult()) { + throw new \RuntimeException("person not found"); + } + + /** @var AccompanyingPeriod $period1 */ + if (null === $period1 = $this->entityManager + ->createQueryBuilder() + ->select('a') + ->from(AccompanyingPeriod::class, 'a') + ->setMaxResults(1) + ->getQuery() + ->getSingleResult()) { + throw new \RuntimeException("no period found"); + } + + /** @var AccompanyingPeriod $period2 */ + if (null === $period2 = $this->entityManager + ->createQueryBuilder() + ->select('a') + ->from(AccompanyingPeriod::class, 'a') + ->where('a.id > :pid') + ->setParameter('pid', $period1->getId()) + ->setMaxResults(1) + ->getQuery() + ->getSingleResult()) { + throw new \RuntimeException("no second period found"); + } + // add a period + $period1->addPerson($person); + $period2->addPerson($person); + $period1->getParticipationsContainsPerson($person)->first()->setEndDate( + (new \DateTime('now'))->add(new \DateInterval('P1M')) + ); + + if ([] === $types = $this->entityManager + ->createQueryBuilder() + ->select('t') + ->from(ActivityType::class, 't') + ->setMaxResults(2) + ->getQuery() + ->getResult()) { + throw new \RuntimeException("no types"); + } + + if ([] === $jobs = $this->entityManager + ->createQueryBuilder() + ->select('j') + ->from(UserJob::class, 'j') + ->setMaxResults(2) + ->getQuery() + ->getResult() + ) { + throw new \RuntimeException("no jobs found"); + } + + if (null === $user = $this->entityManager + ->createQueryBuilder() + ->select('u') + ->from(User::class, 'u') + ->setMaxResults(1) + ->getQuery() + ->getSingleResult() + ) { + throw new \RuntimeException("no user found"); + } + + if ([] === $centers = $this->entityManager->createQueryBuilder() + ->select('c')->from(Center::class, 'c')->setMaxResults(2)->getQuery() + ->getResult()) { + throw new \RuntimeException("no centers found"); + } + + if ([] === $scopes = $this->entityManager->createQueryBuilder() + ->select('s')->from(Scope::class, 's')->setMaxResults(2)->getQuery() + ->getResult()) { + throw new \RuntimeException("no scopes found"); + } + + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], []]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['my_activities' => true]]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['types' => $types]]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['jobs' => $jobs]]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]]; + yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]]; + } + + public function provideDataFindByAccompanyingPeriod(): iterable + { + $this->setUp(); + + if (null === $period = $this->entityManager + ->createQueryBuilder() + ->select('a') + ->from(AccompanyingPeriod::class, 'a') + ->setMaxResults(1) + ->getQuery() + ->getSingleResult()) { + throw new \RuntimeException("no period found"); + } + + if ([] === $types = $this->entityManager + ->createQueryBuilder() + ->select('t') + ->from(ActivityType::class, 't') + ->setMaxResults(2) + ->getQuery() + ->getResult()) { + throw new \RuntimeException("no types"); + } + + if ([] === $jobs = $this->entityManager + ->createQueryBuilder() + ->select('j') + ->from(UserJob::class, 'j') + ->setMaxResults(2) + ->getQuery() + ->getResult() + ) { + throw new \RuntimeException("no jobs found"); + } + + if (null === $user = $this->entityManager + ->createQueryBuilder() + ->select('u') + ->from(User::class, 'u') + ->setMaxResults(1) + ->getQuery() + ->getSingleResult() + ) { + throw new \RuntimeException("no user found"); + } + + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], []]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['my_activities' => true]]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['types' => $types]]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['jobs' => $jobs]]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]]; + yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]]; + } +} diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 042fccc69..1229494bb 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -83,12 +83,20 @@ Third persons: Tiers non-pro. Others persons: Usagers Third parties: Tiers professionnels Users concerned: T(M)S + activity: + date: Date de l'échange Insert a document: Insérer un document Remove a document: Supprimer le document comment: Commentaire No documents: Aucun document +# activity filter in list page +activity_filter: + My activities: Mes échanges (où j'interviens) + Types: Par type d'échange + Jobs: Par métier impliqué + #timeline '%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"' From 0e5f1b4ab9c7d8e693332d42709841249e68a0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 23 Jun 2023 12:44:54 +0200 Subject: [PATCH 020/750] Feature: [activity list] add pagination --- .../unreleased/Feature-20230623-124438.yaml | 5 +++ .../Controller/ActivityController.php | 18 +++++--- .../Repository/ActivityACLAwareRepository.php | 43 ++++++++++++++++++- .../ActivityACLAwareRepositoryInterface.php | 10 +++++ .../Resources/views/Activity/list.html.twig | 6 ++- 5 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 .changes/unreleased/Feature-20230623-124438.yaml diff --git a/.changes/unreleased/Feature-20230623-124438.yaml b/.changes/unreleased/Feature-20230623-124438.yaml new file mode 100644 index 000000000..bc199d3bb --- /dev/null +++ b/.changes/unreleased/Feature-20230623-124438.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[activity list] add pagination to the list of activities' +time: 2023-06-23T12:44:38.879098862+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 07e4fcf62..63639c149 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -22,6 +22,7 @@ use Chill\ActivityBundle\Repository\ActivityUserJobRepository; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Entity\UserJob; +use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\LocationRepository; use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; @@ -70,6 +71,7 @@ final class ActivityController extends AbstractController private readonly TranslatorInterface $translator, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly TranslatableStringHelperInterface $translatableStringHelper, + private readonly PaginatorFactory $paginatorFactory, ) { } @@ -251,7 +253,6 @@ final class ActivityController extends AbstractController { $view = null; $activities = []; - // TODO: add pagination [$person, $accompanyingPeriod] = $this->getEntity($request); $filter = $this->buildFilterOrder($person ?? $accompanyingPeriod); @@ -266,12 +267,14 @@ final class ActivityController extends AbstractController if ($person instanceof Person) { $this->denyAccessUnlessGranted(ActivityVoter::SEE, $person); + $count = $this->activityACLAwareRepository->countByPerson($person, ActivityVoter::SEE, $filterArgs); + $paginator = $this->paginatorFactory->create($count); $activities = $this->activityACLAwareRepository ->findByPerson( $person, ActivityVoter::SEE, - 0, - null, + $paginator->getCurrentPageFirstItemNumber(), + $paginator->getItemsPerPage(), ['date' => 'DESC', 'id' => 'DESC'], $filterArgs ); @@ -286,17 +289,21 @@ final class ActivityController extends AbstractController } elseif ($accompanyingPeriod instanceof AccompanyingPeriod) { $this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod); + $count = $this->activityACLAwareRepository->countByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, $filterArgs); + $paginator = $this->paginatorFactory->create($count); $activities = $this->activityACLAwareRepository ->findByAccompanyingPeriod( $accompanyingPeriod, ActivityVoter::SEE, - 0, - null, + $paginator->getCurrentPageFirstItemNumber(), + $paginator->getItemsPerPage(), ['date' => 'DESC', 'id' => 'DESC'], $filterArgs ); $view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig'; + } else { + throw new \LogicException("Unsupported"); } return $this->render( @@ -306,6 +313,7 @@ final class ActivityController extends AbstractController 'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, 'filter' => $filter, + 'paginator' => $paginator, ] ); } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 1fd0a57d6..1544dd764 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -27,6 +27,8 @@ use Chill\PersonBundle\Entity\Person; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\NonUniqueResultException; +use Doctrine\ORM\NoResultException; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\ResultSetMappingBuilder; use Doctrine\ORM\QueryBuilder; @@ -48,6 +50,33 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos ) { } + /** + * @throws NonUniqueResultException + * @throws NoResultException + */ + public function countByAccompanyingPeriod(AccompanyingPeriod $period, string $role, array $filters = []): int + { + $qb = $this->buildBaseQuery($filters); + + $qb + ->select('COUNT(a)') + ->andWhere('a.accompanyingPeriod = :period')->setParameter('period', $period); + + return $qb->getQuery()->getSingleScalarResult(); + } + + public function countByPerson(Person $person, string $role, array $filters = []): int + { + $qb = $this->buildBaseQuery($filters); + + $qb = $this->filterBaseQueryByPerson($qb, $person, $role); + + $qb->select('COUNT(a)'); + + return $qb->getQuery()->getSingleScalarResult(); + } + + public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array { $qb = $this->buildBaseQuery($filters); @@ -58,7 +87,12 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos $qb->addOrderBy('a.' . $field, $order); } - $qb->setFirstResult(0)->setMaxResults(1000); + if (null !== $start) { + $qb->setFirstResult($start); + } + if (null !== $limit) { + $qb->setMaxResults($limit); + } return $qb->getQuery()->getResult(); } @@ -261,6 +295,13 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos $qb->addOrderBy('a.' . $field, $direction); } + if (null !== $start) { + $qb->setFirstResult($start); + } + if (null !== $limit) { + $qb->setMaxResults($limit); + } + return $qb->getQuery()->getResult(); } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php index a046ad218..474d8ad16 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php @@ -28,6 +28,16 @@ interface ActivityACLAwareRepositoryInterface */ public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, array $orderBy = ['date' => 'DESC'], array $filters = []): array; + /** + * @param array{my_activities?: bool, types?: array, jobs?: array, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters + */ + public function countByAccompanyingPeriod(AccompanyingPeriod $period, string $role, array $filters = []): int; + + /** + * @param array{my_activities?: bool, types?: array, jobs?: array, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters + */ + public function countByPerson(Person $person, string $role, array $filters = []): int; + /** * Return a list of activities, simplified as array (not object). * diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index 17ae0598b..dd78c9396 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -80,6 +80,8 @@
+ {{ filter|chill_render_filter_order_helper }} + {% if activities|length == 0 %}

{{ "There isn't any activities."|trans }} @@ -87,8 +89,6 @@ {% else %} - {{ filter|chill_render_filter_order_helper }} -

{% for activity in activities %} {% include 'ChillActivityBundle:Activity:_list_item.html.twig' with { @@ -99,4 +99,6 @@
{% endif %} + {{ chill_pagination(paginator) }} +
From 3e63b4abf30736c41afccb7af97fd259f3bfb6cb Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 4 Jul 2023 16:42:56 +0200 Subject: [PATCH 021/750] UX: improve FilterOrder box design --- .../translations/messages.fr.yml | 2 + .../Form/Type/Listing/FilterOrderType.php | 3 + .../Resources/public/chill/scss/forms.scss | 12 +++ .../views/FilterOrder/base.html.twig | 81 ++++++++----------- 4 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index c53a04f31..d37b3488f 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -96,6 +96,8 @@ activity_filter: My activities: Mes échanges (où j'interviens) Types: Par type d'échange Jobs: Par métier impliqué + By: Filtrer par + Search: Chercher dans la liste #timeline '%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"' diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index 16038515d..1f373400c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -38,6 +38,9 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $builder->add('q', SearchType::class, [ 'label' => false, 'required' => false, + 'attr' => [ + 'placeholder' => 'activity_filter.Search', + ] ]); } diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss index 0ae568244..cd81f36dc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss @@ -42,3 +42,15 @@ form { font-weight: 700; margin-bottom: .375em; } + +.chill_filter_order { + background: $gray-100; /* + border: 3px dashed $white; + background: repeating-linear-gradient( + -45deg, + $gray-100, + $gray-100 2px, + $white 2px, + $white 6px + ); */ +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index d4a6bbdd4..8faef5d14 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -1,102 +1,87 @@ {{ form_start(form) }} -
-
+ {% set btnSubmit = 0 %} +
+
{% if form.vars.has_search_box %} -
-
- {{ form_widget(form.q)}} - +
+
+ {{ form_widget(form.q) }} +
{% endif %}
{% if form.dateRanges is defined %} + {% set btnSubmit = 1 %} {% if form.dateRanges|length > 0 %} {% for dateRangeName, _o in form.dateRanges %} -
+
{% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} -
{{ form_label(form.dateRanges[dateRangeName])}} -
{% endif %} -
-
+
+
{{ 'chill_calendar.From'|trans }} {{ form_widget(form.dateRanges[dateRangeName]['from']) }} {{ 'chill_calendar.To'|trans }} {{ form_widget(form.dateRanges[dateRangeName]['to']) }}
-
- -
{% endfor %} {% endif %} {% endif %} {% if form.checkboxes is defined %} + {% set btnSubmit = 1 %} {% if form.checkboxes|length > 0 %} {% for checkbox_name, options in form.checkboxes %} -
-
+
+
{{ 'activity_filter.By'|trans }}
+
{% for c in form['checkboxes'][checkbox_name].children %} -
- {{ form_widget(c) }} - {{ form_label(c) }} -
+ {{ form_widget(c) }} + {{ form_label(c) }} {% endfor %}
- {% if loop.last %} -
-
-
    -
  • - -
  • -
-
-
- {% endif %} {% endfor %} {% endif %} {% endif %} {% if form.entity_choices is defined %} + {% set btnSubmit = 1 %} {% if form.entity_choices |length > 0 %} {% for checkbox_name, options in form.entity_choices %} -
+
{% if form.entity_choices[checkbox_name].vars.label is not same as(false) %} -
- {{ form_label(form.entity_choices[checkbox_name])}} -
+ {{ form_label(form.entity_choices[checkbox_name])}} {% endif %} -
+
{% for c in form['entity_choices'][checkbox_name].children %} -
- {{ form_widget(c) }} - {{ form_label(c) }} -
+ {{ form_widget(c) }} + {{ form_label(c) }} {% endfor %}
-
- -
{% endfor %} {% endif %} {% endif %} {% if form.single_checkboxes is defined %} + {% set btnSubmit = 1 %} {% for name, _o in form.single_checkboxes %} -
-
+
+
{{ 'activity_filter.By'|trans }}
+
{{ form_widget(form.single_checkboxes[name]) }}
-
- -
{% endfor %} {% endif %} + + {% if btnSubmit == 1 %} +
+ +
+ {% endif %}
{% for k,v in otherParameters %} From 7f9738975cd6690b20ea7c886562342994c9c5f3 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 4 Jul 2023 17:53:08 +0200 Subject: [PATCH 022/750] UX: improve FilterOrder box design --- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 1 + .../Resources/views/FilterOrder/base.html.twig | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index d37b3488f..3099e99b0 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -98,6 +98,7 @@ activity_filter: Jobs: Par métier impliqué By: Filtrer par Search: Chercher dans la liste + By date: Filtrer par date #timeline '%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"' diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index 8faef5d14..b2673b60c 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -18,8 +18,10 @@
{% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} {{ form_label(form.dateRanges[dateRangeName])}} + {% else %} +
{{ 'activity_filter.By date'|trans }}
{% endif %} -
+
{{ 'chill_calendar.From'|trans }} {{ form_widget(form.dateRanges[dateRangeName]['from']) }} From 145c1df313e0328830fe406c12b1afcf03b070dd Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 5 Jul 2023 09:43:13 +0200 Subject: [PATCH 023/750] cleaning --- .../Resources/public/chill/scss/forms.scss | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss index cd81f36dc..a517a5516 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss @@ -44,13 +44,5 @@ form { } .chill_filter_order { - background: $gray-100; /* - border: 3px dashed $white; - background: repeating-linear-gradient( - -45deg, - $gray-100, - $gray-100 2px, - $white 2px, - $white 6px - ); */ + background: $gray-100; } \ No newline at end of file From 25d4b6acbb2b5d547abb38072f69da7f764e4141 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 10:54:37 +0200 Subject: [PATCH 024/750] [FEATURE] allow adding of user filters in filter order - template still to be done --- .../Form/Type/Listing/FilterOrderType.php | 30 ++++++++++++++++++ .../Templating/Listing/FilterOrderHelper.php | 31 ++++++++++++++++++- .../Listing/FilterOrderHelperBuilder.php | 23 ++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index 16038515d..9aebab144 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Form\Type\Listing; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -120,6 +121,35 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $builder->add($singleCheckBoxBuilder); } + + if ([] !== $helper->getUserPickers()) { + $userPickersBuilder = $builder->create('userPicker', null, ['compound' => true]); + + foreach ($helper->getUserPickers() as $name => [ + 'label' => $label, 'options' => $options + ]) { + $userPicker = $userPickersBuilder->create($name, null, [ + 'compound' => true, + 'label' => $label, + ]); + + $userPicker->add( + $name, + PickUserDynamicType::class, + [ + 'multiple' => true, + 'label' => $label, + ...$options, + ] + ); + + + $userPickersBuilder->add($userPicker); + } + + $builder->add($userPickersBuilder); + } + } public function buildView(FormView $view, FormInterface $form, array $options) diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 28cc8e331..f12c23299 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -52,6 +52,11 @@ class FilterOrderHelper */ private array $entityChoices = []; + /** + * @var array + */ + private array $userPickers = []; + public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack @@ -82,6 +87,14 @@ class FilterOrderHelper return $this->entityChoices; } + public function addUserPickers(string $name, ?string $label = null, array $options = []): self + { + $this->userPickers[$name] = ['label' => $label, 'options' => $options]; + + return $this; + } + + public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = [], array $options = []): self { $missing = count($choices) - count($trans) - 1; @@ -116,6 +129,16 @@ class FilterOrderHelper ->handleRequest($this->requestStack->getCurrentRequest()); } + public function getUserPickers(): array + { + return $this->userPickers; + } + + public function getUserPickerData(string $name): array + { + return $this->getFormData()['userPickers'][$name]; + } + public function getCheckboxData(string $name): array { return $this->getFormData()['checkboxes'][$name]; @@ -180,7 +203,8 @@ class FilterOrderHelper 'checkboxes' => [], 'dateRanges' => [], 'single_checkboxes' => [], - 'entity_choices' => [] + 'entity_choices' => [], + 'user_pickers' => [] ]; if ($this->hasSearchBox()) { @@ -204,7 +228,12 @@ class FilterOrderHelper $r['entity_choices'][$name] = ($c['options']['multiple'] ?? true) ? [] : null; } + foreach ($this->userPickers as $name => $u) { + $r['user_pickers'][$name] = ($u['options']['multiple'] ?? true) ? [] : null; + } + return $r; + } private function getFormData(): array diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index e176e27c6..6fd0eeb42 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -37,6 +37,11 @@ class FilterOrderHelperBuilder */ private array $entityChoices = []; + /** + * @var array + */ + private array $userPickers = []; + public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack @@ -83,6 +88,13 @@ class FilterOrderHelperBuilder return $this; } + public function addUserPickers(string $name, ?string $label = null, ?array $options = []): self + { + $this->userPickers[$name] = ['label' => $label, 'options' => $options]; + + return $this; + } + public function build(): FilterOrderHelper { $helper = new FilterOrderHelper( @@ -124,6 +136,17 @@ class FilterOrderHelperBuilder $helper->addDateRange($name, $label, $from, $to); } + + foreach ( + $this->userPickers as $name => [ + 'label' => $label, + 'options' => $options + ] + ) { + $helper->addUserPickers($name, $label, $options); + } + + return $helper; } } From 0d626fb3459a0b30e847b315618851e203db68ef Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 10:55:30 +0200 Subject: [PATCH 025/750] [FEATURE] implement user filter in orderFilterHelper for tasks --- src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php | 2 ++ .../Resources/views/SingleTask/List/index.html.twig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 2ba9488b6..58d2a406e 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -299,6 +299,7 @@ final class SingleTaskController extends AbstractController $this->denyAccessUnlessGranted(TaskVoter::SHOW, null); $filterOrder = $this->buildFilterOrder(); + $flags = array_merge( $filterOrder->getCheckboxData('status'), array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states')) @@ -680,6 +681,7 @@ final class SingleTaskController extends AbstractController ->addSearchBox() ->addCheckbox('status', $statuses, $statuses, $statusTrans) ->addCheckbox('states', $states, ['new', 'in_progress']) + ->addUserPickers('userPicker', 'userPicker', ['multiple' => True]) ->build(); } diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/List/index.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/List/index.html.twig index 8fe45959e..b479eb948 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/List/index.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/List/index.html.twig @@ -27,8 +27,10 @@ {% block css %} {{ parent() }} {{ encore_entry_link_tags('page_task_list') }} + {{ encore_entry_link_tags('mod_pickentity_type') }} {% endblock %} {% block js %} {{ parent() }} {{ encore_entry_script_tags('page_task_list') }} + {{ encore_entry_script_tags('mod_pickentity_type') }} {% endblock %} From 4da7040a49b4a05af0e37434052cc1d457806629 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 12:38:42 +0200 Subject: [PATCH 026/750] FEATURE [user filter] implement query. Selecting multiple users doesn't work --- .../Form/Type/Listing/FilterOrderType.php | 2 +- .../views/FilterOrder/base.html.twig | 18 +++++++++++- .../Templating/Listing/FilterOrderHelper.php | 5 ++-- .../Listing/FilterOrderHelperBuilder.php | 4 +-- .../Controller/SingleTaskController.php | 8 +++-- .../SingleTaskAclAwareRepository.php | 29 ++++++++++++++++--- .../SingleTaskAclAwareRepositoryInterface.php | 4 ++- .../translations/messages.fr.yml | 1 + 8 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index a5166e322..c6744f852 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -126,7 +126,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType } if ([] !== $helper->getUserPickers()) { - $userPickersBuilder = $builder->create('userPicker', null, ['compound' => true]); + $userPickersBuilder = $builder->create('user_pickers', null, ['compound' => true]); foreach ($helper->getUserPickers() as $name => [ 'label' => $label, 'options' => $options diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index b2673b60c..fa35cdbf3 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -67,6 +67,22 @@ {% endfor %} {% endif %} {% endif %} + {% if form.user_pickers is defined %} + {% set btnSubmit = 1 %} + {% if form.user_pickers|length > 0 %} + {% for name, options in form.user_pickers %} +
+
+ {% for p in form['user_pickers'][name].children %} + {{ form_widget(p) }} + {{ form_label(p) }} + {% endfor %} +
+
+ {% endfor %} + {% endif %} + {% endif %} + {% if form.single_checkboxes is defined %} {% set btnSubmit = 1 %} {% for name, _o in form.single_checkboxes %} @@ -78,7 +94,7 @@
{% endfor %} {% endif %} - + {% if btnSubmit == 1 %}
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index bdec463bd..026c55ef6 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -87,7 +87,7 @@ class FilterOrderHelper return $this->entityChoices; } - public function addUserPickers(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]; @@ -136,7 +136,8 @@ class FilterOrderHelper public function getUserPickerData(string $name): array { - return $this->getFormData()['userPickers'][$name]; + dump($this->getFormData()['user_pickers']); + return $this->getFormData()['user_pickers'][$name]; } public function getCheckboxData(string $name): array diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index 6fd0eeb42..86180d06e 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -88,7 +88,7 @@ class FilterOrderHelperBuilder return $this; } - public function addUserPickers(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]; @@ -143,7 +143,7 @@ class FilterOrderHelperBuilder 'options' => $options ] ) { - $helper->addUserPickers($name, $label, $options); + $helper->addUserPicker($name, $label, $options); } diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 58d2a406e..e60a58145 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -300,13 +300,16 @@ final class SingleTaskController extends AbstractController $filterOrder = $this->buildFilterOrder(); + $filteredUsers = $filterOrder->getUserPickerData('userPicker'); + $flags = array_merge( $filterOrder->getCheckboxData('status'), array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states')) ); $nb = $this->singleTaskAclAwareRepository->countByAllViewable( $filterOrder->getQueryString(), - $flags + $flags, + $filteredUsers ); $paginator = $this->paginatorFactory->create($nb); @@ -314,6 +317,7 @@ final class SingleTaskController extends AbstractController $tasks = $this->singleTaskAclAwareRepository->findByAllViewable( $filterOrder->getQueryString(), $flags, + $filteredUsers, $paginator->getCurrentPageFirstItemNumber(), $paginator->getItemsPerPage(), [ @@ -681,7 +685,7 @@ final class SingleTaskController extends AbstractController ->addSearchBox() ->addCheckbox('status', $statuses, $statuses, $statusTrans) ->addCheckbox('states', $states, ['new', 'in_progress']) - ->addUserPickers('userPicker', 'userPicker', ['multiple' => True]) + ->addUserPicker('userPicker', 'Filter by user', ['multiple' => True, 'required' => False]) ->build(); } diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index 0efc16085..ef30a7783 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -51,7 +51,8 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository public function buildBaseQuery( ?string $pattern = null, - ?array $flags = [] + ?array $flags = [], + ?array $users = [] ): QueryBuilder { $qb = $this->em->createQueryBuilder(); $qb @@ -62,6 +63,24 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository ->setParameter('pattern', '%' . $pattern . '%'); } + if (count($users) > 0) { + $orXUser = $qb->expr()->orX(); + + foreach ($users as $key => $user) { + $orXUser->add( + $qb->expr()->eq('t.assignee', ':user') + ); + + $qb->setParameter('user', $user); + } + + if ($orXUser->count() > 0) { + $qb->andWhere($orXUser); + } + + return $qb; + } + if (count($flags) > 0) { $orXDate = $qb->expr()->orX(); $orXState = $qb->expr()->orX(); @@ -183,9 +202,10 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository public function countByAllViewable( ?string $pattern = null, - ?array $flags = [] + ?array $flags = [], + ?array $users = [] ): int { - $qb = $this->buildBaseQuery($pattern, $flags); + $qb = $this->buildBaseQuery($pattern, $flags, $users); return $this ->addACLGlobal($qb) @@ -231,11 +251,12 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository public function findByAllViewable( ?string $pattern = null, ?array $flags = [], + ?array $users = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = [] ): array { - $qb = $this->buildBaseQuery($pattern, $flags); + $qb = $this->buildBaseQuery($pattern, $flags, $users); $qb = $this->addACLGlobal($qb); return $this->getResult($qb, $start, $limit, $orderBy); diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php index 57c57e592..7d2870c67 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepositoryInterface.php @@ -18,7 +18,8 @@ interface SingleTaskAclAwareRepositoryInterface { public function countByAllViewable( ?string $pattern = null, - ?array $flags = [] + ?array $flags = [], + ?array $users = [] ): int; public function countByCourse( @@ -38,6 +39,7 @@ interface SingleTaskAclAwareRepositoryInterface public function findByAllViewable( ?string $pattern = null, ?array $flags = [], + ?array $users = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = [] diff --git a/src/Bundle/ChillTaskBundle/translations/messages.fr.yml b/src/Bundle/ChillTaskBundle/translations/messages.fr.yml index d437baac2..599ca8640 100644 --- a/src/Bundle/ChillTaskBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillTaskBundle/translations/messages.fr.yml @@ -65,6 +65,7 @@ Not assigned: Aucun utilisateur assigné For person: Pour By: Par Any tasks: Aucune tâche +Filter by user: Filtrer par utilisateur(s) # transitions - default task definition "new": "nouvelle" From 1ee0e8e350381e039f04171019f2a9584394412e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 13:35:06 +0200 Subject: [PATCH 027/750] DX phpstan and csfixer --- .../Form/Type/Listing/FilterOrderType.php | 13 +++---------- .../Resources/views/FilterOrder/base.html.twig | 12 +++++++----- .../Templating/Listing/FilterOrderHelper.php | 1 - .../Templating/Listing/FilterOrderHelperBuilder.php | 6 +++--- .../Controller/SingleTaskController.php | 2 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index c6744f852..4e41a1740 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -129,25 +129,18 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $userPickersBuilder = $builder->create('user_pickers', null, ['compound' => true]); foreach ($helper->getUserPickers() as $name => [ - 'label' => $label, 'options' => $options + 'label' => $label, 'options' => $opts ]) { - $userPicker = $userPickersBuilder->create($name, null, [ - 'compound' => true, - 'label' => $label, - ]); - $userPicker->add( + $userPickersBuilder->add( $name, PickUserDynamicType::class, [ 'multiple' => true, 'label' => $label, - ...$options, + ...$opts, ] ); - - - $userPickersBuilder->add($userPicker); } $builder->add($userPickersBuilder); diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index fa35cdbf3..9a9a11fbd 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -69,14 +69,16 @@ {% endif %} {% if form.user_pickers is defined %} {% set btnSubmit = 1 %} - {% if form.user_pickers|length > 0 %} + {% if form.user_pickers.children|length > 0 %} {% for name, options in form.user_pickers %}
+ {% if form.user_pickers[name].vars.label is not same as(false) %} + {{ form_label(form.user_pickers[name]) }} + {% else %} + {{ form_label(form.user_pickers[name].vars.label) }} + {% endif %}
- {% for p in form['user_pickers'][name].children %} - {{ form_widget(p) }} - {{ form_label(p) }} - {% endfor %} + {{ form_widget(form.user_pickers[name]) }}
{% endfor %} diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 026c55ef6..8554b4431 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -136,7 +136,6 @@ class FilterOrderHelper public function getUserPickerData(string $name): array { - dump($this->getFormData()['user_pickers']); return $this->getFormData()['user_pickers'][$name]; } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index 86180d06e..d9a505dee 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -139,9 +139,9 @@ class FilterOrderHelperBuilder foreach ( $this->userPickers as $name => [ - 'label' => $label, - 'options' => $options - ] + 'label' => $label, + 'options' => $options + ] ) { $helper->addUserPicker($name, $label, $options); } diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index e60a58145..22e49704f 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -685,7 +685,7 @@ final class SingleTaskController extends AbstractController ->addSearchBox() ->addCheckbox('status', $statuses, $statuses, $statusTrans) ->addCheckbox('states', $states, ['new', 'in_progress']) - ->addUserPicker('userPicker', 'Filter by user', ['multiple' => True, 'required' => False]) + ->addUserPicker('userPicker', 'Filter by user', ['multiple' => true, 'required' => false]) ->build(); } From 4e934653be7641605ac52070e3529663c78e00f7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 14:12:43 +0200 Subject: [PATCH 028/750] DX changie added --- .changes/unreleased/Feature-20230705-140336.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Feature-20230705-140336.yaml diff --git a/.changes/unreleased/Feature-20230705-140336.yaml b/.changes/unreleased/Feature-20230705-140336.yaml new file mode 100644 index 000000000..3ce7f3c0f --- /dev/null +++ b/.changes/unreleased/Feature-20230705-140336.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: Allow filtering on the basis of a user within general tasks list +time: 2023-07-05T14:03:36.664880092+02:00 +custom: + Issue: "" From 52d51264bab3a096be592a8df31f83e3f0b4dca4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 14:57:28 +0200 Subject: [PATCH 029/750] FIX [query][user filter] avoid replacement of user parameter in query --- .../Repository/SingleTaskAclAwareRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php index ef30a7783..d1652cc89 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskAclAwareRepository.php @@ -68,10 +68,10 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository foreach ($users as $key => $user) { $orXUser->add( - $qb->expr()->eq('t.assignee', ':user') + $qb->expr()->eq('t.assignee', ':user_' . $key) ); - $qb->setParameter('user', $user); + $qb->setParameter('user_' . $key, $user); } if ($orXUser->count() > 0) { From 4b25970ce0a43e82531280940c6507da8f071b41 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 15:35:13 +0200 Subject: [PATCH 030/750] FEATURE [filter] start implementation of social action filter --- .../AccompanyingCourseWorkController.php | 38 ++++++++++++++++++- .../AccompanyingPeriodWorkRepository.php | 2 +- .../translations/messages.fr.yml | 3 ++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 8d15ca30f..75d0bae7c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -11,9 +11,14 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; +use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Pagination\PaginatorFactory; +use Chill\MainBundle\Templating\Listing\FilterOrderHelper; +use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; +use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter; use Psr\Log\LoggerInterface; @@ -38,18 +43,22 @@ class AccompanyingCourseWorkController extends AbstractController private AccompanyingPeriodWorkRepository $workRepository; + private TranslatableStringHelperInterface $translatableStringHelper; + public function __construct( TranslatorInterface $trans, SerializerInterface $serializer, AccompanyingPeriodWorkRepository $workRepository, PaginatorFactory $paginator, - LoggerInterface $chillLogger + LoggerInterface $chillLogger, + TranslatableStringHelperInterface $translatableStringHelper ) { $this->trans = $trans; $this->serializer = $serializer; $this->workRepository = $workRepository; $this->paginator = $paginator; $this->chillLogger = $chillLogger; + $this->translatableStringHelper = $translatableStringHelper; } /** @@ -162,11 +171,21 @@ class AccompanyingCourseWorkController extends AbstractController { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period); + $filter = $this->buildFilterOrder($period); + + $filterData = [ + 'types' => $filter->getEntityChoiceData('typesFilter'), + 'before' => $filter->getDateRangeData('dateFilter')['to'], + 'after' => $filter->getDateRangeData('dateFilter')['from'], + 'user' => $filter->getUserPickerData('userFilter') + ]; + $totalItems = $this->workRepository->countByAccompanyingPeriod($period); $paginator = $this->paginator->create($totalItems); $works = $this->workRepository->findByAccompanyingPeriodOpenFirst( $period, + $filterData, $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() ); @@ -210,4 +229,21 @@ class AccompanyingCourseWorkController extends AbstractController ->add('submit', SubmitType::class, ['label' => 'Delete']) ->getForm(); } + + private function buildFilterOrder($associatedPeriod): FilterOrderHelper + { + + $filterBuilder = $this->filterOrderHelperFactory->create(self::class); + $types = $this->workRepository->findByAccompanyingPeriod($associatedPeriod); + + $filterBuilder + ->addDateRange('dateFilter', 'accompanying_course_work.date_filter') + ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialAction::class, $types, [ + 'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()) + ]) + ->addUserPicker('userFilter', 'accompanying_course_work.user_filter') + ; + + return $filterBuilder->build(); + } } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index bf2d34aae..1bd9b0f4e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -96,7 +96,7 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository * * @return AccompanyingPeriodWork[] */ - public function findByAccompanyingPeriodOpenFirst(AccompanyingPeriod $period, int $limit = 10, int $offset = 0): array + public function findByAccompanyingPeriodOpenFirst(AccompanyingPeriod $period, $filters, int $limit = 10, int $offset = 0): array { $rsm = new ResultSetMappingBuilder($this->em); $rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w'); diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 01383c050..f783c403e 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -912,6 +912,9 @@ accompanying_course_work: social_evaluation: Évaluation private_comment: Commentaire privé timeSpent: Temps de rédaction + date_filter: Filtrer par date + types_filter: Filtrer par type d'action + user_filter: Filtrer par intervenant # From 6c58e7eb3e13a3421250263f69043740787e0c8d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 15:49:50 +0200 Subject: [PATCH 031/750] DX phpstan and cs-fixer --- .../AccompanyingCourseWorkController.php | 34 +++++-------------- .../AccompanyingPeriodWorkRepository.php | 1 + 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 75d0bae7c..9abf1677d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; +use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; @@ -33,32 +34,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseWorkController extends AbstractController { - private LoggerInterface $chillLogger; - - private PaginatorFactory $paginator; - - private SerializerInterface $serializer; - - private TranslatorInterface $trans; - - private AccompanyingPeriodWorkRepository $workRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - public function __construct( - TranslatorInterface $trans, - SerializerInterface $serializer, - AccompanyingPeriodWorkRepository $workRepository, - PaginatorFactory $paginator, - LoggerInterface $chillLogger, - TranslatableStringHelperInterface $translatableStringHelper + private readonly TranslatorInterface $trans, + private readonly SerializerInterface $serializer, + private readonly AccompanyingPeriodWorkRepository $workRepository, + private readonly PaginatorFactory $paginator, + private readonly LoggerInterface $chillLogger, + private readonly TranslatableStringHelperInterface $translatableStringHelper, + private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory ) { - $this->trans = $trans; - $this->serializer = $serializer; - $this->workRepository = $workRepository; - $this->paginator = $paginator; - $this->chillLogger = $chillLogger; - $this->translatableStringHelper = $translatableStringHelper; } /** @@ -238,7 +222,7 @@ class AccompanyingCourseWorkController extends AbstractController $filterBuilder ->addDateRange('dateFilter', 'accompanying_course_work.date_filter') - ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialAction::class, $types, [ + ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, $types, [ 'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()) ]) ->addUserPicker('userFilter', 'accompanying_course_work.user_filter') diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index 1bd9b0f4e..60a00e12a 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -95,6 +95,7 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository * * then, closed works * * @return AccompanyingPeriodWork[] + * @param mixed $filters */ public function findByAccompanyingPeriodOpenFirst(AccompanyingPeriod $period, $filters, int $limit = 10, int $offset = 0): array { From 61982634a6203875f6bcaf0fd30fd454db204729 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 5 Jul 2023 16:05:51 +0200 Subject: [PATCH 032/750] FEATURE add filter to the template --- .../Controller/AccompanyingCourseWorkController.php | 3 ++- .../Resources/views/AccompanyingCourseWork/index.html.twig | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 9abf1677d..1f2680f9e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -178,6 +178,7 @@ class AccompanyingCourseWorkController extends AbstractController 'accompanyingCourse' => $period, 'works' => $works, 'paginator' => $paginator, + 'filter' => $filter ]); } @@ -225,7 +226,7 @@ class AccompanyingCourseWorkController extends AbstractController ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, $types, [ 'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()) ]) - ->addUserPicker('userFilter', 'accompanying_course_work.user_filter') + ->addUserPicker('userFilter', 'accompanying_course_work.user_filter', ['required' => false]) ; return $filterBuilder->build(); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig index ab1989f63..1cedfa694 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig @@ -5,18 +5,23 @@ {% block js %} {{ parent() }} {{ encore_entry_script_tags('mod_entity_workflow_pick') }} + {{ encore_entry_script_tags('mod_pickentity_type') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_entity_workflow_pick') }} + {{ encore_entry_link_tags('mod_pickentity_type') }} {% endblock %} + {% block content %}

{{ block('title') }}

+ {{ filter|chill_render_filter_order_helper }} + {% if works|length == 0 %}

{{ 'accompanying_course_work.Any work'|trans }}

{% else %} From c04fd66163f2014ac54362f56bafebca9f38e1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 5 Jul 2023 22:20:27 +0200 Subject: [PATCH 033/750] do not show filter on job or activity type if less than 2 possibilities --- .../Controller/ActivityController.php | 39 +++++++++++-------- .../Templating/Listing/FilterOrderHelper.php | 20 ++++++++++ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 63639c149..9b6e69bf0 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -259,8 +259,8 @@ final class ActivityController extends AbstractController $filterArgs = [ 'my_activities' => $filter->getSingleCheckboxData('my_activities'), - 'types' => $filter->getEntityChoiceData('activity_types'), - 'jobs' => $filter->getEntityChoiceData('jobs'), + 'types' => $filter->hasEntityChoice('activity_type') ? $filter->getEntityChoiceData('activity_types') : [], + 'jobs' => $filter->hasEntityChoice('jobs') ? $filter->getEntityChoiceData('jobs') : [], 'before' => $filter->getDateRangeData('activity_date')['to'], 'after' => $filter->getDateRangeData('activity_date')['from'], ]; @@ -327,21 +327,28 @@ final class ActivityController extends AbstractController $filterBuilder ->addDateRange('activity_date', 'activity.date') - ->addSingleCheckbox('my_activities', 'activity_filter.My activities') - ->addEntityChoice('activity_types', 'activity_filter.Types', \Chill\ActivityBundle\Entity\ActivityType::class, $types, [ - 'choice_label' => function (\Chill\ActivityBundle\Entity\ActivityType $activityType) { - $text = match ($activityType->hasCategory()) { - true => $this->translatableStringHelper->localize($activityType->getCategory()->getName()) . ' > ', - false => '', - }; + ->addSingleCheckbox('my_activities', 'activity_filter.My activities'); - return $text . $this->translatableStringHelper->localize($activityType->getName()); - } - ]) - ->addEntityChoice('jobs', 'activity_filter.Jobs', UserJob::class, $jobs, [ - 'choice_label' => fn (UserJob $u) => $this->translatableStringHelper->localize($u->getLabel()) - ]) - ; + if (1 < count($types)) { + $filterBuilder + ->addEntityChoice('activity_types', 'activity_filter.Types', \Chill\ActivityBundle\Entity\ActivityType::class, $types, [ + 'choice_label' => function (\Chill\ActivityBundle\Entity\ActivityType $activityType) { + $text = match ($activityType->hasCategory()) { + true => $this->translatableStringHelper->localize($activityType->getCategory()->getName()) . ' > ', + false => '', + }; + + return $text . $this->translatableStringHelper->localize($activityType->getName()); + } + ]); + } + + if (1 < count($jobs)) { + $filterBuilder + ->addEntityChoice('jobs', 'activity_filter.Jobs', UserJob::class, $jobs, [ + 'choice_label' => fn (UserJob $u) => $this->translatableStringHelper->localize($u->getLabel()) + ]); + } return $filterBuilder->build(); } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 28cc8e331..5c9971890 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -116,16 +116,31 @@ class FilterOrderHelper ->handleRequest($this->requestStack->getCurrentRequest()); } + public function hasCheckboxData(string $name): bool + { + return array_key_exists($name, $this->checkboxes); + } + public function getCheckboxData(string $name): array { return $this->getFormData()['checkboxes'][$name]; } + public function hasSingleCheckboxData(string $name): bool + { + return array_key_exists($name, $this->singleCheckbox); + } + public function getSingleCheckboxData(string $name): ?bool { return $this->getFormData()['single_checkboxes'][$name]; } + public function hasEntityChoice(string $name): bool + { + return array_key_exists($name, $this->entityChoices); + } + public function getEntityChoiceData($name): mixed { return $this->getFormData()['entity_choices'][$name]; @@ -144,6 +159,11 @@ class FilterOrderHelper return $this->singleCheckbox; } + public function hasDateRangeData(string $name): bool + { + return array_key_exists($name, $this->dateRanges); + } + /** * @return array{to: ?DateTimeImmutable, from: ?DateTimeImmutable} */ From 20d5fabc1876e65ca07ffb18b1cfa477ae1fc2c4 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 6 Jul 2023 13:39:08 +0200 Subject: [PATCH 034/750] [repository][action filter] integrating filters in repository --- .../AccompanyingCourseWorkController.php | 4 +- .../AccompanyingPeriodWorkRepository.php | 58 ++++++++++++++++++- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 1f2680f9e..c56489afd 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -161,7 +161,7 @@ class AccompanyingCourseWorkController extends AbstractController 'types' => $filter->getEntityChoiceData('typesFilter'), 'before' => $filter->getDateRangeData('dateFilter')['to'], 'after' => $filter->getDateRangeData('dateFilter')['from'], - 'user' => $filter->getUserPickerData('userFilter') + 'users' => $filter->getUserPickerData('userFilter') ]; $totalItems = $this->workRepository->countByAccompanyingPeriod($period); @@ -219,7 +219,7 @@ class AccompanyingCourseWorkController extends AbstractController { $filterBuilder = $this->filterOrderHelperFactory->create(self::class); - $types = $this->workRepository->findByAccompanyingPeriod($associatedPeriod); + $types = $this->workRepository->findActionTypeByPeriod($associatedPeriod); $filterBuilder ->addDateRange('dateFilter', 'accompanying_course_work.date_filter') diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index 60a00e12a..a5e27afd5 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -108,8 +108,32 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository CASE WHEN enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC, startdate DESC, enddate DESC, - id DESC - LIMIT :limit OFFSET :offset"; + id DESC"; + + // implement filters + + if([] !== ($filters['types'] ?? [])) + { + $sql .= "AND WHERE w.socialAction IN (:types)"; + } + + if([] !== ($filters['users'] ?? [])) + { + $sql .= "AND WHERE w.createdBy IN (:users)"; + + foreach ($filters['users'] as $key => $user) { + $sql .= "OR :user_" . $key . " IN w.referrers)"; + + $nq = $this->em->createNativeQuery($sql, $rsm) + ->setParameter(':user_' . $key); + } + + // ... to be continued + } + + // set limit and offset + + $sql .= " LIMIT :limit OFFSET :offset"; $nq = $this->em->createNativeQuery($sql, $rsm) ->setParameter('periodId', $period->getId(), Types::INTEGER) @@ -119,6 +143,36 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository return $nq->getResult(); } + /** + * Return a list of types of social actions associated to the accompanying period + * + * @return array + */ + public function findActionTypeByPeriod(AccompanyingPeriod $period): array + { + $in = $this->em->createQueryBuilder(); + $in + ->select('1') + ->from(AccompanyingPeriodWork::class, 'apw'); + + + $in->andWhere('apw.accompanyingPeriod = :period')->setParameter('period', $period); + + + // join between the embedded exist query and the main query + $in->andWhere('apw.socialAction = sa'); + + $qb = $this->em->createQueryBuilder()->setParameters($in->getParameters()); + $qb + ->select('sa') + ->from(SocialAction::class, 'sa') + ->where( + $qb->expr()->exists($in->getDQL()) + ); + + return $qb->getQuery()->getResult(); + } + public function findNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until, int $limit = 20, int $offset = 0): array { return $this->buildQueryNearEndDateByUser($user, $since, $until) From cc97199c5deceb7c98bca0af26c659a9b5ea149d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 6 Jul 2023 13:40:25 +0200 Subject: [PATCH 035/750] DX added changie --- .changes/unreleased/Feature-20230706-134010.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Feature-20230706-134010.yaml diff --git a/.changes/unreleased/Feature-20230706-134010.yaml b/.changes/unreleased/Feature-20230706-134010.yaml new file mode 100644 index 000000000..73a0727fc --- /dev/null +++ b/.changes/unreleased/Feature-20230706-134010.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: Adding OrderFilter to the list of social actions. +time: 2023-07-06T13:40:10.339001208+02:00 +custom: + Issue: "120" From 7ccff61c254cea360b68bf33d74ea0988ee1a5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 09:17:36 +0200 Subject: [PATCH 036/750] Refactor ListAccompanyingPeriod to use a helper for most of the work --- .../Export/Export/ListAccompanyingPeriod.php | 313 +----------------- .../Helper/ListAccompanyingPeriodHelper.php | 306 +++++++++++++++++ .../translations/messages.fr.yml | 2 +- 3 files changed, 315 insertions(+), 306 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index af66ab312..3f7821bbc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -29,6 +29,7 @@ use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress; use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper; use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; @@ -45,95 +46,13 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function strlen; -class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface +final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface { - private const FIELDS = [ - 'id', - 'step', - 'stepSince', - 'openingDate', - 'closingDate', - 'referrer', - 'referrerSince', - 'administrativeLocation', - 'locationIsPerson', - 'locationIsTemp', - 'locationPersonName', - 'locationPersonId', - 'origin', - 'closingMotive', - 'confidential', - 'emergency', - 'intensity', - 'job', - 'isRequestorPerson', - 'isRequestorThirdParty', - 'requestorPerson', - 'requestorPersonId', - 'requestorThirdParty', - 'requestorThirdPartyId', - 'scopes', - 'socialIssues', - 'createdAt', - 'createdBy', - 'updatedAt', - 'updatedBy', - ]; - - private ExportAddressHelper $addressHelper; - - private DateTimeHelper $dateTimeHelper; - - private EntityManagerInterface $entityManager; - - private PersonRenderInterface $personRender; - - private PersonRepository $personRepository; - - private RollingDateConverterInterface $rollingDateConverter; - - private SocialIssueRender $socialIssueRender; - - private SocialIssueRepository $socialIssueRepository; - - private ThirdPartyRender $thirdPartyRender; - - private ThirdPartyRepository $thirdPartyRepository; - - private TranslatableStringHelperInterface $translatableStringHelper; - - private TranslatorInterface $translator; - - private UserHelper $userHelper; - public function __construct( - ExportAddressHelper $addressHelper, - DateTimeHelper $dateTimeHelper, - EntityManagerInterface $entityManager, - PersonRenderInterface $personRender, - PersonRepository $personRepository, - ThirdPartyRepository $thirdPartyRepository, - ThirdPartyRender $thirdPartyRender, - SocialIssueRepository $socialIssueRepository, - SocialIssueRender $socialIssueRender, - TranslatableStringHelperInterface $translatableStringHelper, - TranslatorInterface $translator, - RollingDateConverterInterface $rollingDateConverter, - UserHelper $userHelper + private EntityManagerInterface $entityManager, + private RollingDateConverterInterface $rollingDateConverter, + private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, ) { - $this->addressHelper = $addressHelper; - $this->dateTimeHelper = $dateTimeHelper; - $this->entityManager = $entityManager; - $this->personRender = $personRender; - $this->personRepository = $personRepository; - $this->socialIssueRender = $socialIssueRender; - $this->socialIssueRepository = $socialIssueRepository; - $this->thirdPartyRender = $thirdPartyRender; - $this->thirdPartyRepository = $thirdPartyRepository; - $this->translatableStringHelper = $translatableStringHelper; - $this->translator = $translator; - $this->rollingDateConverter = $rollingDateConverter; - $this->userHelper = $userHelper; } public function buildForm(FormBuilderInterface $builder) @@ -169,141 +88,12 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { - return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); - } - - switch ($key) { - case 'stepSince': - case 'openingDate': - case 'closingDate': - case 'referrerSince': - case 'createdAt': - case 'updatedAt': - return $this->dateTimeHelper->getLabel('export.list.acp.' . $key); - - case 'origin': - case 'closingMotive': - case 'job': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); - }; - - case 'locationPersonName': - case 'requestorPerson': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value || null === $person = $this->personRepository->find($value)) { - return ''; - } - - return $this->personRender->renderString($person, []); - }; - - case 'requestorThirdParty': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) { - return ''; - } - - return $this->thirdPartyRender->renderString($thirdparty, []); - }; - - case 'scopes': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return implode( - '|', - array_map( - fn ($s) => $this->translatableStringHelper->localize($s), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) - ) - ); - }; - - case 'socialIssues': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return implode( - '|', - array_map( - fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) - ) - ); - }; - - case 'step': - return fn ($value) => match ($value) { - '_header' => 'export.list.acp.step', - null => '', - AccompanyingPeriod::STEP_DRAFT => $this->translator->trans('course.draft'), - AccompanyingPeriod::STEP_CONFIRMED => $this->translator->trans('course.confirmed'), - AccompanyingPeriod::STEP_CLOSED => $this->translator->trans('course.closed'), - AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT => $this->translator->trans('course.inactive_short'), - AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG => $this->translator->trans('course.inactive_long'), - default => $value, - }; - - case 'intensity': - return fn ($value) => match ($value) { - '_header' => 'export.list.acp.intensity', - null => '', - AccompanyingPeriod::INTENSITY_OCCASIONAL => $this->translator->trans('occasional'), - AccompanyingPeriod::INTENSITY_REGULAR => $this->translator->trans('regular'), - default => $value, - }; - - default: - return static function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.acp.' . $key; - } - - if (null === $value) { - return ''; - } - - return $value; - }; - } + return $this->listAccompanyingPeriodHelper->getLabels($key, $values, $data); } public function getQueryKeys($data) { - return array_merge( - self::FIELDS, - $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields') - ); + return $this->listAccompanyingPeriodHelper->getQueryKeys($data); } public function getResult($query, $data) @@ -341,7 +131,7 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface ->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT) ->setParameter('authorized_centers', $centers); - $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); return $qb; } @@ -357,91 +147,4 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface Declarations::ACP_TYPE, ]; } - - private function addSelectClauses(QueryBuilder $qb, DateTimeImmutable $calcDate): void - { - // add the regular fields - foreach (['id', 'openingDate', 'closingDate', 'confidential', 'emergency', 'intensity', 'createdAt', 'updatedAt'] as $field) { - $qb->addSelect(sprintf('acp.%s AS %s', $field, $field)); - } - - // add the field which are simple association - foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'createdBy' => 'label', 'updatedBy' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) { - $qb - ->leftJoin(sprintf('acp.%s', $entity), "{$entity}_t") - ->addSelect(sprintf('%s_t.%s AS %s', $entity, $field, $entity)); - } - - // step at date - $qb - ->addSelect('stepHistory.step AS step') - ->addSelect('stepHistory.startDate AS stepSince') - ->leftJoin('acp.stepHistories', 'stepHistory') - ->andWhere( - $qb->expr()->andX( - $qb->expr()->lte('stepHistory.startDate', ':calcDate'), - $qb->expr()->orX($qb->expr()->isNull('stepHistory.endDate'), $qb->expr()->gt('stepHistory.endDate', ':calcDate')) - ) - ); - - // referree at date - $qb - ->addSelect('referrer_t.label AS referrer') - ->addSelect('userHistory.startDate AS referrerSince') - ->leftJoin('acp.userHistories', 'userHistory') - ->leftJoin('userHistory.user', 'referrer_t') - ->andWhere( - $qb->expr()->orX( - $qb->expr()->isNull('userHistory'), - $qb->expr()->andX( - $qb->expr()->lte('userHistory.startDate', ':calcDate'), - $qb->expr()->orX($qb->expr()->isNull('userHistory.endDate'), $qb->expr()->gt('userHistory.endDate', ':calcDate')) - ) - ) - ); - - // location of the acp - $qb - ->addSelect('CASE WHEN locationHistory.personLocation IS NOT NULL THEN 1 ELSE 0 END AS locationIsPerson') - ->addSelect('CASE WHEN locationHistory.personLocation IS NOT NULL THEN 0 ELSE 1 END AS locationIsTemp') - ->addSelect('IDENTITY(locationHistory.personLocation) AS locationPersonName') - ->addSelect('IDENTITY(locationHistory.personLocation) AS locationPersonId') - ->leftJoin('acp.locationHistories', 'locationHistory') - ->andWhere( - $qb->expr()->orX( - $qb->expr()->isNull('locationHistory'), - $qb->expr()->andX( - $qb->expr()->lte('locationHistory.startDate', ':calcDate'), - $qb->expr()->orX($qb->expr()->isNull('locationHistory.endDate'), $qb->expr()->gt('locationHistory.endDate', ':calcDate')) - ) - ) - ) - ->leftJoin( - PersonHouseholdAddress::class, - 'personAddress', - Join::WITH, - 'locationHistory.personLocation = personAddress.person AND (personAddress.validFrom <= :calcDate AND (personAddress.validTo IS NULL OR personAddress.validTo > :calcDate))' - ) - ->leftJoin(Address::class, 'acp_address', Join::WITH, 'COALESCE(IDENTITY(locationHistory.addressLocation), IDENTITY(personAddress.address)) = acp_address.id'); - - $this->addressHelper->addSelectClauses(ExportAddressHelper::F_ALL, $qb, 'acp_address', 'address_fields'); - - // requestor - $qb - ->addSelect('CASE WHEN acp.requestorPerson IS NULL THEN 1 ELSE 0 END AS isRequestorPerson') - ->addSelect('CASE WHEN acp.requestorPerson IS NULL THEN 0 ELSE 1 END AS isRequestorThirdParty') - ->addSelect('IDENTITY(acp.requestorPerson) AS requestorPersonId') - ->addSelect('IDENTITY(acp.requestorThirdParty) AS requestorThirdPartyId') - ->addSelect('IDENTITY(acp.requestorPerson) AS requestorPerson') - ->addSelect('IDENTITY(acp.requestorThirdParty) AS requestorThirdParty'); - - $qb - // scopes - ->addSelect('(SELECT AGGREGATE(scope.name) FROM ' . Scope::class . ' scope WHERE scope MEMBER OF acp.scopes) AS scopes') - // social issues - ->addSelect('(SELECT AGGREGATE(socialIssue.id) FROM ' . SocialIssue::class . ' socialIssue WHERE socialIssue MEMBER OF acp.socialIssues) AS socialIssues'); - - // add parameter - $qb->setParameter('calcDate', $calcDate); - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php new file mode 100644 index 000000000..8671b4977 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -0,0 +1,306 @@ +addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields') + ); + } + + public function getLabels($key, array $values, $data) + { + if (substr($key, 0, strlen('address_fields')) === 'address_fields') { + return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); + } + + switch ($key) { + case 'stepSince': + case 'openingDate': + case 'closingDate': + case 'referrerSince': + case 'createdAt': + case 'updatedAt': + return $this->dateTimeHelper->getLabel('export.list.acp.' . $key); + + case 'origin': + case 'closingMotive': + case 'job': + return function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value) { + return ''; + } + + return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + }; + + case 'locationPersonName': + case 'requestorPerson': + return function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value || null === $person = $this->personRepository->find($value)) { + return ''; + } + + return $this->personRender->renderString($person, []); + }; + + case 'requestorThirdParty': + return function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value || null === $thirdparty = $this->thirdPartyRepository->find($value)) { + return ''; + } + + return $this->thirdPartyRender->renderString($thirdparty, []); + }; + + case 'scopes': + return function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value) { + return ''; + } + + return implode( + '|', + array_map( + fn ($s) => $this->translatableStringHelper->localize($s), + json_decode($value, true, 512, JSON_THROW_ON_ERROR) + ) + ); + }; + + case 'socialIssues': + return function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value) { + return ''; + } + + return implode( + '|', + array_map( + fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []), + json_decode($value, true, 512, JSON_THROW_ON_ERROR) + ) + ); + }; + + case 'step': + return fn ($value) => match ($value) { + '_header' => 'export.list.acp.step', + null => '', + AccompanyingPeriod::STEP_DRAFT => $this->translator->trans('course.draft'), + AccompanyingPeriod::STEP_CONFIRMED => $this->translator->trans('course.confirmed'), + AccompanyingPeriod::STEP_CLOSED => $this->translator->trans('course.closed'), + AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT => $this->translator->trans('course.inactive_short'), + AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG => $this->translator->trans('course.inactive_long'), + default => $value, + }; + + case 'intensity': + return fn ($value) => match ($value) { + '_header' => 'export.list.acp.intensity', + null => '', + AccompanyingPeriod::INTENSITY_OCCASIONAL => $this->translator->trans('occasional'), + AccompanyingPeriod::INTENSITY_REGULAR => $this->translator->trans('regular'), + default => $value, + }; + + default: + return static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acp.' . $key; + } + + if (null === $value) { + return ''; + } + + return $value; + }; + } + } + + public function addSelectClauses(QueryBuilder $qb, \DateTimeImmutable $calcDate): void + { + // add the regular fields + foreach (['id', 'openingDate', 'closingDate', 'confidential', 'emergency', 'intensity', 'createdAt', 'updatedAt'] as $field) { + $qb->addSelect(sprintf('acp.%s AS %s', $field, $field)); + } + + // add the field which are simple association + foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'createdBy' => 'label', 'updatedBy' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) { + $qb + ->leftJoin(sprintf('acp.%s', $entity), "{$entity}_t") + ->addSelect(sprintf('%s_t.%s AS %s', $entity, $field, $entity)); + } + + // step at date + $qb + ->addSelect('stepHistory.step AS step') + ->addSelect('stepHistory.startDate AS stepSince') + ->leftJoin('acp.stepHistories', 'stepHistory') + ->andWhere( + $qb->expr()->andX( + $qb->expr()->lte('stepHistory.startDate', ':calcDate'), + $qb->expr()->orX($qb->expr()->isNull('stepHistory.endDate'), $qb->expr()->gt('stepHistory.endDate', ':calcDate')) + ) + ); + + // referree at date + $qb + ->addSelect('referrer_t.label AS referrer') + ->addSelect('userHistory.startDate AS referrerSince') + ->leftJoin('acp.userHistories', 'userHistory') + ->leftJoin('userHistory.user', 'referrer_t') + ->andWhere( + $qb->expr()->orX( + $qb->expr()->isNull('userHistory'), + $qb->expr()->andX( + $qb->expr()->lte('userHistory.startDate', ':calcDate'), + $qb->expr()->orX($qb->expr()->isNull('userHistory.endDate'), $qb->expr()->gt('userHistory.endDate', ':calcDate')) + ) + ) + ); + + // location of the acp + $qb + ->addSelect('CASE WHEN locationHistory.personLocation IS NOT NULL THEN 1 ELSE 0 END AS locationIsPerson') + ->addSelect('CASE WHEN locationHistory.personLocation IS NOT NULL THEN 0 ELSE 1 END AS locationIsTemp') + ->addSelect('IDENTITY(locationHistory.personLocation) AS locationPersonName') + ->addSelect('IDENTITY(locationHistory.personLocation) AS locationPersonId') + ->leftJoin('acp.locationHistories', 'locationHistory') + ->andWhere( + $qb->expr()->orX( + $qb->expr()->isNull('locationHistory'), + $qb->expr()->andX( + $qb->expr()->lte('locationHistory.startDate', ':calcDate'), + $qb->expr()->orX($qb->expr()->isNull('locationHistory.endDate'), $qb->expr()->gt('locationHistory.endDate', ':calcDate')) + ) + ) + ) + ->leftJoin( + PersonHouseholdAddress::class, + 'personAddress', + Join::WITH, + 'locationHistory.personLocation = personAddress.person AND (personAddress.validFrom <= :calcDate AND (personAddress.validTo IS NULL OR personAddress.validTo > :calcDate))' + ) + ->leftJoin(Address::class, 'acp_address', Join::WITH, 'COALESCE(IDENTITY(locationHistory.addressLocation), IDENTITY(personAddress.address)) = acp_address.id'); + + $this->addressHelper->addSelectClauses(ExportAddressHelper::F_ALL, $qb, 'acp_address', 'address_fields'); + + // requestor + $qb + ->addSelect('CASE WHEN acp.requestorPerson IS NULL THEN 1 ELSE 0 END AS isRequestorPerson') + ->addSelect('CASE WHEN acp.requestorPerson IS NULL THEN 0 ELSE 1 END AS isRequestorThirdParty') + ->addSelect('IDENTITY(acp.requestorPerson) AS requestorPersonId') + ->addSelect('IDENTITY(acp.requestorThirdParty) AS requestorThirdPartyId') + ->addSelect('IDENTITY(acp.requestorPerson) AS requestorPerson') + ->addSelect('IDENTITY(acp.requestorThirdParty) AS requestorThirdParty'); + + $qb + // scopes + ->addSelect('(SELECT AGGREGATE(scope.name) FROM ' . Scope::class . ' scope WHERE scope MEMBER OF acp.scopes) AS scopes') + // social issues + ->addSelect('(SELECT AGGREGATE(socialIssue.id) FROM ' . SocialIssue::class . ' socialIssue WHERE socialIssue MEMBER OF acp.socialIssues) AS socialIssues'); + + // add parameter + $qb->setParameter('calcDate', $calcDate); + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 2f7800e2b..08e51aeab 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1175,7 +1175,7 @@ export: referrerSince: Référent depuis le locationIsPerson: Parcours localisé auprès d'un usager concerné locationIsTemp: Parcours avec une localisation temporaire - acpLocationPersonName: Usager auprès duquel le parcours est localisé + locationPersonName: Usager auprès duquel le parcours est localisé locationPersonId: Identifiant de l'usager auprès duquel le parcours est localisé acpaddress_fieldscountry: Pays de l'adresse isRequestorPerson: Le demandeur est-il un usager ? From 56d9072abe971cf69f07a55a931e8becabe8fb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 09:33:03 +0200 Subject: [PATCH 037/750] change id, to avoid collision between ListPersonHelper and ListAccompanyingPeriodHelper --- .../Export/Helper/ListAccompanyingPeriodHelper.php | 6 ++++-- .../ChillPersonBundle/Export/Helper/ListPersonHelper.php | 7 ++++++- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index 8671b4977..a32d78904 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -32,7 +32,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class ListAccompanyingPeriodHelper { public const FIELDS = [ - 'id', + 'acpId', 'step', 'stepSince', 'openingDate', @@ -219,8 +219,10 @@ final readonly class ListAccompanyingPeriodHelper public function addSelectClauses(QueryBuilder $qb, \DateTimeImmutable $calcDate): void { + $qb->addSelect('acp.id AS acpId'); + // add the regular fields - foreach (['id', 'openingDate', 'closingDate', 'confidential', 'emergency', 'intensity', 'createdAt', 'updatedAt'] as $field) { + foreach (['openingDate', 'closingDate', 'confidential', 'emergency', 'intensity', 'createdAt', 'updatedAt'] as $field) { $qb->addSelect(sprintf('acp.%s AS %s', $field, $field)); } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 77a1d9c86..697019ca3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -42,7 +42,7 @@ use function strlen; class ListPersonHelper { public const FIELDS = [ - 'id', + 'personId', 'civility', 'firstName', 'lastName', @@ -124,6 +124,11 @@ class ListPersonHelper } switch ($f) { + case 'personId': + $qb->addSelect('person.id AS personId'); + + break; + case 'countryOfBirth': case 'nationality': $qb->addSelect(sprintf('IDENTITY(person.%s) as %s', $f, $f)); diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 08e51aeab..0a82fc330 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -997,6 +997,8 @@ notification: Notify referrer: Notifier le référent Notify any: Notifier d'autres utilisateurs +personId: Identifiant de l'usager + export: export: acp_stats: @@ -1152,7 +1154,7 @@ export: Generate a list of accompanying periods, filtered on different parameters.: Génère une liste des parcours d'accompagnement, filtrée sur différents paramètres. Date of calculation for associated elements: Date de calcul des éléments associés The associated referree, localisation, and other elements will be valid at this date: Les éléments associés, comme la localisation, le référent et d'autres éléments seront valides à cette date - id: Identifiant du parcours + acpId: Identifiant du parcours openingDate: Date d'ouverture du parcours closingDate: Date de fermeture du parcours closingMotive: Motif de cloture From 7f30742fc3615311500931f9d22563f228e3c752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 09:36:39 +0200 Subject: [PATCH 038/750] Rename ListPersonWithAccompanyingPeriod to ListPersonHavingAccompanyingPeriod --- ...ngPeriod.php => ListPersonHavingAccompanyingPeriod.php} | 7 ++++++- .../ChillPersonBundle/config/services/exports_person.yaml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Export/{ListPersonWithAccompanyingPeriod.php => ListPersonHavingAccompanyingPeriod.php} (96%) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php rename to src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php index 370046232..f2e4de4e3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php @@ -35,7 +35,12 @@ use function count; use function in_array; use function strlen; -class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface +/** + * List the persons, having an accompanying period. + * + * Details of the accompanying period are not included + */ +class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface { private ExportAddressHelper $addressHelper; diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index 64360aee9..81875fafb 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -24,7 +24,7 @@ services: tags: - { name: chill.export, alias: list_person } - Chill\PersonBundle\Export\Export\ListPersonWithAccompanyingPeriod: + Chill\PersonBundle\Export\Export\ListPersonHavingAccompanyingPeriod: autowire: true autoconfigure: true tags: From 17d2b795b41d9aee8457ad9ade199e07d1c5be60 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 7 Jul 2023 11:38:00 +0200 Subject: [PATCH 039/750] update changelog --- .changes/unreleased/DX-20230623-122408.yaml | 5 --- .../unreleased/Feature-20230623-122530.yaml | 5 --- .../unreleased/Feature-20230623-122702.yaml | 6 --- .../unreleased/Feature-20230623-124438.yaml | 5 --- .../unreleased/Fixed-20230628-170055.yaml | 6 --- .../unreleased/Fixed-20230629-124412.yaml | 6 --- .../unreleased/Fixed-20230629-231503.yaml | 5 --- .../unreleased/Fixed-20230630-171119.yaml | 5 --- .../unreleased/Fixed-20230630-171153.yaml | 5 --- .changie.yaml | 2 + CHANGELOG.md | 37 +++++++++++++++++++ .../Resources/public/chill/scss/forms.scss | 2 +- 12 files changed, 40 insertions(+), 49 deletions(-) delete mode 100644 .changes/unreleased/DX-20230623-122408.yaml delete mode 100644 .changes/unreleased/Feature-20230623-122530.yaml delete mode 100644 .changes/unreleased/Feature-20230623-122702.yaml delete mode 100644 .changes/unreleased/Feature-20230623-124438.yaml delete mode 100644 .changes/unreleased/Fixed-20230628-170055.yaml delete mode 100644 .changes/unreleased/Fixed-20230629-124412.yaml delete mode 100644 .changes/unreleased/Fixed-20230629-231503.yaml delete mode 100644 .changes/unreleased/Fixed-20230630-171119.yaml delete mode 100644 .changes/unreleased/Fixed-20230630-171153.yaml diff --git a/.changes/unreleased/DX-20230623-122408.yaml b/.changes/unreleased/DX-20230623-122408.yaml deleted file mode 100644 index 58dd96180..000000000 --- a/.changes/unreleased/DX-20230623-122408.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: DX -body: '[FilterOrderHelper] add entity choice and singleCheckbox' -time: 2023-06-23T12:24:08.133491895+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Feature-20230623-122530.yaml b/.changes/unreleased/Feature-20230623-122530.yaml deleted file mode 100644 index 922750ea8..000000000 --- a/.changes/unreleased/Feature-20230623-122530.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Feature -body: '[activity list] add filtering for activities list' -time: 2023-06-23T12:25:30.49643551+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Feature-20230623-122702.yaml b/.changes/unreleased/Feature-20230623-122702.yaml deleted file mode 100644 index e1d1b0e1f..000000000 --- a/.changes/unreleased/Feature-20230623-122702.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Feature -body: '[activity list] in person context, show also the activities from the accompanying - periods where the person participates' -time: 2023-06-23T12:27:02.159041095+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Feature-20230623-124438.yaml b/.changes/unreleased/Feature-20230623-124438.yaml deleted file mode 100644 index bc199d3bb..000000000 --- a/.changes/unreleased/Feature-20230623-124438.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Feature -body: '[activity list] add pagination to the list of activities' -time: 2023-06-23T12:44:38.879098862+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20230628-170055.yaml b/.changes/unreleased/Fixed-20230628-170055.yaml deleted file mode 100644 index 7f9ec3028..000000000 --- a/.changes/unreleased/Fixed-20230628-170055.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: '[export] Rename label for CurrentActionFilter (on accompanying period work) - to make precision between "ouvert" and "sans date de fin"' -time: 2023-06-28T17:00:55.206937751+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20230629-124412.yaml b/.changes/unreleased/Fixed-20230629-124412.yaml deleted file mode 100644 index 7fc3d3eb0..000000000 --- a/.changes/unreleased/Fixed-20230629-124412.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Force the db to have either a person_location or a address_location, and avoid - to have both also internally in the entity -time: 2023-06-29T12:44:12.019663991+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20230629-231503.yaml b/.changes/unreleased/Fixed-20230629-231503.yaml deleted file mode 100644 index e021d1fda..000000000 --- a/.changes/unreleased/Fixed-20230629-231503.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: '[export] set rolling date on person age aggregator' -time: 2023-06-29T23:15:03.20841309+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20230630-171119.yaml b/.changes/unreleased/Fixed-20230630-171119.yaml deleted file mode 100644 index f3185ace2..000000000 --- a/.changes/unreleased/Fixed-20230630-171119.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: '[export] fix list when a person locating a course is without address' -time: 2023-06-30T17:11:19.454081914+02:00 -custom: - Issue: "" diff --git a/.changes/unreleased/Fixed-20230630-171153.yaml b/.changes/unreleased/Fixed-20230630-171153.yaml deleted file mode 100644 index c09bd93d0..000000000 --- a/.changes/unreleased/Fixed-20230630-171153.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Fixed -body: '[export] remove unused condition on course about duration participation' -time: 2023-06-30T17:11:53.076615549+02:00 -custom: - Issue: "" diff --git a/.changie.yaml b/.changie.yaml index 8a25ed695..cda69de65 100644 --- a/.changie.yaml +++ b/.changie.yaml @@ -30,6 +30,8 @@ kinds: auto: patch - label: DX auto: patch + - label: UX + auto: patch newlines: afterChangelogHeader: 1 beforeChangelogVersion: 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 93ff93556..1f51bf06e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,43 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.4.0 - 2023-07-07 +### Feature +* [activity list] add filtering for activities list + + +* [activity list] in person context, show also the activities from the accompanying periods where the person participates + + +* [activity list] add pagination to the list of activities + + +* ([#118](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/118)) improve UX design for filterOrder box + + + + +### Fixed +* [export] Rename label for CurrentActionFilter (on accompanying period work) to make precision between "ouvert" and "sans date de fin" + + +* Force the db to have either a person_location or a address_location, and avoid to have both also internally in the entity + + +* [export] set rolling date on person age aggregator + + +* [export] fix list when a person locating a course is without address + + +* [export] remove unused condition on course about duration participation + + +### DX +* [FilterOrderHelper] add entity choice and singleCheckbox + + + ## v2.3.0 - 2023-06-27 ### Feature * ([#110](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/110)) Edit saved exports options: the saved exports options (forms, filters, aggregators) are now editable. diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss index a517a5516..28c597bc0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss @@ -44,5 +44,5 @@ form { } .chill_filter_order { - background: $gray-100; + background: $gray-100; } \ No newline at end of file From c8146ded17b332a3566b58b7c824840259b7f7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 12:36:24 +0200 Subject: [PATCH 040/750] Feature: add a list for people with their associated accompanying course --- .../unreleased/Feature-20230707-123609.yaml | 5 + .../Export/ExportInterface.php | 2 +- ...istPersonWithAccompanyingPeriodDetails.php | 149 ++++++++++++++++++ .../Helper/ListAccompanyingPeriodHelper.php | 39 +++-- .../Export/Helper/ListPersonHelper.php | 42 ++--- .../config/services/exports_person.yaml | 20 +-- .../translations/messages.fr.yml | 10 +- 7 files changed, 213 insertions(+), 54 deletions(-) create mode 100644 .changes/unreleased/Feature-20230707-123609.yaml create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php diff --git a/.changes/unreleased/Feature-20230707-123609.yaml b/.changes/unreleased/Feature-20230707-123609.yaml new file mode 100644 index 000000000..51ff94d4c --- /dev/null +++ b/.changes/unreleased/Feature-20230707-123609.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[export] Add a list for people with their associated course' +time: 2023-07-07T12:36:09.596469063+02:00 +custom: + Issue: "125" diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php index f357a9fdb..a11a51746 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php @@ -97,7 +97,7 @@ interface ExportInterface extends ExportElementInterface * @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR') * @param mixed $data The data from the export's form (as defined in `buildForm`) * - * @return callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }` + * @return (callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }` */ public function getLabels($key, array $values, $data); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php new file mode 100644 index 000000000..295d87842 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php @@ -0,0 +1,149 @@ +add('address_date', PickRollingDateType::class, [ + 'label' => 'Data valid at this date', + 'help' => 'Data regarding center, addresses, and so on will be computed at this date', + ]); + } + public function getFormDefaultData(): array + { + return ['address_date' => new RollingDate(RollingDate::T_TODAY)]; + } + + public function getAllowedFormattersTypes() + { + return [FormatterInterface::TYPE_LIST]; + } + + public function getDescription() + { + return 'export.list.person_with_acp.Create a list of people having an accompaying periods with details of period, according to various filters.'; + } + + public function getGroup(): string + { + return 'Exports of persons'; + } + + public function getLabels($key, array $values, $data) + { + if (in_array($key, $this->listPersonHelper->getAllKeys(), true)) { + return $this->listPersonHelper->getLabels($key, $values, $data); + } + + return $this->listAccompanyingPeriodHelper->getLabels($key, $values, $data); + } + + public function getQueryKeys($data) + { + return array_merge( + $this->listPersonHelper->getAllKeys(), + $this->listAccompanyingPeriodHelper->getQueryKeys($data), + ); + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); + } + + public function getTitle() + { + return 'export.list.person_with_acp.List peoples having an accompanying period with period details'; + } + + public function getType() + { + return Declarations::PERSON_TYPE; + } + + /** + * param array{fields: string[], address_date: DateTimeImmutable} $data. + */ + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->entityManager->createQueryBuilder(); + + $qb->from(Person::class, 'person') + ->join('person.accompanyingPeriodParticipations', 'acppart') + ->join('acppart.accompanyingPeriod', 'acp') + ->andWhere($qb->expr()->neq('acp.step', "'" . AccompanyingPeriod::STEP_DRAFT . "'")) + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM ' . PersonCenterHistory::class . ' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)' + ) + )->setParameter('authorized_centers', $centers); + + $this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date'])); + $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date'])); + + return $qb; + } + + public function requiredRole(): string + { + return PersonVoter::LISTS; + } + + public function supportsModifiers() + { + return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN, Declarations::ACP_TYPE]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index a32d78904..5fa2252cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -58,10 +58,10 @@ final readonly class ListAccompanyingPeriodHelper 'requestorThirdPartyId', 'scopes', 'socialIssues', - 'createdAt', - 'createdBy', - 'updatedAt', - 'updatedBy', + 'acpCreatedAt', + 'acpCreatedBy', + 'acpUpdatedAt', + 'acpUpdatedBy', ]; public function __construct( @@ -82,14 +82,14 @@ final readonly class ListAccompanyingPeriodHelper { return array_merge( ListAccompanyingPeriodHelper::FIELDS, - $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields') + $this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'acp_address_fields') ); } public function getLabels($key, array $values, $data) { - if (substr($key, 0, strlen('address_fields')) === 'address_fields') { - return $this->addressHelper->getLabel($key, $values, $data, 'address_fields'); + if (str_starts_with($key, 'acp_address_fields')) { + return $this->addressHelper->getLabel($key, $values, $data, 'acp_address_fields'); } switch ($key) { @@ -97,8 +97,8 @@ final readonly class ListAccompanyingPeriodHelper case 'openingDate': case 'closingDate': case 'referrerSince': - case 'createdAt': - case 'updatedAt': + case 'acpCreatedAt': + case 'acpUpdatedAt': return $this->dateTimeHelper->getLabel('export.list.acp.' . $key); case 'origin': @@ -220,14 +220,23 @@ final readonly class ListAccompanyingPeriodHelper public function addSelectClauses(QueryBuilder $qb, \DateTimeImmutable $calcDate): void { $qb->addSelect('acp.id AS acpId'); + $qb->addSelect('acp.createdAt AS acpCreatedAt'); + $qb->addSelect('acp.updatedAt AS acpUpdatedAt'); // add the regular fields - foreach (['openingDate', 'closingDate', 'confidential', 'emergency', 'intensity', 'createdAt', 'updatedAt'] as $field) { + foreach (['openingDate', 'closingDate', 'confidential', 'emergency', 'intensity'] as $field) { $qb->addSelect(sprintf('acp.%s AS %s', $field, $field)); } // add the field which are simple association - foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'createdBy' => 'label', 'updatedBy' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) { + $qb + ->leftJoin('acp.createdBy', "acp_created_by_t") + ->addSelect('acp_created_by_t.label AS acpCreatedBy'); + $qb + ->leftJoin('acp.updatedBy', "acp_updated_by_t") + ->addSelect('acp_updated_by_t.label AS acpUpdatedBy'); + + foreach (['origin' => 'label', 'closingMotive' => 'name', 'job' => 'label', 'administrativeLocation' => 'name'] as $entity => $field) { $qb ->leftJoin(sprintf('acp.%s', $entity), "{$entity}_t") ->addSelect(sprintf('%s_t.%s AS %s', $entity, $field, $entity)); @@ -279,13 +288,13 @@ final readonly class ListAccompanyingPeriodHelper ) ->leftJoin( PersonHouseholdAddress::class, - 'personAddress', + 'acpPersonAddress', Join::WITH, - 'locationHistory.personLocation = personAddress.person AND (personAddress.validFrom <= :calcDate AND (personAddress.validTo IS NULL OR personAddress.validTo > :calcDate))' + 'locationHistory.personLocation = acpPersonAddress.person AND (acpPersonAddress.validFrom <= :calcDate AND (acpPersonAddress.validTo IS NULL OR acpPersonAddress.validTo > :calcDate))' ) - ->leftJoin(Address::class, 'acp_address', Join::WITH, 'COALESCE(IDENTITY(locationHistory.addressLocation), IDENTITY(personAddress.address)) = acp_address.id'); + ->leftJoin(Address::class, 'acp_address', Join::WITH, 'COALESCE(IDENTITY(locationHistory.addressLocation), IDENTITY(acpPersonAddress.address)) = acp_address.id'); - $this->addressHelper->addSelectClauses(ExportAddressHelper::F_ALL, $qb, 'acp_address', 'address_fields'); + $this->addressHelper->addSelectClauses(ExportAddressHelper::F_ALL, $qb, 'acp_address', 'acp_address_fields'); // requestor $qb diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 697019ca3..198794326 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Helper; +use Chill\MainBundle\Entity\Language; use Chill\MainBundle\Export\Helper\ExportAddressHelper; use Chill\MainBundle\Repository\CenterRepositoryInterface; use Chill\MainBundle\Repository\CivilityRepositoryInterface; @@ -114,7 +115,26 @@ class ListPersonHelper } /** - * @param array|value-of[] $fields + * Those keys are the "direct" keys, which are created when we decide to use to list all the keys. + * + * This method must be used in `getKeys` instead of the `self::FIELDS` + * + * @return array + */ + public function getAllKeys(): array + { + return [ + ...array_filter( + ListPersonHelper::FIELDS, + fn (string $key) => !in_array($key, ['address_fields', 'lifecycleUpdate'], true) + ), + ...$this->addressHelper->getKeys(ExportAddressHelper::F_ALL, 'address_fields'), + ...['createdAt', 'createdBy', 'updatedAt', 'updatedBy'], + ]; + } + + /** + * @param array> $fields */ public function addSelect(QueryBuilder $qb, array $fields, DateTimeImmutable $computedDate): void { @@ -143,25 +163,7 @@ class ListPersonHelper break; case 'spokenLanguages': - $qb - ->leftJoin('person.spokenLanguages', 'spokenLanguage') - ->addSelect('AGGREGATE(spokenLanguage.id) AS spokenLanguages') - ->addGroupBy('person'); - - if (in_array('center', $fields, true)) { - $qb->addGroupBy('center'); - } - - if (in_array('address_fields', $fields, true)) { - $qb - ->addGroupBy('address_fieldsid') - ->addGroupBy('address_fieldscountry_t.id') - ->addGroupBy('address_fieldspostcode_t.id'); - } - - if (in_array('household_id', $fields, true)) { - $qb->addGroupBy('household_id'); - } + $qb->addSelect('(SELECT AGGREGATE(language.id) FROM ' . Language::class . ' language WHERE language MEMBER OF person.spokenLanguages) AS spokenLanguages'); break; diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index 81875fafb..43f5556cf 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -4,35 +4,27 @@ services: autowire: true ## Indicators - chill.person.export.count_person: - class: Chill\PersonBundle\Export\Export\CountPerson - autowire: true - autoconfigure: true + Chill\PersonBundle\Export\Export\CountPerson: tags: - { name: chill.export, alias: count_person } - chill.person.export.count_person_with_accompanying_course: - class: Chill\PersonBundle\Export\Export\CountPersonWithAccompanyingCourse - autowire: true - autoconfigure: true + Chill\PersonBundle\Export\Export\CountPersonWithAccompanyingCourse: tags: - { name: chill.export, alias: count_person_with_accompanying_course } Chill\PersonBundle\Export\Export\ListPerson: - autowire: true - autoconfigure: true tags: - { name: chill.export, alias: list_person } Chill\PersonBundle\Export\Export\ListPersonHavingAccompanyingPeriod: - autowire: true - autoconfigure: true tags: - { name: chill.export, alias: list_person_with_acp } + Chill\PersonBundle\Export\Export\ListPersonWithAccompanyingPeriodDetails: + tags: + - { name: chill.export, alias: list_person_with_acp_details } + Chill\PersonBundle\Export\Export\ListAccompanyingPeriod: - autowire: true - autoconfigure: true tags: - { name: chill.export, alias: list_acp } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 0a82fc330..1159b2c49 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1148,7 +1148,9 @@ export: list: person_with_acp: List peoples having an accompanying period: Liste des usagers ayant un parcours d'accompagnement + List peoples having an accompanying period with period details: Liste des usagers concernés avec détail de chaque parcours Create a list of people having an accompaying periods, according to various filters.: Génère une liste des usagers ayant un parcours d'accompagnement, selon différents critères liés au parcours ou à l'usager + Create a list of people having an accompaying periods with details of period, according to various filters.: Génère une liste des usagers ayant un parcours d'accompagnement, selon différents critères liés au parcours ou à l'usager. Ajoute les détails du parcours à la liste. acp: List of accompanying periods: Liste des parcours d'accompagnements Generate a list of accompanying periods, filtered on different parameters.: Génère une liste des parcours d'accompagnement, filtrée sur différents paramètres. @@ -1162,14 +1164,14 @@ export: confidential: Confidentiel emergency: Urgent intensity: Intensité - createdAt: Créé le - updatedAt: Dernière mise à jour le + acpCreatedAt: Créé le + acpUpdatedAt: Dernière mise à jour le acpOrigin: Origine du parcours origin: Origine du parcours acpClosingMotive: Motif de fermeture acpJob: Métier du parcours - createdBy: Créé par - updatedBy: Dernière modification par + acpCreatedBy: Créé par + acpUpdatedBy: Dernière modification par administrativeLocation: Location administrative step: Etape stepSince: Dernière modification de l'étape From 63f9bd554897e1363d0b321c9e80c28e2b7745bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 12:42:32 +0200 Subject: [PATCH 041/750] [export] Add ordering by person''s lastname or course opening date in list which concerns accompanying course or people --- .changes/unreleased/Feature-20230707-124132.yaml | 6 ++++++ .../Export/Export/ListAccompanyingPeriod.php | 5 +++++ .../Export/Export/ListPersonHavingAccompanyingPeriod.php | 5 +++++ .../Export/ListPersonWithAccompanyingPeriodDetails.php | 6 ++++++ 4 files changed, 22 insertions(+) create mode 100644 .changes/unreleased/Feature-20230707-124132.yaml diff --git a/.changes/unreleased/Feature-20230707-124132.yaml b/.changes/unreleased/Feature-20230707-124132.yaml new file mode 100644 index 000000000..4ad93ad22 --- /dev/null +++ b/.changes/unreleased/Feature-20230707-124132.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: '[export] Add ordering by person''s lastname or course opening date in list + which concerns accompanying course or peoples' +time: 2023-07-07T12:41:32.112725962+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 3f7821bbc..ab9c0db2f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -133,6 +133,11 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $qb + ->addOrderBy('acp.openingDate') + ->addOrderBy('acp.closingDate') + ->addOrderBy('acp.id'); + return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php index f2e4de4e3..408d0b3af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonHavingAccompanyingPeriod.php @@ -190,6 +190,11 @@ class ListPersonHavingAccompanyingPeriod implements ExportElementValidatedInterf $this->listPersonHelper->addSelect($qb, $fields, $data['address_date']); + $qb + ->addOrderBy('person.lastName') + ->addOrderBy('person.firstName') + ->addOrderBy('person.id'); + return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php index 295d87842..ddb16bb2d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php @@ -134,6 +134,12 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte $this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date'])); $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date'])); + $qb + ->addOrderBy('person.lastName') + ->addOrderBy('person.firstName') + ->addOrderBy('person.id') + ->addOrderBy('acp.id'); + return $qb; } From 20e64e87680d102c686000f1c35d0139d00eecdf Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 7 Jul 2023 15:41:29 +0200 Subject: [PATCH 042/750] test filterOrder in an accordion --- .../views/FilterOrder/base.html.twig | 162 ++++++++++-------- 1 file changed, 86 insertions(+), 76 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index b2673b60c..f642c82aa 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -1,92 +1,102 @@ {{ form_start(form) }} - {% set btnSubmit = 0 %} -
-
- {% if form.vars.has_search_box %} -
-
- {{ form_widget(form.q) }} - -
-
- {% endif %} -
- {% if form.dateRanges is defined %} - {% set btnSubmit = 1 %} - {% if form.dateRanges|length > 0 %} - {% for dateRangeName, _o in form.dateRanges %} -
- {% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} - {{ form_label(form.dateRanges[dateRangeName])}} - {% else %} -
{{ 'activity_filter.By date'|trans }}
- {% endif %} -
-
- {{ 'chill_calendar.From'|trans }} - {{ form_widget(form.dateRanges[dateRangeName]['from']) }} - {{ 'chill_calendar.To'|trans }} - {{ form_widget(form.dateRanges[dateRangeName]['to']) }} -
+
+

+ +

+
+ {% set btnSubmit = 0 %} +
+
+ {% if form.vars.has_search_box %} +
+
+ {{ form_widget(form.q) }} +
- {% endfor %} + {% endif %} +
+ {% if form.dateRanges is defined %} + {% set btnSubmit = 1 %} + {% if form.dateRanges|length > 0 %} + {% for dateRangeName, _o in form.dateRanges %} +
+ {% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} + {{ form_label(form.dateRanges[dateRangeName])}} + {% else %} +
{{ 'activity_filter.By date'|trans }}
+ {% endif %} +
+
+ {{ 'chill_calendar.From'|trans }} + {{ form_widget(form.dateRanges[dateRangeName]['from']) }} + {{ 'chill_calendar.To'|trans }} + {{ form_widget(form.dateRanges[dateRangeName]['to']) }} +
+
+
+ {% endfor %} + {% endif %} {% endif %} - {% endif %} - {% if form.checkboxes is defined %} - {% set btnSubmit = 1 %} - {% if form.checkboxes|length > 0 %} - {% for checkbox_name, options in form.checkboxes %} + {% if form.checkboxes is defined %} + {% set btnSubmit = 1 %} + {% if form.checkboxes|length > 0 %} + {% for checkbox_name, options in form.checkboxes %} +
+
{{ 'activity_filter.By'|trans }}
+
+ {% for c in form['checkboxes'][checkbox_name].children %} + {{ form_widget(c) }} + {{ form_label(c) }} + {% endfor %} +
+
+ {% endfor %} + {% endif %} + {% endif %} + {% if form.entity_choices is defined %} + {% set btnSubmit = 1 %} + {% if form.entity_choices |length > 0 %} + {% for checkbox_name, options in form.entity_choices %} +
+ {% if form.entity_choices[checkbox_name].vars.label is not same as(false) %} + {{ form_label(form.entity_choices[checkbox_name])}} + {% endif %} +
+ {% for c in form['entity_choices'][checkbox_name].children %} + {{ form_widget(c) }} + {{ form_label(c) }} + {% endfor %} +
+
+ {% endfor %} + {% endif %} + {% endif %} + {% if form.single_checkboxes is defined %} + {% set btnSubmit = 1 %} + {% for name, _o in form.single_checkboxes %}
{{ 'activity_filter.By'|trans }}
- {% for c in form['checkboxes'][checkbox_name].children %} - {{ form_widget(c) }} - {{ form_label(c) }} - {% endfor %} + {{ form_widget(form.single_checkboxes[name]) }}
{% endfor %} {% endif %} - {% endif %} - {% if form.entity_choices is defined %} - {% set btnSubmit = 1 %} - {% if form.entity_choices |length > 0 %} - {% for checkbox_name, options in form.entity_choices %} -
- {% if form.entity_choices[checkbox_name].vars.label is not same as(false) %} - {{ form_label(form.entity_choices[checkbox_name])}} - {% endif %} -
- {% for c in form['entity_choices'][checkbox_name].children %} - {{ form_widget(c) }} - {{ form_label(c) }} - {% endfor %} -
-
- {% endfor %} - {% endif %} - {% endif %} - {% if form.single_checkboxes is defined %} - {% set btnSubmit = 1 %} - {% for name, _o in form.single_checkboxes %} + + {% if btnSubmit == 1 %}
-
{{ 'activity_filter.By'|trans }}
-
- {{ form_widget(form.single_checkboxes[name]) }} -
+
- {% endfor %} - {% endif %} - - {% if btnSubmit == 1 %} -
- -
- {% endif %} + {% endif %} +
+
- {% for k,v in otherParameters %} - - {% endfor %} +{% for k,v in otherParameters %} + +{% endfor %} {{ form_end(form) }} + From 6bdb3e969538bc3cf0ad3458d5015d3ab180626e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jul 2023 21:49:36 +0200 Subject: [PATCH 043/750] fix typo which prevent to apply a filter on activity types --- .../ChillActivityBundle/Controller/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 9b6e69bf0..1e911ff08 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -259,7 +259,7 @@ final class ActivityController extends AbstractController $filterArgs = [ 'my_activities' => $filter->getSingleCheckboxData('my_activities'), - 'types' => $filter->hasEntityChoice('activity_type') ? $filter->getEntityChoiceData('activity_types') : [], + 'types' => $filter->hasEntityChoice('activity_types') ? $filter->getEntityChoiceData('activity_types') : [], 'jobs' => $filter->hasEntityChoice('jobs') ? $filter->getEntityChoiceData('jobs') : [], 'before' => $filter->getDateRangeData('activity_date')['to'], 'after' => $filter->getDateRangeData('activity_date')['from'], From 39896ea6e26e3cb2392830b2e18c9bb8f396cefe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 10 Jul 2023 15:26:54 +0200 Subject: [PATCH 044/750] [FilterOrder] add a method to get all the active filters --- .../Form/Type/Listing/FilterOrderType.php | 25 +++--- .../views/FilterOrder/base.html.twig | 13 ++- .../Templating/Listing/FilterOrderHelper.php | 79 ++++++++++++++++--- .../Listing/FilterOrderHelperBuilder.php | 10 ++- .../Listing/FilterOrderHelperFactory.php | 8 +- .../Listing/FilterOrderPositionEnum.php | 12 +++ .../translations/messages+intl-icu.fr.yaml | 5 ++ 7 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index 1f373400c..d16ce3813 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -47,16 +47,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType $checkboxesBuilder = $builder->create('checkboxes', null, ['compound' => true]); foreach ($helper->getCheckboxes() as $name => $c) { - $choices = array_combine( - array_map(static function ($c, $t) { - if (null !== $t) { - return $t; - } - - return $c; - }, $c['choices'], $c['trans']), - $c['choices'] - ); + $choices = self::buildCheckboxChoices($c['choices'], $c['trans']); $checkboxesBuilder->add($name, ChoiceType::class, [ 'choices' => $choices, @@ -125,6 +116,20 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType } } + public static function buildCheckboxChoices(array $choices, array $trans = []): array + { + return array_combine( + array_map(static function ($c, $t) { + if (null !== $t) { + return $t; + } + + return $c; + }, $choices, $trans), + $choices + ); + } + public function buildView(FormView $view, FormInterface $form, array $options) { /** @var FilterOrderHelper $helper */ diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index f642c82aa..4de7604cf 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -85,7 +85,7 @@
{% endfor %} {% endif %} - + {% if btnSubmit == 1 %}
@@ -93,6 +93,17 @@ {% endif %}
+ {% set active = helper.getActiveFilters() %} + {% if active|length > 0 %} +
+ {% for f in active %} + {% if f.label != '' %}{{ f.label|trans }} : {% endif %}{{ f.value }} + {% endfor %} +
+ {% endif %} +
+ +
{% for k,v in otherParameters %} diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index c0ef1cd89..a038dfd71 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -13,16 +13,19 @@ namespace Chill\MainBundle\Templating\Listing; use Chill\MainBundle\Form\Type\Listing\FilterOrderType; use DateTimeImmutable; -use Symfony\Component\Form\Extension\Core\Type\FormType; -use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\PropertyAccess\PropertyAccessor; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\PropertyAccess\PropertyPathInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use function array_merge; use function count; -class FilterOrderHelper +final class FilterOrderHelper { private array $checkboxes = []; @@ -33,16 +36,12 @@ class FilterOrderHelper private array $dateRanges = []; - private FormFactoryInterface $formFactory; - public const FORM_NAME = 'f'; private array $formOptions = []; private string $formType = FilterOrderType::class; - private RequestStack $requestStack; - private ?array $searchBoxFields = null; private ?array $submitted = null; @@ -52,12 +51,13 @@ class FilterOrderHelper */ private array $entityChoices = []; + public function __construct( - FormFactoryInterface $formFactory, - RequestStack $requestStack + private readonly FormFactoryInterface $formFactory, + private readonly RequestStack $requestStack, + private readonly TranslatorInterface $translator, + private readonly PropertyAccessorInterface $propertyAccessor, ) { - $this->formFactory = $formFactory; - $this->requestStack = $requestStack; } public function addSingleCheckbox(string $name, string $label): self @@ -199,6 +199,63 @@ class FilterOrderHelper return $this; } + /** + * Return all the data required to display the active filters + * + * @return array + */ + public function getActiveFilters(): array + { + $result = []; + + if ($this->hasSearchBox() && '' !== $this->getQueryString()) { + $result[] = ['label' => '', 'value' => $this->getQueryString(), 'position' => FilterOrderPositionEnum::SearchBox->value, 'name' => 'q']; + } + + foreach ($this->dateRanges as $name => ['label' => $label]) { + $base = ['position' => FilterOrderPositionEnum::DateRange->value, 'name' => $name, 'label' => (string) $label]; + + if (null !== ($from = $this->getDateRangeData($name)['from'] ?? null)) { + $result[] = ['value' => $this->translator->trans('filter_order.by_date.From', ['from_date' => $from]), ...$base]; + } + if (null !== ($to = $this->getDateRangeData($name)['to'] ?? null)) { + $result[] = ['value' => $this->translator->trans('filter_order.by_date.To', ['to_date' => $to]), ...$base]; + } + } + + foreach ($this->checkboxes as $name => ['choices' => $choices, 'trans' => $trans, 'options' => $options]) { + foreach ($this->getCheckboxData($name) as $keyChoice) { + $result[] = ['value' => $choices['keyChoice'], 'label' => $options['label'], 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; + } + } + + foreach ($this->entityChoices as $name => ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options]) { + foreach ($this->getEntityChoiceData($name) as $selected) { + if (is_callable($options['choice_label'])) { + $value = call_user_func($options['choice_label'], $selected); + } elseif ($options['choice_label'] instanceof PropertyPathInterface || is_string($options['choice_label'])) { + $value = $this->propertyAccessor->getValue($selected, $options['choice_label']); + } else { + if (!$selected instanceof \Stringable) { + throw new \UnexpectedValueException(sprintf("we are not able to transform the value of %s to a string. Implements \Stringable or add a 'choice_label' option to the filterFormBuilder", get_class($selected))); + } + + $value = (string) $selected; + } + + $result[] = ['value' => $value, 'label' => $label, 'position' => FilterOrderPositionEnum::EntityChoice->value, 'name' => $name]; + } + } + + foreach ($this->singleCheckbox as $name => ['label' => $label]) { + if (true === $this->getSingleCheckboxData($name)) { + $result[] = ['label' => '', 'value' => $this->translator->trans($label), 'position' => FilterOrderPositionEnum::SingleCheckbox->value, 'name' => $name]; + } + } + + return $result; + } + private function getDefaultData(): array { $r = [ diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index e176e27c6..dfa361f6e 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -14,6 +14,8 @@ namespace Chill\MainBundle\Templating\Listing; use DateTimeImmutable; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class FilterOrderHelperBuilder { @@ -39,7 +41,9 @@ class FilterOrderHelperBuilder public function __construct( FormFactoryInterface $formFactory, - RequestStack $requestStack + RequestStack $requestStack, + private readonly TranslatorInterface $translator, + private readonly PropertyAccessorInterface $propertyAccessor, ) { $this->formFactory = $formFactory; $this->requestStack = $requestStack; @@ -87,7 +91,9 @@ class FilterOrderHelperBuilder { $helper = new FilterOrderHelper( $this->formFactory, - $this->requestStack + $this->requestStack, + $this->translator, + $this->propertyAccessor ); $helper->setSearchBox($this->searchBoxFields); diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index c88c71af5..3fbb2864d 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -13,6 +13,8 @@ namespace Chill\MainBundle\Templating\Listing; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface { @@ -22,7 +24,9 @@ class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface public function __construct( FormFactoryInterface $formFactory, - RequestStack $requestStack + RequestStack $requestStack, + private readonly TranslatorInterface $translator, + private readonly PropertyAccessorInterface $propertyAccessor, ) { $this->formFactory = $formFactory; $this->requestStack = $requestStack; @@ -30,6 +34,6 @@ class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface public function create(string $context, ?array $options = []): FilterOrderHelperBuilder { - return new FilterOrderHelperBuilder($this->formFactory, $this->requestStack); + return new FilterOrderHelperBuilder($this->formFactory, $this->requestStack, $this->translator, $this->propertyAccessor); } } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php new file mode 100644 index 000000000..cda8119f5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php @@ -0,0 +1,12 @@ + Date: Mon, 10 Jul 2023 15:39:00 +0200 Subject: [PATCH 045/750] [filterOrder] fix error in method getActiveFilters when dealing with entityChoice with incorrect number of translation --- .../Templating/Listing/FilterOrderHelper.php | 13 ++++++++----- .../Templating/Listing/FilterOrderPositionEnum.php | 9 +++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index a038dfd71..701238208 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -84,9 +84,11 @@ final class FilterOrderHelper public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = [], array $options = []): self { - $missing = count($choices) - count($trans) - 1; + $missing = count($choices) - count($trans); + $this->checkboxes[$name] = [ - 'choices' => $choices, 'default' => $default, + 'choices' => $choices, + 'default' => $default, 'trans' => array_merge( $trans, 0 < $missing ? @@ -223,9 +225,10 @@ final class FilterOrderHelper } } - foreach ($this->checkboxes as $name => ['choices' => $choices, 'trans' => $trans, 'options' => $options]) { + foreach ($this->checkboxes as $name => ['choices' => $choices, 'trans' => $trans]) { + $translatedChoice = array_combine($choices, [...$trans]); foreach ($this->getCheckboxData($name) as $keyChoice) { - $result[] = ['value' => $choices['keyChoice'], 'label' => $options['label'], 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; + $result[] = ['value' => $translatedChoice[$keyChoice], 'label' => '', 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; } } @@ -237,7 +240,7 @@ final class FilterOrderHelper $value = $this->propertyAccessor->getValue($selected, $options['choice_label']); } else { if (!$selected instanceof \Stringable) { - throw new \UnexpectedValueException(sprintf("we are not able to transform the value of %s to a string. Implements \Stringable or add a 'choice_label' option to the filterFormBuilder", get_class($selected))); + throw new \UnexpectedValueException(sprintf("we are not able to transform the value of %s to a string. Implements \\Stringable or add a 'choice_label' option to the filterFormBuilder", get_class($selected))); } $value = (string) $selected; diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php index cda8119f5..09e8d39aa 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderPositionEnum.php @@ -1,5 +1,14 @@ Date: Mon, 10 Jul 2023 15:55:05 +0200 Subject: [PATCH 046/750] render active filters like pills --- .../Resources/views/FilterOrder/base.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index 4de7604cf..7a05a2f80 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -95,9 +95,9 @@
{% set active = helper.getActiveFilters() %} {% if active|length > 0 %} -
+
{% for f in active %} - {% if f.label != '' %}{{ f.label|trans }} : {% endif %}{{ f.value }} + {% if f.label != '' %}{{ f.label|trans }} : {% endif %}{{ f.value }} {% endfor %}
{% endif %} From 0d365e16e58df1614b132fc4b1fa2dc655458e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 10 Jul 2023 15:59:17 +0200 Subject: [PATCH 047/750] add missing translations --- .../ChillMainBundle/Templating/Listing/FilterOrderHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 701238208..2b24ffa0d 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -228,7 +228,7 @@ final class FilterOrderHelper foreach ($this->checkboxes as $name => ['choices' => $choices, 'trans' => $trans]) { $translatedChoice = array_combine($choices, [...$trans]); foreach ($this->getCheckboxData($name) as $keyChoice) { - $result[] = ['value' => $translatedChoice[$keyChoice], 'label' => '', 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; + $result[] = ['value' => $this->translator->trans($translatedChoice[$keyChoice]), 'label' => '', 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; } } @@ -246,7 +246,7 @@ final class FilterOrderHelper $value = (string) $selected; } - $result[] = ['value' => $value, 'label' => $label, 'position' => FilterOrderPositionEnum::EntityChoice->value, 'name' => $name]; + $result[] = ['value' => $this->translator->trans($value), 'label' => $label, 'position' => FilterOrderPositionEnum::EntityChoice->value, 'name' => $name]; } } From bf93c1ddb21f2bcbb28d42094b4f0d7c4cc78ef5 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 11 Jul 2023 14:06:10 +0200 Subject: [PATCH 048/750] fix label color in active filters pills --- .../translations/messages.fr.yml | 3 --- .../Form/Type/Listing/FilterOrderType.php | 2 +- .../Resources/views/FilterOrder/base.html.twig | 16 ++++++++++++---- .../translations/messages+intl-icu.fr.yaml | 4 ++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 3099e99b0..c53a04f31 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -96,9 +96,6 @@ activity_filter: My activities: Mes échanges (où j'interviens) Types: Par type d'échange Jobs: Par métier impliqué - By: Filtrer par - Search: Chercher dans la liste - By date: Filtrer par date #timeline '%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"' diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php index d16ce3813..f22b6bfba 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php @@ -39,7 +39,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType 'label' => false, 'required' => false, 'attr' => [ - 'placeholder' => 'activity_filter.Search', + 'placeholder' => 'filter_order.Search', ] ]); } diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index 7a05a2f80..0dcc4ce3f 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -26,7 +26,7 @@ {% if form.dateRanges[dateRangeName].vars.label is not same as(false) %} {{ form_label(form.dateRanges[dateRangeName])}} {% else %} -
{{ 'activity_filter.By date'|trans }}
+
{{ 'filter_order.By date'|trans }}
{% endif %}
@@ -45,7 +45,7 @@ {% if form.checkboxes|length > 0 %} {% for checkbox_name, options in form.checkboxes %}
-
{{ 'activity_filter.By'|trans }}
+
{{ 'filter_order.By'|trans }}
{% for c in form['checkboxes'][checkbox_name].children %} {{ form_widget(c) }} @@ -78,7 +78,7 @@ {% set btnSubmit = 1 %} {% for name, _o in form.single_checkboxes %}
-
{{ 'activity_filter.By'|trans }}
+
{{ 'filter_order.By'|trans }}
{{ form_widget(form.single_checkboxes[name]) }}
@@ -97,7 +97,15 @@ {% if active|length > 0 %}
{% for f in active %} - {% if f.label != '' %}{{ f.label|trans }} : {% endif %}{{ f.value }} + + {%- if f.label != '' %} + {{ f.label|trans }} : + {% endif -%} + {%- if f.position == 'search_box' and f.value is not null %} + {{ 'filter_order.search_box'|trans ~ ' :' }} + {% endif -%} + {{ f.value}}{# + #} {% endfor %}
{% endif %} diff --git a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml index e1dc89dc2..96b2edd98 100644 --- a/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillMainBundle/translations/messages+intl-icu.fr.yaml @@ -59,3 +59,7 @@ filter_order: by_date: From: Depuis le {from_date, date, long} To: Jusqu'au {to_date, date, long} + By: Filtrer par + Search: Chercher dans la liste + By date: Filtrer par date + search_box: Filtrer par contenu From 88114e3ba69fbd97a27eb850600acc78e27f526a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 11 Jul 2023 14:17:02 +0200 Subject: [PATCH 049/750] Fixed: [filterOrder] refactor active filter helper to a dedicated class and fix loading of multiple entity choices --- .../views/FilterOrder/base.html.twig | 1 - .../FilterOrderGetActiveFilterHelper.php | 84 +++++++++++++++++++ .../Templating/Listing/FilterOrderHelper.php | 70 +--------------- .../Listing/FilterOrderHelperBuilder.php | 4 - .../Listing/FilterOrderHelperFactory.php | 4 +- .../Templating/Listing/Templating.php | 2 + 6 files changed, 91 insertions(+), 74 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php diff --git a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig index 0dcc4ce3f..b517eb154 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/FilterOrder/base.html.twig @@ -93,7 +93,6 @@ {% endif %}
- {% set active = helper.getActiveFilters() %} {% if active|length > 0 %}
{% for f in active %} diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php new file mode 100644 index 000000000..6b204e552 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php @@ -0,0 +1,84 @@ + + */ + public function getActiveFilters(FilterOrderHelper $filterOrderHelper): array + { + $result = []; + + if ($filterOrderHelper->hasSearchBox() && '' !== $filterOrderHelper->getQueryString()) { + $result[] = ['label' => '', 'value' => $filterOrderHelper->getQueryString(), 'position' => FilterOrderPositionEnum::SearchBox->value, 'name' => 'q']; + } + + foreach ($filterOrderHelper->getDateRanges() as $name => ['label' => $label]) { + $base = ['position' => FilterOrderPositionEnum::DateRange->value, 'name' => $name, 'label' => (string)$label]; + + if (null !== ($from = $filterOrderHelper->getDateRangeData($name)['from'] ?? null)) { + $result[] = ['value' => $this->translator->trans('filter_order.by_date.From', ['from_date' => $from]), ...$base]; + } + if (null !== ($to = $filterOrderHelper->getDateRangeData($name)['to'] ?? null)) { + $result[] = ['value' => $this->translator->trans('filter_order.by_date.To', ['to_date' => $to]), ...$base]; + } + } + + foreach ($filterOrderHelper->getCheckboxes() as $name => ['choices' => $choices, 'trans' => $trans]) { + $translatedChoice = array_combine($choices, [...$trans]); + foreach ($filterOrderHelper->getCheckboxData($name) as $keyChoice) { + $result[] = ['value' => $this->translator->trans($translatedChoice[$keyChoice]), 'label' => '', 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; + } + } + + foreach ($filterOrderHelper->getEntityChoices() as $name => ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options]) { + foreach ($filterOrderHelper->getEntityChoiceData($name) as $selected) { + if (is_callable($options['choice_label'])) { + $value = call_user_func($options['choice_label'], $selected); + } elseif ($options['choice_label'] instanceof PropertyPathInterface || is_string($options['choice_label'])) { + $value = $this->propertyAccessor->getValue($selected, $options['choice_label']); + } else { + if (!$selected instanceof \Stringable) { + throw new \UnexpectedValueException(sprintf("we are not able to transform the value of %s to a string. Implements \\Stringable or add a 'choice_label' option to the filterFormBuilder", get_class($selected))); + } + + $value = (string)$selected; + } + + $result[] = ['value' => $this->translator->trans($value), 'label' => $label, 'position' => FilterOrderPositionEnum::EntityChoice->value, 'name' => $name]; + } + } + + foreach ($filterOrderHelper->getSingleCheckbox() as $name => ['label' => $label]) { + if (true === $filterOrderHelper->getSingleCheckboxData($name)) { + $result[] = ['label' => '', 'value' => $this->translator->trans($label), 'position' => FilterOrderPositionEnum::SingleCheckbox->value, 'name' => $name]; + } + } + + return $result; + } +} diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 2b24ffa0d..84939a052 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -55,8 +55,6 @@ final class FilterOrderHelper public function __construct( private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack, - private readonly TranslatorInterface $translator, - private readonly PropertyAccessorInterface $propertyAccessor, ) { } @@ -84,16 +82,14 @@ final class FilterOrderHelper public function addCheckbox(string $name, array $choices, ?array $default = [], ?array $trans = [], array $options = []): self { - $missing = count($choices) - count($trans); + if ([] === $trans) { + $trans = $choices; + } $this->checkboxes[$name] = [ 'choices' => $choices, 'default' => $default, - 'trans' => array_merge( - $trans, - 0 < $missing ? - array_fill(0, $missing, null) : [] - ), + 'trans' => $trans, ...$options, ]; @@ -201,64 +197,6 @@ final class FilterOrderHelper return $this; } - /** - * Return all the data required to display the active filters - * - * @return array - */ - public function getActiveFilters(): array - { - $result = []; - - if ($this->hasSearchBox() && '' !== $this->getQueryString()) { - $result[] = ['label' => '', 'value' => $this->getQueryString(), 'position' => FilterOrderPositionEnum::SearchBox->value, 'name' => 'q']; - } - - foreach ($this->dateRanges as $name => ['label' => $label]) { - $base = ['position' => FilterOrderPositionEnum::DateRange->value, 'name' => $name, 'label' => (string) $label]; - - if (null !== ($from = $this->getDateRangeData($name)['from'] ?? null)) { - $result[] = ['value' => $this->translator->trans('filter_order.by_date.From', ['from_date' => $from]), ...$base]; - } - if (null !== ($to = $this->getDateRangeData($name)['to'] ?? null)) { - $result[] = ['value' => $this->translator->trans('filter_order.by_date.To', ['to_date' => $to]), ...$base]; - } - } - - foreach ($this->checkboxes as $name => ['choices' => $choices, 'trans' => $trans]) { - $translatedChoice = array_combine($choices, [...$trans]); - foreach ($this->getCheckboxData($name) as $keyChoice) { - $result[] = ['value' => $this->translator->trans($translatedChoice[$keyChoice]), 'label' => '', 'position' => FilterOrderPositionEnum::Checkboxes->value, 'name' => $name]; - } - } - - foreach ($this->entityChoices as $name => ['label' => $label, 'class' => $class, 'choices' => $choices, 'options' => $options]) { - foreach ($this->getEntityChoiceData($name) as $selected) { - if (is_callable($options['choice_label'])) { - $value = call_user_func($options['choice_label'], $selected); - } elseif ($options['choice_label'] instanceof PropertyPathInterface || is_string($options['choice_label'])) { - $value = $this->propertyAccessor->getValue($selected, $options['choice_label']); - } else { - if (!$selected instanceof \Stringable) { - throw new \UnexpectedValueException(sprintf("we are not able to transform the value of %s to a string. Implements \\Stringable or add a 'choice_label' option to the filterFormBuilder", get_class($selected))); - } - - $value = (string) $selected; - } - - $result[] = ['value' => $this->translator->trans($value), 'label' => $label, 'position' => FilterOrderPositionEnum::EntityChoice->value, 'name' => $name]; - } - } - - foreach ($this->singleCheckbox as $name => ['label' => $label]) { - if (true === $this->getSingleCheckboxData($name)) { - $result[] = ['label' => '', 'value' => $this->translator->trans($label), 'position' => FilterOrderPositionEnum::SingleCheckbox->value, 'name' => $name]; - } - } - - return $result; - } - private function getDefaultData(): array { $r = [ diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index dfa361f6e..f2bded220 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -42,8 +42,6 @@ class FilterOrderHelperBuilder public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack, - private readonly TranslatorInterface $translator, - private readonly PropertyAccessorInterface $propertyAccessor, ) { $this->formFactory = $formFactory; $this->requestStack = $requestStack; @@ -92,8 +90,6 @@ class FilterOrderHelperBuilder $helper = new FilterOrderHelper( $this->formFactory, $this->requestStack, - $this->translator, - $this->propertyAccessor ); $helper->setSearchBox($this->searchBoxFields); diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index 3fbb2864d..6665750dd 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -25,8 +25,6 @@ class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface public function __construct( FormFactoryInterface $formFactory, RequestStack $requestStack, - private readonly TranslatorInterface $translator, - private readonly PropertyAccessorInterface $propertyAccessor, ) { $this->formFactory = $formFactory; $this->requestStack = $requestStack; @@ -34,6 +32,6 @@ class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface public function create(string $context, ?array $options = []): FilterOrderHelperBuilder { - return new FilterOrderHelperBuilder($this->formFactory, $this->requestStack, $this->translator, $this->propertyAccessor); + return new FilterOrderHelperBuilder($this->formFactory, $this->requestStack); } } diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index b91cd86e8..2d32813cb 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -24,6 +24,7 @@ class Templating extends AbstractExtension { public function __construct( private readonly RequestStack $requestStack, + private readonly FilterOrderGetActiveFilterHelper $filterOrderGetActiveFilterHelper, ) { } @@ -68,6 +69,7 @@ class Templating extends AbstractExtension return $environment->render($template, [ 'helper' => $helper, + 'active' => $this->filterOrderGetActiveFilterHelper->getActiveFilters($helper), 'form' => $helper->buildForm()->createView(), 'options' => $options, 'otherParameters' => $otherParameters, From 6065680e1e0bc71c19dd05ef158d301324f61805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 11 Jul 2023 15:01:32 +0200 Subject: [PATCH 050/750] Feature: [export] allow to group activities by location --- .../unreleased/Feature-20230711-150055.yaml | 5 ++ .../Aggregator/ActivityLocationAggregator.php | 80 +++++++++++++++++++ .../config/services/export.yaml | 4 + .../translations/messages.fr.yml | 3 + 4 files changed, 92 insertions(+) create mode 100644 .changes/unreleased/Feature-20230711-150055.yaml create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityLocationAggregator.php diff --git a/.changes/unreleased/Feature-20230711-150055.yaml b/.changes/unreleased/Feature-20230711-150055.yaml new file mode 100644 index 000000000..ecee61b49 --- /dev/null +++ b/.changes/unreleased/Feature-20230711-150055.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[Export] allow to group activities by localisation' +time: 2023-07-11T15:00:55.770070399+02:00 +custom: + Issue: "128" diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityLocationAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityLocationAggregator.php new file mode 100644 index 000000000..9103943e4 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityLocationAggregator.php @@ -0,0 +1,80 @@ +getAllAliases(), true)) { + $qb->leftJoin('activity.location', 'actloc'); + } + $qb->addSelect(sprintf('actloc.name AS %s', self::KEY)); + $qb->addGroupBy(self::KEY); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form required for this aggregator + } + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'export.aggregator.activity.by_location.Activity Location'; + } + + if (null === $value || '' === $value) { + return ''; + } + + return $value; + }; + } + + public function getQueryKeys($data): array + { + return [self::KEY]; + } + + public function getTitle() + { + return 'export.aggregator.activity.by_location.Title'; + } +} diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 09817d80e..03285c416 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -144,6 +144,10 @@ services: tags: - { name: chill.export_aggregator, alias: activity_common_type_aggregator } + Chill\ActivityBundle\Export\Aggregator\ActivityLocationAggregator: + tags: + - { name: chill.export_aggregator, alias: activity_common_location_aggregator } + chill.activity.export.user_aggregator: class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator tags: diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index abef160d3..037c24f3f 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -372,6 +372,9 @@ export: is sent: envoyé is received: reçu Group activity by sentreceived: Grouper les échanges par envoyé / reçu + by_location: + Activity Location: Localisation de l'échange + Title: Grouper les échanges par localisation de l'échange generic_doc: filter: From 2882038efcd4be2b65db67df7cb4f2498fcb0f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 11 Jul 2023 16:00:40 +0200 Subject: [PATCH 051/750] [export] Add a filter "filter course having an activity between two dates" --- .../unreleased/Feature-20230711-155929.yaml | 5 ++ ...PeriodHavingActivityBetweenDatesFilter.php | 90 +++++++++++++++++++ .../config/services/export.yaml | 4 + .../translations/messages+intl-icu.fr.yml | 5 ++ .../translations/messages.fr.yml | 6 ++ 5 files changed, 110 insertions(+) create mode 100644 .changes/unreleased/Feature-20230711-155929.yaml create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php create mode 100644 src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml diff --git a/.changes/unreleased/Feature-20230711-155929.yaml b/.changes/unreleased/Feature-20230711-155929.yaml new file mode 100644 index 000000000..329bbb677 --- /dev/null +++ b/.changes/unreleased/Feature-20230711-155929.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: '[export] Add a filter "filter course having an activity between two dates"' +time: 2023-07-11T15:59:29.065329834+02:00 +custom: + Issue: "129" diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php new file mode 100644 index 000000000..27e012d0b --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php @@ -0,0 +1,90 @@ +add('start_date', PickRollingDateType::class, [ + 'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity after' + ]) + ->add('end_date', PickRollingDateType::class, [ + 'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity before' + ]); + } + + 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 [ + 'export.filter.activity.course_having_activity_between_date.Only course having an activity between from and to', + [ + 'from' => $this->rollingDateConverter->convert($data['start_date']), + 'to' => $this->rollingDateConverter->convert($data['end_date']), + ] + ]; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $alias = 'act_period_having_act_betw_date_alias'; + $from = 'act_period_having_act_betw_date_start'; + $to = 'act_period_having_act_betw_date_end'; + + $qb->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM ' . Activity::class . " {$alias} WHERE {$alias}.date >= :{$from} AND {$alias}.date < :{$to} AND {$alias}.accompanyingPeriod = acp" + ) + ); + + $qb + ->setParameter($from, $this->rollingDateConverter->convert($data['start_date'])) + ->setParameter($to, $this->rollingDateConverter->convert($data['end_date'])); + } + + public function applyOn() + { + return \Chill\PersonBundle\Export\Declarations::ACP_TYPE; + } +} diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 09817d80e..932985083 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -135,6 +135,10 @@ services: tags: - { name: chill.export_filter, alias: 'accompanyingcourse_has_no_activity_filter' } + Chill\ActivityBundle\Export\Filter\ACPFilters\PeriodHavingActivityBetweenDatesFilter: + tags: + - { name: chill.export_filter, alias: 'period_having_activity_betw_dates_filter' } + ## Aggregators Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator: tags: diff --git a/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml new file mode 100644 index 000000000..ab3b963ab --- /dev/null +++ b/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml @@ -0,0 +1,5 @@ +export: + filter: + activity: + course_having_activity_between_date: + Only course having an activity between from and to: Seulement les parcours ayant reçu au moins un échange entre le {from, date, short} et le {to, date, short} diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index abef160d3..551a63d27 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -365,6 +365,12 @@ export: by_usersscope: Filter by users scope: Filtrer les échanges par services d'au moins un utilisateur participant 'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%' + course_having_activity_between_date: + Title: Filtre les parcours ayant reçu un échange entre deux dates + Receiving an activity after: Ayant reçu un échange après le + Receiving an activity before: Ayant reçu un échange avant le + + aggregator: activity: by_sent_received: From edd66f6a6cf3622dd82a8535a9f4a6272cc9bb1d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 09:04:15 +0200 Subject: [PATCH 052/750] FIX [budget][templates] reimplement display of all calculator results --- .../Resources/views/Budget/_macros.html.twig | 33 ++++++++++++++----- .../Resources/views/Person/index.html.twig | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Budget/_macros.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Budget/_macros.html.twig index dfa286af4..a1fee19ce 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Budget/_macros.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Budget/_macros.html.twig @@ -1,11 +1,12 @@ -{% macro table_elements(elements, family) %} +{% macro table_elements(elements, type) %} + - - - - + + + + @@ -38,17 +39,17 @@
    {% if is_granted('CHILL_BUDGET_ELEMENT_SEE', f) %}
  • - +
  • {% endif %} {% if is_granted('CHILL_BUDGET_ELEMENT_UPDATE', f) %}
  • - +
  • {% endif %} {% if is_granted('CHILL_BUDGET_ELEMENT_DELETE', f) %}
  • - +
  • {% endif %}
@@ -69,7 +70,7 @@
{{ 'Budget element type'|trans }}{{ 'Amount'|trans }}{{ 'Validity period'|trans }} {{ 'Budget element type'|trans }}{{ 'Amount'|trans }}{{ 'Validity period'|trans }} 
{% endmacro %} -{% macro table_results(actualCharges, actualResources) %} +{% macro table_results(actualCharges, actualResources, results) %} {% set totalCharges = 0 %} {% for c in actualCharges %} @@ -97,6 +98,20 @@ {{ result|format_currency('EUR') }} + {% for result in results %} + + {{ result.label }} + + {% if result.type == 'currency' %} + {{ result.result|format_currency('EUR') }} + {% elseif result.type == 'percentage' %} + {{ result.result|round(2, 'ceil') ~ '%' }} + {% else %} + {{ result.result|round(2, 'common') }} + {% endif %} + + + {% endfor %} {% endmacro %} diff --git a/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig b/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig index 18d04b889..aba564206 100644 --- a/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig +++ b/src/Bundle/ChillBudgetBundle/Resources/views/Person/index.html.twig @@ -25,7 +25,7 @@

{{ 'Budget calculator'|trans }}

- {{ table_results(charges, resources) }} + {{ table_results(charges, resources, results) }}
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', person) %} From f7d385eba1877756c34ed64857d0e847aedccf9d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 09:06:08 +0200 Subject: [PATCH 053/750] DX add changie --- .changes/unreleased/Fixed-20230712-090514.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Fixed-20230712-090514.yaml diff --git a/.changes/unreleased/Fixed-20230712-090514.yaml b/.changes/unreleased/Fixed-20230712-090514.yaml new file mode 100644 index 000000000..51a8b9317 --- /dev/null +++ b/.changes/unreleased/Fixed-20230712-090514.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: reimplement the visualization of all calculator results (specific to AMLI) +time: 2023-07-12T09:05:14.416268226+02:00 +custom: + Issue: "" From e38b369149dc92c6db0a36963c562c2976088540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 12 Jul 2023 10:26:22 +0200 Subject: [PATCH 054/750] [cron-job] add a new "lastExecution" data on CronJobExecution entity This column will store the results of the last execution --- .../Entity/CronJobExecution.php | 18 +++++++++- .../migrations/Version20230711152947.php | 33 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20230711152947.php diff --git a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php index 0cacffac9..2883055fc 100644 --- a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php +++ b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php @@ -31,7 +31,6 @@ class CronJobExecution private string $key; /** - * @var DateTimeImmutable * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) */ private ?DateTimeImmutable $lastEnd = null; @@ -46,6 +45,11 @@ class CronJobExecution */ private ?int $lastStatus = null; + /** + * @ORM\Column(type="json", options={"default": "'{}'::jsonb", "jsonb": true}) + */ + private array $lastExecutionData = []; + public function __construct(string $key) { $this->key = $key; @@ -92,4 +96,16 @@ class CronJobExecution return $this; } + + public function getLastExecutionData(): array + { + return $this->lastExecutionData; + } + + public function setLastExecutionData(array $lastExecutionData): CronJobExecution + { + $this->lastExecutionData = $lastExecutionData; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20230711152947.php b/src/Bundle/ChillMainBundle/migrations/Version20230711152947.php new file mode 100644 index 000000000..ed804473e --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20230711152947.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE chill_main_cronjob_execution ADD lastExecutionData JSONB DEFAULT \'{}\'::jsonb NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_cronjob_execution DROP COLUMN lastExecutionData'); + } +} From a2e705bd92e085007fb0313b163f194497bcb5bf Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 12 Jul 2023 10:38:11 +0200 Subject: [PATCH 055/750] fixed: error with parent joins in thirdparty api search query --- .../Controller/resquery.bad.sql | 21 +++++++++++++++++++ .../Controller/resquery.fixed.sql | 21 +++++++++++++++++++ .../Search/ThirdPartyApiSearch.php | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.bad.sql create mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql b/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql new file mode 100644 index 000000000..1033ec28c --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql @@ -0,0 +1,21 @@ +SELECT +'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) +) + GREATEST( +(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, +(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int +) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + COALESCE((LOWER(UNACCENT(cmpc_p.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence +FROM chill_3party.third_party AS tparty +LEFT JOIN chill_main_address cma ON cma.id = tparty.address_id +LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id +LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id +LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id +LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc.id +WHERE (tparty.active IS TRUE) AND (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR +tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') +OR +(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR +parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) +AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) +ORDER BY pertinence DESC LIMIT 50 OFFSET 0; diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql b/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql new file mode 100644 index 000000000..dbb55f187 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql @@ -0,0 +1,21 @@ +SELECT +'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) +) + GREATEST( +(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, +(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int +) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + COALESCE((LOWER(UNACCENT(cmpc_p.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence +FROM chill_3party.third_party AS tparty +LEFT JOIN chill_main_address cma ON cma.id = tparty.address_id +LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id +LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id +LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id +LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc_p.id +WHERE (tparty.active IS TRUE) AND (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR +tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') +OR +(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR +parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) +AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) +ORDER BY pertinence DESC LIMIT 50 OFFSET 0; diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 86c0fa9db..42b98622f 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -75,7 +75,7 @@ class ThirdPartyApiSearch implements SearchApiInterface LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id - LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc.id') + LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc_p.id') ->andWhereClause('tparty.active IS TRUE'); $strs = explode(' ', $pattern); From e8690d249fff6acac5b02054daff7833cc2ec893 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 10:42:46 +0200 Subject: [PATCH 056/750] FIX [duplicate][delete] fix error messages for treating the accompaning_period_work linked to the person that will be deleted --- .../ChillPersonBundle/Actions/Remove/PersonMove.php | 10 ++++++++-- .../views/PersonDuplicate/_sidepane.html.twig | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php index 4e2f7468e..76a6f5b8d 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php @@ -133,8 +133,14 @@ class PersonMove $conditions = []; - foreach ($mapping['joinColumns'] as $columns) { - $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); + if (array_key_exists('joinTable', $mapping)) { + foreach ($mapping['joinTable']['joinColumns'] as $columns) { + $conditions[] = sprintf('%s = %d', $columns['referencedColumnName'], $from->getId()); + } + } elseif (array_key_exists('joinColumns', $mapping)) { + foreach ($mapping['joinColumns'] as $columns) { + $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); + } } return sprintf( diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig index 1e770062a..b8edcc437 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig @@ -4,7 +4,7 @@
  • {{ 'gender'|trans }}: {{ person.gender|trans }}
  • {{ 'maritalStatus'|trans }}: - {% if person.maritalStatus.name %}{{ person.maritalStatus.name|localize_translatable_string }}{% endif %}
  • + {% if person.maritalStatus %}{{ person.maritalStatus.name|localize_translatable_string }}{% endif %}
  • {{ 'birthdate'|trans }}: {% if person.birthdate is not null %}{{ person.birthdate|format_date('short') }}{% endif %}
  • {{ 'placeOfBirth'|trans }}: From f3829d3390ae7e22939f02a6bb71db305ebe060e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 12 Jul 2023 10:50:17 +0200 Subject: [PATCH 057/750] adapt query to simplify join clauses (lightly improve perfs) --- .../Controller/resquery.good.sql | 19 +++++++++++++++++++ .../Search/ThirdPartyApiSearch.php | 10 +++------- 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.good.sql diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.good.sql b/src/Bundle/ChillMainBundle/Controller/resquery.good.sql new file mode 100644 index 000000000..5877b04f8 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/resquery.good.sql @@ -0,0 +1,19 @@ +SELECT +'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), +STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) +) + GREATEST( +(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, +(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int +) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence +FROM chill_3party.third_party AS tparty +LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id +LEFT JOIN chill_main_address cma ON cma.id = COALESCE(parent.address_id, tparty.address_id) +LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id +WHERE (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR +tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') +OR +(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR +parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) +AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) +ORDER BY pertinence DESC, tparty.id ASC LIMIT 500 OFFSET 0; diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 42b98622f..bb5303143 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -71,12 +71,9 @@ class ThirdPartyApiSearch implements SearchApiInterface ->setSelectKey('tparty') ->setSelectJsonbMetadata("jsonb_build_object('id', tparty.id)") ->setFromClause('chill_3party.third_party AS tparty - LEFT JOIN chill_main_address cma ON cma.id = tparty.address_id - LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id - LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id - LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc_p.id') - ->andWhereClause('tparty.active IS TRUE'); + LEFT JOIN chill_main_address cma ON cma.id = COALESCE(parent.address_id, tparty.address_id) + LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id'); $strs = explode(' ', $pattern); $wheres = []; @@ -102,8 +99,7 @@ class ThirdPartyApiSearch implements SearchApiInterface (parent.canonicalized LIKE '%s' || LOWER(UNACCENT(?)) || '%')::int ) + " . // take postcode label into account, but lower than the canonicalized field - "COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT(?)) || '%')::int * 0.3, 0) + " . - "COALESCE((LOWER(UNACCENT(cmpc_p.label)) LIKE '%' || LOWER(UNACCENT(?)) || '%')::int * 0.3, 0)"; + "COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT(?)) || '%')::int * 0.3, 0)"; $pertinenceArgs[] = [$str, $str, $str, $str, $str, $str]; } } From d825a8509bcf8aaf0df4037231c167495c6f3a41 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 10:42:46 +0200 Subject: [PATCH 058/750] FIX [duplicate][delete] fix error messages for treating the accompaning_period_work linked to the person that will be deleted --- .../ChillPersonBundle/Actions/Remove/PersonMove.php | 10 ++++++++-- .../views/PersonDuplicate/_sidepane.html.twig | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php index 4e2f7468e..76a6f5b8d 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php @@ -133,8 +133,14 @@ class PersonMove $conditions = []; - foreach ($mapping['joinColumns'] as $columns) { - $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); + if (array_key_exists('joinTable', $mapping)) { + foreach ($mapping['joinTable']['joinColumns'] as $columns) { + $conditions[] = sprintf('%s = %d', $columns['referencedColumnName'], $from->getId()); + } + } elseif (array_key_exists('joinColumns', $mapping)) { + foreach ($mapping['joinColumns'] as $columns) { + $conditions[] = sprintf('%s = %d', $columns['name'], $from->getId()); + } } return sprintf( diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig index 1e770062a..b8edcc437 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig @@ -4,7 +4,7 @@
  • {{ 'gender'|trans }}: {{ person.gender|trans }}
  • {{ 'maritalStatus'|trans }}: - {% if person.maritalStatus.name %}{{ person.maritalStatus.name|localize_translatable_string }}{% endif %}
  • + {% if person.maritalStatus %}{{ person.maritalStatus.name|localize_translatable_string }}{% endif %}
  • {{ 'birthdate'|trans }}: {% if person.birthdate is not null %}{{ person.birthdate|format_date('short') }}{% endif %}
  • {{ 'placeOfBirth'|trans }}: From efee2d8b44369e6546d13afa19d58b8a43d086db Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 12 Jul 2023 10:53:12 +0200 Subject: [PATCH 059/750] cleaning --- .../Controller/resquery.bad.sql | 21 ------------------- .../Controller/resquery.fixed.sql | 21 ------------------- .../Controller/resquery.good.sql | 19 ----------------- 3 files changed, 61 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.bad.sql delete mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql delete mode 100644 src/Bundle/ChillMainBundle/Controller/resquery.good.sql diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql b/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql deleted file mode 100644 index 1033ec28c..000000000 --- a/src/Bundle/ChillMainBundle/Controller/resquery.bad.sql +++ /dev/null @@ -1,21 +0,0 @@ -SELECT -'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) -) + GREATEST( -(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, -(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int -) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + COALESCE((LOWER(UNACCENT(cmpc_p.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence -FROM chill_3party.third_party AS tparty -LEFT JOIN chill_main_address cma ON cma.id = tparty.address_id -LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id -LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id -LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id -LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc.id -WHERE (tparty.active IS TRUE) AND (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR -tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') -OR -(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR -parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) -AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) -ORDER BY pertinence DESC LIMIT 50 OFFSET 0; diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql b/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql deleted file mode 100644 index dbb55f187..000000000 --- a/src/Bundle/ChillMainBundle/Controller/resquery.fixed.sql +++ /dev/null @@ -1,21 +0,0 @@ -SELECT -'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) -) + GREATEST( -(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, -(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int -) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + COALESCE((LOWER(UNACCENT(cmpc_p.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence -FROM chill_3party.third_party AS tparty -LEFT JOIN chill_main_address cma ON cma.id = tparty.address_id -LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id -LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id -LEFT JOIN chill_main_address cma_p ON parent.address_id = cma_p.id -LEFT JOIN chill_main_postal_code cmpc_p ON cma_p.postcode_id = cmpc_p.id -WHERE (tparty.active IS TRUE) AND (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR -tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') -OR -(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR -parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) -AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) -ORDER BY pertinence DESC LIMIT 50 OFFSET 0; diff --git a/src/Bundle/ChillMainBundle/Controller/resquery.good.sql b/src/Bundle/ChillMainBundle/Controller/resquery.good.sql deleted file mode 100644 index 5877b04f8..000000000 --- a/src/Bundle/ChillMainBundle/Controller/resquery.good.sql +++ /dev/null @@ -1,19 +0,0 @@ -SELECT -'tparty' AS key, jsonb_build_object('id', tparty.id) AS metadata, GREATEST( -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), tparty.canonicalized), -STRICT_WORD_SIMILARITY(LOWER(UNACCENT('areams')), parent.canonicalized) -) + GREATEST( -(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int, -(parent.canonicalized LIKE '%s' || LOWER(UNACCENT('areams')) || '%')::int -) + COALESCE((LOWER(UNACCENT(cmpc.label)) LIKE '%' || LOWER(UNACCENT('areams')) || '%')::int * 0.3, 0) + 1 AS pertinence -FROM chill_3party.third_party AS tparty -LEFT JOIN chill_3party.third_party AS parent ON tparty.parent_id = parent.id -LEFT JOIN chill_main_address cma ON cma.id = COALESCE(parent.address_id, tparty.address_id) -LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id -WHERE (((LOWER(UNACCENT('areams')) <<% tparty.canonicalized OR -tparty.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%') -OR -(LOWER(UNACCENT('areams')) <<% parent.canonicalized OR -parent.canonicalized LIKE '%' || LOWER(UNACCENT('areams')) || '%')) -AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)) -ORDER BY pertinence DESC, tparty.id ASC LIMIT 500 OFFSET 0; From fcd4c3b92eef7963b6ce0d1096648852ccbec88a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 11:12:22 +0200 Subject: [PATCH 060/750] DX add changie --- .changes/unreleased/Fixed-20230712-111206.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Fixed-20230712-111206.yaml diff --git a/.changes/unreleased/Fixed-20230712-111206.yaml b/.changes/unreleased/Fixed-20230712-111206.yaml new file mode 100644 index 000000000..7bec6095e --- /dev/null +++ b/.changes/unreleased/Fixed-20230712-111206.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: reinstate the fusion of duplicate persons +time: 2023-07-12T11:12:06.673925762+02:00 +custom: + Issue: "107" From 04235409769d55a3b5277e23b6c1f2e31a184218 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 11:17:25 +0200 Subject: [PATCH 061/750] FIX [duplicate][personpicker] use dynamic person picker to assign duplicate manually --- .../Form/PersonFindManuallyDuplicateType.php | 4 ++-- .../views/PersonDuplicate/find_manually.html.twig | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php b/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php index b9dfad240..1d7697332 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form; -use Chill\PersonBundle\Form\Type\PickPersonType; +use Chill\PersonBundle\Form\Type\PickPersonDynamicType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; @@ -21,7 +21,7 @@ class PersonFindManuallyDuplicateType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('person', PickPersonType::class, [ + ->add('person', PickPersonDynamicType::class, [ 'label' => 'Find duplicate', 'mapped' => false, ]) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/find_manually.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/find_manually.html.twig index 8769ae6da..982690f00 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/find_manually.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/find_manually.html.twig @@ -8,9 +8,9 @@ {% block content %}
    - +

    {{ 'Désigner un dossier doublon'|trans }}

    - + {{ form_start(form) }} {{ form_rest(form) }} @@ -29,3 +29,11 @@
    {% endblock %} + +{% block js %} + {{ encore_entry_script_tags('mod_pickentity_type') }} +{% endblock %} + +{% block css %} + {{ encore_entry_link_tags('mod_pickentity_type') }} +{% endblock %} From 3f66e1a862416658a3afce675dbc1cb29440fb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 12 Jul 2023 11:36:26 +0200 Subject: [PATCH 062/750] [cron-job] allow a cronjob to pass data from one execution to another When a cronjob is executed, it may return an array of data. This data will be passed as parameter on the next execution --- .changes/unreleased/DX-20230712-113603.yaml | 6 ++ .../ChillMainBundle/Cron/CronJobInterface.php | 10 ++- .../ChillMainBundle/Cron/CronManager.php | 25 +++++- ...eographicalUnitMaterializedViewCronJob.php | 4 +- .../Cron/CronJobDatabaseInteractionTest.php | 87 +++++++++++++++++++ .../Tests/Cron/CronManagerTest.php | 12 +-- .../AccompanyingPeriodStepChangeCronjob.php | 4 +- 7 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 .changes/unreleased/DX-20230712-113603.yaml create mode 100644 src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php diff --git a/.changes/unreleased/DX-20230712-113603.yaml b/.changes/unreleased/DX-20230712-113603.yaml new file mode 100644 index 000000000..518ac3ca9 --- /dev/null +++ b/.changes/unreleased/DX-20230712-113603.yaml @@ -0,0 +1,6 @@ +kind: DX +body: '[cronjob] when a cronjob is executed, it may return an array of data that will + be passed as argument on the next execution' +time: 2023-07-12T11:36:03.813179067+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php b/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php index 4e1ca9ff6..69edf8464 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php +++ b/src/Bundle/ChillMainBundle/Cron/CronJobInterface.php @@ -19,5 +19,13 @@ interface CronJobInterface public function getKey(): string; - public function run(): void; + /** + * Execute the cronjob + * + * If data is returned, this data is passed as argument on the next execution + * + * @param array $lastExecutionData the data which was returned from the previous execution + * @return array|null optionally return an array with the same data than the previous execution + */ + public function run(array $lastExecutionData): null|array; } diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index f69dcba76..a3e82a170 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -14,6 +14,7 @@ namespace Chill\MainBundle\Cron; use Chill\MainBundle\Entity\CronJobExecution; use Chill\MainBundle\Repository\CronJobExecutionRepositoryInterface; use DateTimeImmutable; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\EntityManagerInterface; use Exception; use Psr\Log\LoggerInterface; @@ -46,6 +47,8 @@ class CronManager implements CronManagerInterface private const UPDATE_BEFORE_EXEC = 'UPDATE ' . CronJobExecution::class . ' cr SET cr.lastStart = :now WHERE cr.key = :key'; + private const UPDATE_LAST_EXECUTION_DATA = 'UPDATE ' . CronJobExecution::class . ' cr SET cr.lastExecutionData = :data WHERE cr.key = :key'; + private CronJobExecutionRepositoryInterface $cronJobExecutionRepository; private EntityManagerInterface $entityManager; @@ -85,6 +88,9 @@ class CronManager implements CronManagerInterface foreach ($orderedJobs as $job) { if ($job->canRun($lasts[$job->getKey()] ?? null)) { if (array_key_exists($job->getKey(), $lasts)) { + + $executionData = $lasts[$job->getKey()]->getLastExecutionData(); + $this->entityManager ->createQuery(self::UPDATE_BEFORE_EXEC) ->setParameters([ @@ -96,12 +102,17 @@ class CronManager implements CronManagerInterface $execution = new CronJobExecution($job->getKey()); $this->entityManager->persist($execution); $this->entityManager->flush(); + + $executionData = $execution->getLastExecutionData(); } $this->entityManager->clear(); + // note: at this step, the entity manager does not have any entity CronJobExecution + // into his internal memory + try { $this->logger->info(sprintf('%sWill run job', self::LOG_PREFIX), ['job' => $job->getKey()]); - $job->run(); + $result = $job->run($executionData); $this->entityManager ->createQuery(self::UPDATE_AFTER_EXEC) @@ -112,6 +123,14 @@ class CronManager implements CronManagerInterface ]) ->execute(); + if (null !== $result) { + $this->entityManager + ->createQuery(self::UPDATE_LAST_EXECUTION_DATA) + ->setParameter('data', $result, Types::JSON) + ->setParameter('key', $job->getKey(), Types::STRING) + ->execute(); + } + $this->logger->info(sprintf('%sSuccessfully run job', self::LOG_PREFIX), ['job' => $job->getKey()]); return; @@ -133,7 +152,7 @@ class CronManager implements CronManagerInterface } /** - * @return array<0: CronJobInterface[], 1: array> + * @return array{0: array, 1: array} */ private function getOrderedJobs(): array { @@ -174,7 +193,7 @@ class CronManager implements CronManagerInterface { foreach ($this->jobs as $job) { if ($job->getKey() === $forceJob) { - $job->run(); + $job->run([]); } } } diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index 9dbb38a3f..3a6ff8fb9 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -49,8 +49,10 @@ class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJob return 'refresh-materialized-view-address-to-geog-units'; } - public function run(): void + public function run(array $lastExecutionData): null|array { $this->connection->executeQuery('REFRESH MATERIALIZED VIEW view_chill_main_address_geographical_unit'); + + return null; } } diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php new file mode 100644 index 000000000..0b80730fe --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php @@ -0,0 +1,87 @@ +entityManager = self::$container->get(EntityManagerInterface::class); + $this->cronJobExecutionRepository = self::$container->get(CronJobExecutionRepository::class); + } + + public function testCompleteLifeCycle(): void + { + $cronjob = $this->prophesize(CronJobInterface::class); + $cronjob->canRun(null)->willReturn(true); + $cronjob->canRun(Argument::type(CronJobExecution::class))->willReturn(true); + $cronjob->getKey()->willReturn('test-with-data'); + $cronjob->run([])->willReturn(['test' => 'execution-0']); + $cronjob->run(['test' => 'execution-0'])->willReturn(['test' => 'execution-1']); + + $cronjob->run([])->shouldBeCalledOnce(); + $cronjob->run(['test' => 'execution-0'])->shouldBeCalledOnce(); + + $manager = new CronManager( + $this->cronJobExecutionRepository, + $this->entityManager, + [$cronjob->reveal()], + new NullLogger() + ); + + // run a first time + $manager->run(); + + // run a second time + $manager->run(); + } + +} + +class JobWithReturn implements CronJobInterface +{ + public function canRun(?CronJobExecution $cronJobExecution): bool + { + return true; + } + + public function getKey(): string + { + return 'with-data'; + } + + public function run(array $lastExecutionData): null|array + { + return ['data' => 'test']; + } +} diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index 4b812ce2b..47c929a52 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -40,7 +40,7 @@ final class CronManagerTest extends TestCase $jobToExecute = $this->prophesize(CronJobInterface::class); $jobToExecute->getKey()->willReturn('to-exec'); $jobToExecute->canRun(Argument::type(CronJobExecution::class))->willReturn(true); - $jobToExecute->run()->shouldBeCalled(); + $jobToExecute->run([])->shouldBeCalled(); $executions = [ ['key' => $jobOld1->getKey(), 'lastStart' => new DateTimeImmutable('yesterday'), 'lastEnd' => new DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS], @@ -64,7 +64,7 @@ final class CronManagerTest extends TestCase $jobAlreadyExecuted = new JobCanRun('k'); $jobNeverExecuted = $this->prophesize(CronJobInterface::class); $jobNeverExecuted->getKey()->willReturn('never-executed'); - $jobNeverExecuted->run()->shouldBeCalled(); + $jobNeverExecuted->run([])->shouldBeCalled(); $jobNeverExecuted->canRun(null)->willReturn(true); $executions = [ @@ -86,7 +86,7 @@ final class CronManagerTest extends TestCase $jobAlreadyExecuted = new JobCanRun('k'); $jobNeverExecuted = $this->prophesize(CronJobInterface::class); $jobNeverExecuted->getKey()->willReturn('never-executed'); - $jobNeverExecuted->run()->shouldBeCalled(); + $jobNeverExecuted->run([])->shouldBeCalled(); $jobNeverExecuted->canRun(null)->willReturn(true); $executions = [ @@ -178,8 +178,9 @@ class JobCanRun implements CronJobInterface return $this->key; } - public function run(): void + public function run(array $lastExecutionData): null|array { + return null; } } @@ -195,7 +196,8 @@ class JobCannotRun implements CronJobInterface return 'job-b'; } - public function run(): void + public function run(array $lastExecutionData): null|array { + return null; } } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php index f637e70b9..2ddf3415c 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php @@ -39,8 +39,10 @@ readonly class AccompanyingPeriodStepChangeCronjob implements CronJobInterface return 'accompanying-period-step-change'; } - public function run(): void + public function run(array $lastExecutionData): null|array { ($this->requestor)(); + + return null; } } From e82c7cdc6c174c6873775a43d20446668af3eb43 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 12 Jul 2023 13:24:23 +0200 Subject: [PATCH 063/750] Fixed: [homepage widget] repair my unread notification list with actions and evaluations documents --- .../public/vuejs/HomepageWidget/MyNotifications.vue | 8 ++++++++ .../Resources/public/vuejs/HomepageWidget/js/i18n.js | 1 + 2 files changed, 9 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue index 06683f8fc..bfde741ac 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue @@ -66,6 +66,10 @@ export default { return appMessages.fr.the_activity; case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod': return appMessages.fr.the_course; + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': + return appMessages.fr.the_action; + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': + return appMessages.fr.the_evaluation_document; case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return appMessages.fr.the_workflow; default: @@ -78,6 +82,10 @@ export default { return `/fr/activity/${n.relatedEntityId}/show` case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod': return `/fr/parcours/${n.relatedEntityId}` + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': + return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show` + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': + return `/fr/notification/${n.id}/show` // to the notification case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return `/fr/main/workflow/${n.relatedEntityId}/show` default: diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js index 697074671..587f06fa9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js @@ -46,6 +46,7 @@ const appMessages = { the_course: "le parcours", the_action: "l'action", the_evaluation: "l'évaluation", + the_evaluation_document: "le document de l'évaluation", the_task: "la tâche", the_workflow: "le workflow", StartDate: "Date d'ouverture", From e0758215ba3c557fc26065591663be2389e1fe50 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 12 Jul 2023 15:17:03 +0200 Subject: [PATCH 064/750] FEATURE [repository] implement filter logic --- src/Bundle/ChillMainBundle/Entity/Address.php | 1 + .../Templating/Listing/FilterOrderHelper.php | 3 +- .../AccompanyingCourseWorkController.php | 4 +- .../AccompanyingPeriodWorkRepository.php | 42 ++++++++++++------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 1bd1a453a..9fcb07fe5 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -255,6 +255,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface public function syncWithReference(AddressReference $addressReference): Address { + dump($addressReference); $this ->setPoint($addressReference->getPoint()) ->setPostcode($addressReference->getPostcode()) diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 8554b4431..6a4d07167 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Templating\Listing; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\Listing\FilterOrderType; use DateTimeImmutable; use Symfony\Component\Form\Extension\Core\Type\FormType; @@ -134,7 +135,7 @@ class FilterOrderHelper return $this->userPickers; } - public function getUserPickerData(string $name): array + public function getUserPickerData(string $name) { return $this->getFormData()['user_pickers'][$name]; } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index c56489afd..3eb6e67f5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -161,7 +161,7 @@ class AccompanyingCourseWorkController extends AbstractController 'types' => $filter->getEntityChoiceData('typesFilter'), 'before' => $filter->getDateRangeData('dateFilter')['to'], 'after' => $filter->getDateRangeData('dateFilter')['from'], - 'users' => $filter->getUserPickerData('userFilter') + 'user' => $filter->getUserPickerData('userFilter') ]; $totalItems = $this->workRepository->countByAccompanyingPeriod($period); @@ -226,7 +226,7 @@ class AccompanyingCourseWorkController extends AbstractController ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, $types, [ 'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()) ]) - ->addUserPicker('userFilter', 'accompanying_course_work.user_filter', ['required' => false]) + ->addUserPicker('userFilter', 'accompanying_course_work.user_filter', ['required' => false, 'multiple' => false]) ; return $filterBuilder->build(); diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index a5e27afd5..6fc8ff86e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -103,40 +103,52 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository $rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w'); $sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w - WHERE accompanyingPeriod_id = :periodId - ORDER BY - CASE WHEN enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC, - startdate DESC, - enddate DESC, - id DESC"; + WHERE accompanyingPeriod_id = :periodId"; // implement filters if([] !== ($filters['types'] ?? [])) { - $sql .= "AND WHERE w.socialAction IN (:types)"; + $sql .= " AND w.socialaction_id IN (:types)"; } if([] !== ($filters['users'] ?? [])) { - $sql .= "AND WHERE w.createdBy IN (:users)"; + $sql .= " AND w.createdBy = (:userCreated)"; - foreach ($filters['users'] as $key => $user) { - $sql .= "OR :user_" . $key . " IN w.referrers)"; + $sql .= " OR :userReferrer IN (w.referrers)"; + } - $nq = $this->em->createNativeQuery($sql, $rsm) - ->setParameter(':user_' . $key); - } - - // ... to be continued + if (null !== ($after = $filters['after'] ?? null) && null === $filters['before']) { + $sql .= " AND w.startdate::date >= :after"; + } elseif (null !== ($before = $filters['before'] ?? null) && null === $filters['after']) { + $sql .= " AND COALESCE(w.enddate::date, 'infinity'::date) <= :before"; + } elseif (null !== ($after = $filters['after'] ?? null) && null !== ($before = $filters['before'] ?? null)) { + $sql .= " AND w.startdate::date >= :after AND COALESCE(w.enddate::date, 'now'::date) <= :before"; } // set limit and offset + $sql .= " ORDER BY + CASE WHEN enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC, + startdate DESC, + enddate DESC, + id DESC"; + $sql .= " LIMIT :limit OFFSET :offset"; + $typeIds = []; + foreach ($filters['types'] as $type) { + $typeIds[] = $type->getId(); + } + $nq = $this->em->createNativeQuery($sql, $rsm) ->setParameter('periodId', $period->getId(), Types::INTEGER) + ->setParameter('types', $typeIds) + ->setParameter('userCreated', $filters['user']) + ->setParameter('userReferrer', $filters['user']) + ->setParameter('after', $filters['after']) + ->setParameter('before', $filters['before']) ->setParameter('limit', $limit, Types::INTEGER) ->setParameter('offset', $offset, Types::INTEGER); From 29306d2b66bcd6a1e3882391ed22c863140bbbc6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 24 May 2023 19:55:17 +0200 Subject: [PATCH 065/750] UX: [vue][onTheFly] improve residential address position in modale --- .../_components/Entity/AddressRenderBox.vue | 2 +- .../_components/Entity/PersonRenderBox.vue | 93 +++++++------------ 2 files changed, 33 insertions(+), 62 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue index 14a376856..00fb2b996 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue @@ -1,6 +1,6 @@