From 2ed42e1a2ceaddad06796e76a375bec491dd07c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 8 Feb 2024 21:12:27 +0100 Subject: [PATCH] Fix cs with php-cs-fier version 3.49 --- .../ChillEventBundle/Controller/EventController.php | 3 ++- .../Controller/EventListController.php | 3 ++- .../Controller/ParticipationController.php | 5 +++-- src/Bundle/ChillEventBundle/Entity/Participation.php | 1 - src/Bundle/ChillEventBundle/Form/EventType.php | 2 +- .../ChillEventBundle/Menu/SectionMenuBuilder.php | 3 ++- .../Repository/EventACLAwareRepository.php | 3 ++- .../Tests/Controller/EventListControllerTest.php | 4 +++- .../Tests/Controller/ParticipationControllerTest.php | 10 +++++----- .../Pagination/PaginatorFactoryInterface.php | 2 +- src/Bundle/ChillMainBundle/Test/DummyPaginator.php | 5 +++-- 11 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 02fbe44af..7cbd2fbbe 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -57,7 +57,8 @@ final class EventController extends AbstractController private readonly TranslatorInterface $translator, private readonly PaginatorFactory $paginator, private readonly Security $security, - ) {} + ) { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"}) diff --git a/src/Bundle/ChillEventBundle/Controller/EventListController.php b/src/Bundle/ChillEventBundle/Controller/EventListController.php index 60df81240..8af005875 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventListController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventListController.php @@ -40,7 +40,8 @@ final readonly class EventListController private PaginatorFactoryInterface $paginatorFactory, private TranslatableStringHelperInterface $translatableStringHelper, private UrlGeneratorInterface $urlGenerator, - ) {} + ) { + } /** * @Route("{_locale}/event/event/list", name="chill_event_event_list") diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 54f75f3ae..06a8dda29 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -41,7 +41,8 @@ final class ParticipationController extends AbstractController private readonly TranslatorInterface $translator, private readonly EventRepository $eventRepository, private readonly PersonRepository $personRepository, - ) {} + ) { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create") @@ -328,7 +329,7 @@ final class ParticipationController extends AbstractController */ public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse { - $event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class) + $event = $this->getDoctrine()->getRepository(Event::class) ->find($event_id); if (null === $event) { diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index d5ab7deeb..ded8ae8da 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -15,7 +15,6 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; -use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\HasScopeInterface; use Chill\MainBundle\Entity\Scope; diff --git a/src/Bundle/ChillEventBundle/Form/EventType.php b/src/Bundle/ChillEventBundle/Form/EventType.php index d874fa95f..fe64ef12b 100644 --- a/src/Bundle/ChillEventBundle/Form/EventType.php +++ b/src/Bundle/ChillEventBundle/Form/EventType.php @@ -68,7 +68,7 @@ class EventType extends AbstractType ], 'allow_add' => true, 'allow_delete' => true, - 'delete_empty' => fn(StoredObject $storedObject): bool => '' === $storedObject->getFilename(), + 'delete_empty' => fn (StoredObject $storedObject): bool => '' === $storedObject->getFilename(), 'button_remove_label' => 'event.form.remove_document', 'button_add_label' => 'event.form.add_document', ]) diff --git a/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php index 341848e42..2c78392ee 100644 --- a/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillEventBundle/Menu/SectionMenuBuilder.php @@ -22,7 +22,8 @@ final readonly class SectionMenuBuilder implements LocalMenuBuilderInterface public function __construct( private Security $security, private TranslatorInterface $translator, - ) {} + ) { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php b/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php index 7b9b027f9..f92b1e825 100644 --- a/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php +++ b/src/Bundle/ChillEventBundle/Repository/EventACLAwareRepository.php @@ -29,7 +29,8 @@ final readonly class EventACLAwareRepository implements EventACLAwareRepositoryI private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private EntityManagerInterface $entityManager, private Security $security, - ) {} + ) { + } /** * @throws NonUniqueResultException diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php index a7814dd84..2519ff9b5 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventListControllerTest.php @@ -30,7 +30,9 @@ class EventListControllerTest extends WebTestCase private readonly PaginatorFactory $paginatorFactory; private readonly Environment $environment; - protected function setUp(): void {} + protected function setUp(): void + { + } public function testList(): void { diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php index dbc9d574b..0ef7f3d0d 100644 --- a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php @@ -143,7 +143,7 @@ final class ParticipationControllerTest extends WebTestCase $client = $this->getClientAuthenticated(); $this->prepareDI(); - /** @var \Chill\EventBundle\Entity\Event $event */ + /** @var Event $event */ $event = $this->getRandomEventWithMultipleParticipations(); $crawler = $client->request('GET', '/fr/event/participation/'.$event->getId(). @@ -301,7 +301,7 @@ final class ParticipationControllerTest extends WebTestCase $this->assertGreaterThan(0, \count($span2)); // as the container has reloaded, reload the event - $event = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event->getId()); + $event = $this->em->getRepository(Event::class)->find($event->getId()); $this->em->refresh($event); $this->assertEquals($nbParticipations + 2, $event->getParticipations()->count()); @@ -398,7 +398,7 @@ final class ParticipationControllerTest extends WebTestCase $this->assertTrue($client->getResponse()->isRedirect()); // reload the event and test there is a new participation - $event = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class) + $event = $this->em->getRepository(Event::class) ->find($event->getId()); $this->em->refresh($event); @@ -451,7 +451,7 @@ final class ParticipationControllerTest extends WebTestCase $this->assertGreaterThan(0, \count($span)); // as the container has reloaded, reload the event - $event = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event->getId()); + $event = $this->em->getRepository(Event::class)->find($event->getId()); $this->em->refresh($event); $this->assertEquals($nbParticipations + 1, $event->getParticipations()->count()); @@ -476,7 +476,7 @@ final class ParticipationControllerTest extends WebTestCase * @param string $centerName * @param type $circleName * - * @return \Chill\EventBundle\Entity\Event + * @return Event */ protected function getRandomEventWithMultipleParticipations( $centerName = 'Center A', diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactoryInterface.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactoryInterface.php index c83d1f45c..5e5162761 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactoryInterface.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactoryInterface.php @@ -25,7 +25,7 @@ interface PaginatorFactoryInterface * @param string|null $route the specific route to use in pages * @param array|null $routeParameters the specific route parameters to use in pages */ - public function create(int $totalItems, string $route = null, array $routeParameters = null): PaginatorInterface; + public function create(int $totalItems, ?string $route = null, ?array $routeParameters = null): PaginatorInterface; public function getCurrentItemsPerPage(): int; diff --git a/src/Bundle/ChillMainBundle/Test/DummyPaginator.php b/src/Bundle/ChillMainBundle/Test/DummyPaginator.php index 7e1442ce3..ff6c55a46 100644 --- a/src/Bundle/ChillMainBundle/Test/DummyPaginator.php +++ b/src/Bundle/ChillMainBundle/Test/DummyPaginator.php @@ -23,9 +23,10 @@ class DummyPaginator implements PaginatorFactoryInterface private readonly UrlGeneratorInterface $urlGenerator, private readonly string $route, private readonly array $routeParameters = [] - ) {} + ) { + } - public function create(int $totalItems, string $route = null, array $routeParameters = null): PaginatorInterface + public function create(int $totalItems, ?string $route = null, ?array $routeParameters = null): PaginatorInterface { return new Paginator( $totalItems,