apply rector rules: symfony **UP TO** 44

This commit is contained in:
2023-07-28 01:52:53 +02:00
parent b6a094aeee
commit c20f65eebb
88 changed files with 211 additions and 320 deletions

View File

@@ -205,7 +205,7 @@ class EventController extends AbstractController
'element_class' => Participation::class,
'action' => 'list',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $privacyEvent);
$this->eventDispatcher->dispatch($privacyEvent, PrivacyEvent::PERSON_PRIVACY_EVENT);
$addEventParticipationByPersonForm = $this->createAddEventParticipationByPersonForm($person);
@@ -252,7 +252,7 @@ class EventController extends AbstractController
$this->addFlash('success', $this->get('translator')
->trans('The event was created'));
return $this->redirect($this->generateUrl('chill_event__event_show', ['event_id' => $entity->getId()]));
return $this->redirectToRoute('chill_event__event_show', ['event_id' => $entity->getId()]);
}
return $this->render('ChillEventBundle:Event:new.html.twig', [
@@ -363,7 +363,7 @@ class EventController extends AbstractController
$this->addFlash('success', $this->get('translator')
->trans('The event was updated'));
return $this->redirect($this->generateUrl('chill_event__event_edit', ['event_id' => $event_id]));
return $this->redirectToRoute('chill_event__event_edit', ['event_id' => $event_id]);
}
return $this->render('ChillEventBundle:Event:edit.html.twig', [

View File

@@ -31,15 +31,12 @@ class EventTypeController extends AbstractController
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl(
'chill_eventtype_admin',
['id' => $entity->getId()]
));
return $this->redirectToRoute('chill_eventtype_admin', ['id' => $entity->getId()]);
}
return $this->render('ChillEventBundle:EventType:new.html.twig', [
@@ -56,7 +53,7 @@ class EventTypeController extends AbstractController
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id);
@@ -68,7 +65,7 @@ class EventTypeController extends AbstractController
$em->flush();
}
return $this->redirect($this->generateUrl('chill_eventtype_admin'));
return $this->redirectToRoute('chill_eventtype_admin');
}
/**
@@ -160,13 +157,10 @@ class EventTypeController extends AbstractController
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl(
'chill_eventtype_admin',
['id' => $id]
));
return $this->redirectToRoute('chill_eventtype_admin', ['id' => $id]);
}
return $this->render('ChillEventBundle:EventType:edit.html.twig', [

View File

@@ -31,15 +31,12 @@ class RoleController extends AbstractController
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl(
'chill_event_admin_role',
['id' => $entity->getId()]
));
return $this->redirectToRoute('chill_event_admin_role', ['id' => $entity->getId()]);
}
return $this->render('ChillEventBundle:Role:new.html.twig', [
@@ -56,7 +53,7 @@ class RoleController extends AbstractController
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id);
@@ -68,7 +65,7 @@ class RoleController extends AbstractController
$em->flush();
}
return $this->redirect($this->generateUrl('chill_event_admin_role'));
return $this->redirectToRoute('chill_event_admin_role');
}
/**
@@ -160,13 +157,10 @@ class RoleController extends AbstractController
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl(
'chill_event_admin_role',
['id' => $id]
));
return $this->redirectToRoute('chill_event_admin_role', ['id' => $id]);
}
return $this->render('ChillEventBundle:Role:edit.html.twig', [

View File

@@ -31,12 +31,12 @@ class StatusController extends AbstractController
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $entity->getId()]));
return $this->redirectToRoute('chill_event_admin_status', ['id' => $entity->getId()]);
}
return $this->render('ChillEventBundle:Status:new.html.twig', [
@@ -53,7 +53,7 @@ class StatusController extends AbstractController
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id);
@@ -65,7 +65,7 @@ class StatusController extends AbstractController
$em->flush();
}
return $this->redirect($this->generateUrl('chill_event_admin_status'));
return $this->redirectToRoute('chill_event_admin_status');
}
/**
@@ -157,10 +157,10 @@ class StatusController extends AbstractController
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
if ($editForm->isSubmitted() && $editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $id]));
return $this->redirectToRoute('chill_event_admin_status', ['id' => $id]);
}
return $this->render('ChillEventBundle:Status:edit.html.twig', [

View File

@@ -65,7 +65,7 @@ class EventType extends AbstractType
/**
* @return string
*/
public function getName()
public function getBlockPrefix()
{
return 'chill_eventbundle_event';
}

View File

@@ -28,12 +28,12 @@ class EventTypeType extends AbstractType
/**
* @return string
*/
public function getName()
public function getBlockPrefix()
{
return 'chill_eventbundle_eventtype';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\EventType::class,

View File

@@ -40,12 +40,12 @@ final class RoleType extends AbstractType
/**
* @return string
*/
public function getName()
public function getBlockPrefix()
{
return 'chill_eventbundle_role';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\Role::class,

View File

@@ -30,12 +30,12 @@ class StatusType extends AbstractType
/**
* @return string
*/
public function getName()
public function getBlockPrefix()
{
return 'chill_eventbundle_status';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(\Symfony\Component\OptionsResolver\OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => \Chill\EventBundle\Entity\Status::class,

View File

@@ -60,7 +60,7 @@ final class PickRoleType extends AbstractType
$form = $event->getForm();
$name = $form->getName();
$config = $form->getConfig();
$type = $config->getType()->getName();
$type = $config->getType()->getBlockPrefix();
$options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [

View File

@@ -60,7 +60,7 @@ final class PickStatusType extends AbstractType
$form = $event->getForm();
$name = $form->getName();
$config = $form->getConfig();
$type = $config->getType()->getName();
$type = $config->getType()->getBlockPrefix();
$options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [
'group_by' => fn (Status $s) => $this->translatableStringHelper->localize($s->getType()->getName()),

View File

@@ -24,7 +24,7 @@ use function in_array;
final class ParticipationControllerTest extends WebTestCase
{
/**
* @var \Symfony\Component\BrowserKit\Client
* @var \Symfony\Component\BrowserKit\AbstractBrowser
*/
protected $client;

View File

@@ -33,7 +33,7 @@ final class EventSearchTest extends WebTestCase
protected $centerA;
/**
* @var \Symfony\Component\BrowserKit\Client
* @var \Symfony\Component\BrowserKit\AbstractBrowser
*/
protected $client;

View File

@@ -2,7 +2,7 @@ services:
Chill\EventBundle\Controller\EventController:
arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
$eventDispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface'
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
$formFactoryInterface: '@Symfony\Component\Form\FormFactoryInterface'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'