mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -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();
|
||||
|
||||
|
@@ -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(
|
||||
|
@@ -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 = [];
|
||||
|
@@ -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]))
|
||||
|
@@ -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]))
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -123,10 +123,7 @@ class PickEventType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParent()
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return EntityType::class;
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user