Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -22,9 +22,8 @@ class AdminController extends AbstractController
{
/**
* Event admin.
*
* @Route("/{_locale}/admin/event", name="chill_event_admin_index")
*/
#[Route(path: '/{_locale}/admin/event', name: 'chill_event_admin_index')]
public function indexAdminAction()
{
return $this->render('@ChillEvent/Admin/index.html.twig');

View File

@@ -60,9 +60,7 @@ final class EventController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'DELETE'])]
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@@ -113,9 +111,11 @@ final class EventController extends AbstractController
* Displays a form to edit an existing Event entity.
*
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')]
public function editAction($event_id)
{
$em = $this->managerRegistry->getManager();
@@ -140,9 +140,11 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Doctrine\ORM\NonUniqueResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])]
public function listByPersonAction($person_id)
{
$em = $this->managerRegistry->getManager();
@@ -188,9 +190,7 @@ final class EventController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/most_recent", name="chill_event_list_most_recent", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/most_recent', name: 'chill_event_list_most_recent', options: [null])]
public function mostRecentIndexAction()
{
return $this->redirectToRoute('chill_main_search', [
@@ -202,9 +202,11 @@ final class EventController extends AbstractController
* Displays a form to create a new Event entity.
*
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])]
public function newAction(?Center $center, Request $request)
{
$user = $this->security->getUser();
@@ -244,9 +246,8 @@ final class EventController extends AbstractController
/**
* First step of new Event form.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new/pick-center", name="chill_event__event_new_pickcenter", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])]
public function newPickCenterAction()
{
$role = 'CHILL_EVENT_CREATE';
@@ -294,9 +295,11 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')]
public function showAction(Event $event, Request $request)
{
if (!$event) {
@@ -326,9 +329,8 @@ final class EventController extends AbstractController
/**
* Edits an existing Event entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/update", name="chill_event__event_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/update', name: 'chill_event__event_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -42,9 +42,7 @@ final readonly class EventListController
private UrlGeneratorInterface $urlGenerator,
) {}
/**
* @Route("{_locale}/event/event/list", name="chill_event_event_list")
*/
#[Route(path: '{_locale}/event/event/list', name: 'chill_event_event_list')]
public function __invoke(): Response
{
$filter = $this->buildFilterOrder();

View File

@@ -26,9 +26,8 @@ class EventTypeController extends AbstractController
/**
* Creates a new EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/create", name="chill_eventtype_admin_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/create', name: 'chill_eventtype_admin_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new EventType();
@@ -51,9 +50,8 @@ class EventTypeController extends AbstractController
/**
* Deletes a EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/delete", name="chill_eventtype_admin_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@@ -76,9 +74,8 @@ class EventTypeController extends AbstractController
/**
* Displays a form to edit an existing EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/edit", name="chill_eventtype_admin_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -101,9 +98,8 @@ class EventTypeController extends AbstractController
/**
* Lists all EventType entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/", name="chill_eventtype_admin", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@@ -117,9 +113,8 @@ class EventTypeController extends AbstractController
/**
* Displays a form to create a new EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/new", name="chill_eventtype_admin_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')]
public function newAction()
{
$entity = new EventType();
@@ -133,9 +128,8 @@ class EventTypeController extends AbstractController
/**
* Finds and displays a EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/show", name="chill_eventtype_admin_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -156,9 +150,8 @@ class EventTypeController extends AbstractController
/**
* Edits an existing EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/update", name="chill_eventtype_admin_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@@ -44,9 +44,7 @@ final class ParticipationController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/create', name: 'chill_event_participation_create')]
public function createAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
// test the request is correct
@@ -243,9 +241,8 @@ final class ParticipationController extends AbstractController
/**
* @param int $participation_id
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/delete", name="chill_event_participation_delete", requirements={"participation_id"="\d+"}, methods={"GET", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'], methods: ['GET', 'DELETE'])]
public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$em = $this->managerRegistry->getManager();
@@ -292,9 +289,11 @@ final class ParticipationController extends AbstractController
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/edit", name="chill_event_participation_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')]
public function editAction(int $participation_id): Response
{
/** @var Participation $participation */
@@ -324,9 +323,11 @@ final class ParticipationController extends AbstractController
* show a form to edit multiple participation for the same event.
*
* @param int $event_id
* @param int $event_id
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')]
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$event = $this->managerRegistry->getRepository(Event::class)
@@ -381,9 +382,8 @@ final class ParticipationController extends AbstractController
* This function parse the person_id / persons_ids query argument
* and decide if it should process a single or multiple participation. Depending
* on this, the appropriate layout and form.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/new", name="chill_event_participation_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/new', name: 'chill_event_participation_new')]
public function newAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
// test the request is correct
@@ -416,9 +416,7 @@ final class ParticipationController extends AbstractController
."'persons_ids' argument in query");
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/update", name="chill_event_participation_update", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/update', name: 'chill_event_participation_update', methods: ['POST'])]
public function updateAction(int $participation_id, Request $request): Response
{
/** @var Participation $participation */
@@ -460,9 +458,7 @@ final 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"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/update_multiple', name: 'chill_event_participation_update_multiple', methods: ['POST'])]
public function updateMultipleAction(mixed $event_id, Request $request)
{
/** @var Event $event */

View File

@@ -26,9 +26,8 @@ class RoleController extends AbstractController
/**
* Creates a new Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/create", name="chill_event_admin_role_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/create', name: 'chill_event_admin_role_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new Role();
@@ -51,9 +50,8 @@ class RoleController extends AbstractController
/**
* Deletes a Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/delete", name="chill_event_admin_role_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@@ -76,9 +74,8 @@ class RoleController extends AbstractController
/**
* Displays a form to edit an existing Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/edit", name="chill_event_admin_role_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -101,9 +98,8 @@ class RoleController extends AbstractController
/**
* Lists all Role entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/", name="chill_event_admin_role", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@@ -117,9 +113,8 @@ class RoleController extends AbstractController
/**
* Displays a form to create a new Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/new", name="chill_event_admin_role_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')]
public function newAction()
{
$entity = new Role();
@@ -133,9 +128,8 @@ class RoleController extends AbstractController
/**
* Finds and displays a Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/show", name="chill_event_admin_role_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -156,9 +150,8 @@ class RoleController extends AbstractController
/**
* Edits an existing Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/update", name="chill_event_admin_role_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@@ -26,9 +26,8 @@ class StatusController extends AbstractController
/**
* Creates a new Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/create", name="chill_event_admin_status_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/create', name: 'chill_event_admin_status_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new Status();
@@ -51,9 +50,8 @@ class StatusController extends AbstractController
/**
* Deletes a Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/delete", name="chill_event_admin_status_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@@ -76,9 +74,8 @@ class StatusController extends AbstractController
/**
* Displays a form to edit an existing Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/edit", name="chill_event_admin_status_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -101,9 +98,8 @@ class StatusController extends AbstractController
/**
* Lists all Status entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/", name="chill_event_admin_status", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@@ -117,9 +113,8 @@ class StatusController extends AbstractController
/**
* Displays a form to create a new Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/new", name="chill_event_admin_status_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')]
public function newAction()
{
$entity = new Status();
@@ -133,9 +128,8 @@ class StatusController extends AbstractController
/**
* Finds and displays a Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/show", name="chill_event_admin_status_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@@ -156,9 +150,8 @@ class StatusController extends AbstractController
/**
* Edits an existing Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/update", name="chill_event_admin_status_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@@ -45,9 +45,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Center $center = null;
/**
@@ -76,9 +75,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
#[Assert\NotBlank]
private ?string $name = null;
/**
@@ -92,9 +90,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?EventType $type = null;
/**

View File

@@ -34,11 +34,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
*
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
*
* @ORM\HasLifecycleCallbacks
*
* @UniqueEntity({"event", "person"}, message="event.validation.person_already_participate_to_event")
*/
#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')]
class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface
{
use TrackCreationTrait;
@@ -62,9 +63,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Person $person = null;
/**
@@ -74,9 +74,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Status $status = null;
public function getCenter()