From 1c0fd579134a5d1554845f71a0674de953431f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 30 Aug 2023 14:55:26 +0200 Subject: [PATCH] Apply rector rules + fix CS --- .../Export/LinkedToPerson/ListActivity.php | 4 ++-- .../Export/Export/ListActivityHelper.php | 2 +- .../Controller/ParticipationController.php | 3 +-- .../Command/ChillImportUsersCommand.php | 2 +- .../Controller/ExportController.php | 3 +-- .../Controller/SearchController.php | 9 +++------ .../Export/Helper/AggregateStringHelper.php | 2 +- .../Export/Helper/ExportAddressHelper.php | 4 ++-- .../TranslatableStringExportLabelHelper.php | 4 ++-- .../Export/Helper/UserHelper.php | 2 +- .../Controller/PersonAddressController.php | 17 +++++------------ .../Controller/PersonDuplicateController.php | 18 +++++------------- .../Controller/PersonResourceController.php | 14 ++++---------- .../Controller/TimelinePersonController.php | 3 +-- .../Export/Export/ListPerson.php | 4 ++-- .../Export/Helper/LabelPersonHelper.php | 2 +- .../Helper/ListAccompanyingPeriodHelper.php | 6 +++--- .../Export/Helper/ListPersonHelper.php | 2 +- .../Controller/PersonControllerUpdateTest.php | 2 +- .../Controller/PersonControllerViewTest.php | 5 +++-- ...ersonControllerViewWithHiddenFieldsTest.php | 2 +- .../Person/BirthdateValidatorTest.php | 2 +- .../Constraints/Person/BirthdateValidator.php | 2 +- .../Export/Export/ReportList.php | 8 ++++---- .../Export/Helper/LabelThirdPartyHelper.php | 2 +- .../Service/Wopi/ChillDocumentLockManager.php | 2 +- 26 files changed, 50 insertions(+), 76 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 94ebb0596..c01ec428a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -138,7 +138,7 @@ class ListActivity implements ListInterface, GroupedExportInterface return 'circle'; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }; case 'type_name': @@ -147,7 +147,7 @@ class ListActivity implements ListInterface, GroupedExportInterface return 'activity type'; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }; default: diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index 1e0ff1972..1d05ba659 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -125,7 +125,7 @@ class ListActivityHelper }; } - $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR); return implode( '|', diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index c5423cc18..a9ec336e7 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -468,9 +468,8 @@ class ParticipationController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/update_multiple", name="chill_event_participation_update_multiple", methods={"POST"}) - * @param mixed $event_id */ - public function updateMultipleAction($event_id, Request $request) + public function updateMultipleAction(mixed $event_id, Request $request) { /** @var \Chill\EventBundle\Entity\Event $event */ $event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class) diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index 03c8b5742..e053827db 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -318,7 +318,7 @@ class ChillImportUsersCommand extends Command return ''; } - return trim($value); + return trim((string) $value); }); $helper = $this->getHelper('question'); diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index fec68f208..971a968b3 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -68,9 +68,8 @@ class ExportController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"}) - * @param mixed $alias */ - public function downloadResultAction(Request $request, $alias) + public function downloadResultAction(Request $request, mixed $alias) { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 126626372..ba8388c2c 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -42,9 +42,8 @@ class SearchController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search") - * @param mixed $name */ - public function advancedSearchAction($name, Request $request) + public function advancedSearchAction(mixed $name, Request $request) { try { /** @var Chill\MainBundle\Search\SearchProvider $variable */ @@ -110,9 +109,8 @@ class SearchController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"}) - * @param mixed $_format */ - public function searchAction(Request $request, $_format) + public function searchAction(Request $request, mixed $_format) { $pattern = trim((string) $request->query->get('q', '')); @@ -203,9 +201,8 @@ class SearchController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"}) - * @param mixed $_format */ - public function searchApi(Request $request, $_format): JsonResponse + public function searchApi(Request $request, mixed $_format): JsonResponse { //TODO this is an incomplete implementation $query = $request->query->get('q', ''); diff --git a/src/Bundle/ChillMainBundle/Export/Helper/AggregateStringHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/AggregateStringHelper.php index 3ee5f20d8..f1f5dab90 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/AggregateStringHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/AggregateStringHelper.php @@ -29,7 +29,7 @@ class AggregateStringHelper return implode( '|', - json_decode($value, true, 512, JSON_THROW_ON_ERROR) + json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR) ); }; } diff --git a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php index e96987760..54c890070 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -292,7 +292,7 @@ class ExportAddressHelper return ''; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }; case 'isNoAddress': @@ -351,7 +351,7 @@ class ExportAddressHelper return ''; } - $decodedValues = json_decode($value, true, 512, JSON_THROW_ON_ERROR); + $decodedValues = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); return match (count($decodedValues)) { 0 => '', diff --git a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php index 9077ad8b0..fc19f7466 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -36,7 +36,7 @@ class TranslatableStringExportLabelHelper return ''; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }; } @@ -51,7 +51,7 @@ class TranslatableStringExportLabelHelper return ''; } - $decoded = json_decode($value, true, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); return implode( '|', diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index d77e7190e..2c1321bbf 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -48,7 +48,7 @@ class UserHelper return ''; } - $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR); if (0 === count($decoded)) { return ''; diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 6413d72b3..111371310 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -42,9 +42,8 @@ class PersonAddressController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"}) - * @param mixed $person_id */ - public function createAction($person_id, Request $request) + public function createAction(mixed $person_id, Request $request) { $person = $this->getDoctrine()->getManager() ->getRepository(\Chill\PersonBundle\Entity\Person::class) @@ -101,10 +100,8 @@ class PersonAddressController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/edit", name="chill_person_address_edit") - * @param mixed $person_id - * @param mixed $address_id */ - public function editAction($person_id, $address_id) + public function editAction(mixed $person_id, mixed $address_id) { $person = $this->getDoctrine()->getManager() ->getRepository(\Chill\PersonBundle\Entity\Person::class) @@ -134,9 +131,8 @@ class PersonAddressController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/list", name="chill_person_address_list") - * @param mixed $person_id */ - public function listAction($person_id) + public function listAction(mixed $person_id) { $person = $this->getDoctrine()->getManager() ->getRepository(\Chill\PersonBundle\Entity\Person::class) @@ -160,9 +156,8 @@ class PersonAddressController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/new", name="chill_person_address_new") - * @param mixed $person_id */ - public function newAction($person_id) + public function newAction(mixed $person_id) { $person = $this->getDoctrine()->getManager() ->getRepository(\Chill\PersonBundle\Entity\Person::class) @@ -191,10 +186,8 @@ class PersonAddressController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/update", name="chill_person_address_update") - * @param mixed $person_id - * @param mixed $address_id */ - public function updateAction($person_id, $address_id, Request $request) + public function updateAction(mixed $person_id, mixed $address_id, Request $request) { $person = $this->getDoctrine()->getManager() ->getRepository(\Chill\PersonBundle\Entity\Person::class) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 315adfd71..d6be0c4d7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -40,10 +40,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") - * @param mixed $person1_id - * @param mixed $person2_id */ - public function confirmAction($person1_id, $person2_id, Request $request) + public function confirmAction(mixed $person1_id, mixed $person2_id, Request $request) { if ($person1_id === $person2_id) { throw new InvalidArgumentException('Can not merge same person'); @@ -106,9 +104,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/find-manually", name="chill_person_find_manually_duplicate") - * @param mixed $person_id */ - public function findManuallyDuplicateAction($person_id, Request $request) + public function findManuallyDuplicateAction(mixed $person_id, Request $request) { $person = $this->_getPerson($person_id); @@ -160,10 +157,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate", name="chill_person_duplicate_not_duplicate") - * @param mixed $person1_id - * @param mixed $person2_id */ - public function notDuplicateAction($person1_id, $person2_id) + public function notDuplicateAction(mixed $person1_id, mixed $person2_id) { [$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id); @@ -191,10 +186,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate", name="chill_person_remove_duplicate_not_duplicate") - * @param mixed $person1_id - * @param mixed $person2_id */ - public function removeNotDuplicateAction($person1_id, $person2_id) + public function removeNotDuplicateAction(mixed $person1_id, mixed $person2_id) { [$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id); @@ -217,9 +210,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/duplicate/view", name="chill_person_duplicate_view") - * @param mixed $person_id */ - public function viewAction($person_id, PersonNotDuplicateRepository $personNotDuplicateRepository) + public function viewAction(mixed $person_id, PersonNotDuplicateRepository $personNotDuplicateRepository) { $person = $this->_getPerson($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index 81d8f253b..869a5efe5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -31,10 +31,8 @@ final class PersonResourceController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete") - * @param mixed $person_id - * @param mixed $resource_id */ - public function deleteAction(Request $request, $person_id, $resource_id): Response + public function deleteAction(Request $request, mixed $person_id, mixed $resource_id): Response { $personOwner = $this->personRepository->find($person_id); $resource = $this->personResourceRepository->find($resource_id); @@ -82,10 +80,8 @@ final class PersonResourceController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/edit", name="chill_person_resource_edit") - * @param mixed $resource_id - * @param mixed $person_id */ - public function editAction(Request $request, $resource_id, $person_id): Response + public function editAction(Request $request, mixed $resource_id, mixed $person_id): Response { $resource = $this->personResourceRepository->find($resource_id); $personOwner = $this->personRepository->find($person_id); @@ -121,9 +117,8 @@ final class PersonResourceController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/list", name="chill_person_resource_list") - * @param mixed $person_id */ - public function listAction(Request $request, $person_id) + public function listAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); $this->denyAccessUnlessGranted(PersonVoter::SEE, $personOwner); @@ -142,9 +137,8 @@ final class PersonResourceController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/new", name="chill_person_resource_new") - * @param mixed $person_id */ - public function newAction(Request $request, $person_id) + public function newAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); $personResource = new PersonResource(); diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index 176fcba4f..c271f22f4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -28,9 +28,8 @@ class TimelinePersonController extends AbstractController /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline") - * @param mixed $person_id */ - public function personAction(Request $request, $person_id) + public function personAction(Request $request, mixed $person_id) { $person = $this->getDoctrine() ->getRepository(Person::class) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index c5d5ae6a3..1274780f7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -320,7 +320,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou return $this->customFieldProvider ->getCustomFieldByType($cf->getType()) - ->render(json_decode($value, true, 512, JSON_THROW_ON_ERROR), $cf, 'csv'); + ->render(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR), $cf, 'csv'); }; if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { @@ -330,7 +330,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou if (null === $value) { return ''; } - $decoded = json_decode($value, true, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php index 20029b296..9a9be5302 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/LabelPersonHelper.php @@ -33,7 +33,7 @@ class LabelPersonHelper return ''; } - $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR); if (0 === count($decoded)) { return ''; diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php index f495f18ed..50df57553 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListAccompanyingPeriodHelper.php @@ -103,7 +103,7 @@ final readonly class ListAccompanyingPeriodHelper return ''; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }, 'locationPersonName', 'requestorPerson' => function ($value) use ($key) { if ('_header' === $value) { @@ -140,7 +140,7 @@ final readonly class ListAccompanyingPeriodHelper '|', array_map( fn ($s) => $this->translatableStringHelper->localize($s), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) + json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR) ) ); }, @@ -157,7 +157,7 @@ final readonly class ListAccompanyingPeriodHelper '|', array_map( fn ($s) => $this->socialIssueRender->renderString($this->socialIssueRepository->find($s), []), - json_decode($value, true, 512, JSON_THROW_ON_ERROR) + json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR) ) ); }, diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php index 323d0f3ec..d4c0a3e9d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php +++ b/src/Bundle/ChillPersonBundle/Export/Helper/ListPersonHelper.php @@ -332,7 +332,7 @@ class ListPersonHelper return ''; } - $ids = json_decode($value, null, 512, JSON_THROW_ON_ERROR); + $ids = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR); return implode( diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php index 3e95967b4..c448283ba 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php @@ -57,7 +57,7 @@ final class PersonControllerUpdateTest extends WebTestCase $em = self::$container->get(EntityManagerInterface::class); - foreach (self::$toDelete as list($class, $id)) { + foreach (self::$toDelete as [$class, $id]) { $entity = $em->find($class, $id); if (null === $entity) { diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewTest.php index 1b087e151..8f9cfc2f7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewTest.php @@ -41,7 +41,7 @@ final class PersonControllerViewTest extends WebTestCase $em = self::$container->get(EntityManagerInterface::class); - foreach (self::$toDelete as list($class, $id)) { + foreach (self::$toDelete as [$class, $id]) { $entity = $em->find($class, $id); if (null === $entity) { @@ -85,7 +85,8 @@ final class PersonControllerViewTest extends WebTestCase $client->request('GET', $this->makeViewPath($personId)); - self::assertResponseStatusCodeSame(403, + self::assertResponseStatusCodeSame( + 403, 'The view page of a person of a center A must not be accessible for user of center B' ); } diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php index 2a6ed7f03..6c74de23e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerViewWithHiddenFieldsTest.php @@ -27,7 +27,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase /** * @var string The url to view the person details */ - private string $viewUrl; + private readonly string $viewUrl; protected function setUp(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/BirthdateValidatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/BirthdateValidatorTest.php index d32cd4c02..98810db95 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Validator/Person/BirthdateValidatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Validator/Person/BirthdateValidatorTest.php @@ -69,7 +69,7 @@ final class BirthdateValidatorTest extends ConstraintValidatorTestCase return new BirthdateValidator( new ParameterBag(['chill_person' => ['validation' => ['birthdate_not_after' => 'P1D']]]), new MockClock(new \DateTimeImmutable('2023-08-30T14:12:00')) - ); + ); } private function createConstraint() diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php index c0d9105ad..4966d5ff2 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Person/BirthdateValidator.php @@ -26,7 +26,7 @@ use function is_object; class BirthdateValidator extends ConstraintValidator { - private string $interval_spec; + private readonly string $interval_spec; private string $below_interval = 'P150Y'; diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index a2d8ba92e..0d60c1060 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -81,7 +81,7 @@ 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 (str_starts_with($val, 'address_')) { + if (str_starts_with((string) $val, 'address_')) { return ['data-display-target' => 'address_date']; } @@ -250,7 +250,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface return ''; } - return $this->translatableStringHelper->localize(json_decode($value, true, 512, JSON_THROW_ON_ERROR)); + return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR)); }; default: @@ -488,13 +488,13 @@ class ReportList implements ExportElementValidatedInterface, ListInterface return $this->customFieldProvider ->getCustomFieldByType($cf->getType()) - ->render(json_decode($value, true, 512, JSON_THROW_ON_ERROR), $cf, 'csv'); + ->render(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR), $cf, 'csv'); }; if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { return function ($value) use ($cf, $cfType, $key) { $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; - $decoded = json_decode($value, true, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; diff --git a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php index be275b22a..27536eb4a 100644 --- a/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php +++ b/src/Bundle/ChillThirdPartyBundle/Export/Helper/LabelThirdPartyHelper.php @@ -48,7 +48,7 @@ class LabelThirdPartyHelper return ''; } - $decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode((string) $value, null, 512, JSON_THROW_ON_ERROR); if (0 === count($decoded)) { return ''; diff --git a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php index 9626a885b..c77d8fad9 100644 --- a/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php +++ b/src/Bundle/ChillWopiBundle/src/Service/Wopi/ChillDocumentLockManager.php @@ -28,7 +28,7 @@ class ChillDocumentLockManager implements DocumentLockManagerInterface public function __construct( private readonly ChillRedis $redis, - private int $ttlAfterDeleteSeconds = self::LOCK_GRACEFUL_DURATION_TIME + private readonly int $ttlAfterDeleteSeconds = self::LOCK_GRACEFUL_DURATION_TIME ) { }