update php-cs-fixer and rector + fix rules

This commit is contained in:
2024-01-09 13:50:45 +01:00
parent a63b40fb6c
commit 825cd127d1
79 changed files with 220 additions and 229 deletions

View File

@@ -93,7 +93,7 @@ class EventController extends AbstractController
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
$event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->findOneBy([
$event = $em->getRepository(Event::class)->findOneBy([
'id' => $event_id,
]);
@@ -147,7 +147,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id);
$entity = $em->getRepository(Event::class)->find($event_id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Event entity.');
@@ -174,7 +174,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id);
$person = $em->getRepository(Person::class)->find($person_id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');
@@ -188,11 +188,11 @@ class EventController extends AbstractController
$person->getCenter()
);
$total = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->countByPerson($person_id);
$total = $em->getRepository(Participation::class)->countByPerson($person_id);
$paginator = $this->paginator->create($total);
$participations = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findByPersonInCircle(
$participations = $em->getRepository(Participation::class)->findByPersonInCircle(
$person_id,
$reachablesCircles,
$paginator->getCurrentPage()->getFirstItemNumber(),
@@ -353,7 +353,7 @@ class EventController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id);
$entity = $em->getRepository(Event::class)->find($event_id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Event entity.');

View File

@@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class EventTypeController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new EventType entity.
*
@@ -62,7 +61,7 @@ class EventTypeController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@@ -84,7 +83,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@@ -109,7 +108,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->findAll();
$entities = $em->getRepository(EventType::class)->findAll();
return $this->render('@ChillEvent/EventType/index.html.twig', [
'entities' => $entities,
@@ -141,7 +140,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
@@ -164,7 +163,7 @@ class EventTypeController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
$entity = $em->getRepository(EventType::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');

View File

@@ -34,7 +34,10 @@ class ParticipationController extends AbstractController
* ParticipationController constructor.
*/
public function __construct(
private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
private readonly LoggerInterface $logger,
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
@@ -240,7 +243,7 @@ class ParticipationController extends AbstractController
public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$em = $this->managerRegistry->getManager();
$participation = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findOneBy([
$participation = $em->getRepository(Participation::class)->findOneBy([
'id' => $participation_id,
]);
@@ -320,7 +323,7 @@ class ParticipationController extends AbstractController
*/
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$event = $this->managerRegistry->getRepository(\Chill\EventBundle\Entity\Event::class)
$event = $this->managerRegistry->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@@ -456,8 +459,8 @@ class ParticipationController extends AbstractController
*/
public function updateMultipleAction(mixed $event_id, Request $request)
{
/** @var \Chill\EventBundle\Entity\Event $event */
$event = $this->managerRegistry->getRepository(\Chill\EventBundle\Entity\Event::class)
/** @var Event $event */
$event = $this->managerRegistry->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@@ -499,7 +502,7 @@ class ParticipationController extends AbstractController
}
/**
* @return \Symfony\Component\Form\FormInterface
* @return FormInterface
*/
protected function createEditFormMultiple(Collection $participations, Event $event)
{
@@ -558,7 +561,7 @@ class ParticipationController extends AbstractController
// prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given`
if (null !== $event_id) {
$event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)
$event = $em->getRepository(Event::class)
->find($event_id);
if (null === $event) {
@@ -752,7 +755,7 @@ class ParticipationController extends AbstractController
}
/**
* @return \Symfony\Component\Form\FormInterface
* @return FormInterface
*/
private function createDeleteForm($participation_id)
{

View File

@@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class RoleController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new Role entity.
*
@@ -62,7 +61,7 @@ class RoleController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@@ -84,7 +83,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@@ -109,7 +108,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->findAll();
$entities = $em->getRepository(Role::class)->findAll();
return $this->render('@ChillEvent/Role/index.html.twig', [
'entities' => $entities,
@@ -141,7 +140,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
@@ -164,7 +163,7 @@ class RoleController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
$entity = $em->getRepository(Role::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');

View File

@@ -22,9 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
class StatusController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Creates a new Status entity.
*
@@ -62,7 +61,7 @@ class StatusController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@@ -84,7 +83,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@@ -109,7 +108,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entities = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->findAll();
$entities = $em->getRepository(Status::class)->findAll();
return $this->render('@ChillEvent/Status/index.html.twig', [
'entities' => $entities,
@@ -141,7 +140,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
@@ -164,7 +163,7 @@ class StatusController extends AbstractController
{
$em = $this->managerRegistry->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
$entity = $em->getRepository(Status::class)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');

View File

@@ -73,7 +73,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
->findBy(['center' => $center]);
$events = $this->createEvents($center, $manager);
/** @var \Chill\PersonBundle\Entity\Person $person */
/** @var Person $person */
foreach ($people as $person) {
$nb = random_int(0, 3);

View File

@@ -52,7 +52,7 @@ final class EventSearchTest extends WebTestCase
/**
* The eventSearch service, which is used to search events.
*
* @var \Chill\EventBundle\Search\EventSearch
* @var EventSearch
*/
protected $eventSearch;