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

@@ -21,6 +21,6 @@ class ChillTaskBundle extends Bundle
{
parent::build($container);
$container->addCompilerPass(new TaskWorkflowDefinitionCompilerPass());
$container->addCompilerPass(new TaskWorkflowDefinitionCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
}
}

View File

@@ -135,16 +135,10 @@ final class SingleTaskController extends AbstractController
->trans('The task has been successfully removed.'));
if ($task->getContext() instanceof Person) {
return $this->redirect($this->generateUrl(
'chill_task_singletask_by-person_list',
['id' => $task->getPerson()->getId()]
));
return $this->redirectToRoute('chill_task_singletask_by-person_list', ['id' => $task->getPerson()->getId()]);
}
return $this->redirect($this->generateUrl(
'chill_task_singletask_by-course_list',
['id' => $task->getCourse()->getId()]
));
return $this->redirectToRoute('chill_task_singletask_by-course_list', ['id' => $task->getCourse()->getId()]);
}
}
@@ -183,7 +177,7 @@ final class SingleTaskController extends AbstractController
$event = (new UIEvent('single-task', $task))
->setForm($this->setCreateForm($task, TaskVoter::UPDATE));
$this->eventDispatcher->dispatch(UIEvent::EDIT_FORM, $event);
$this->eventDispatcher->dispatch($event, UIEvent::EDIT_FORM);
$form = $event->getForm();
@@ -205,7 +199,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(),
'action' => 'update',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
if ($request->query->has('returnPath')) {
return $this->redirect($request->query->get('returnPath'));
@@ -228,7 +222,7 @@ final class SingleTaskController extends AbstractController
$this->addFlash('error', $this->translator->trans('This form contains errors'));
}
$this->eventDispatcher->dispatch(UIEvent::EDIT_PAGE, $event);
$this->eventDispatcher->dispatch($event, UIEvent::EDIT_PAGE);
if ($event->hasResponse()) {
return $event->getResponse();
@@ -240,7 +234,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(),
'action' => 'edit',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
return $this->render('@ChillTask/SingleTask/Person/edit.html.twig', [
'task' => $task,
@@ -548,7 +542,7 @@ final class SingleTaskController extends AbstractController
$em = $this->getDoctrine()->getManager();
$em->persist($task);
$this->eventDispatcher->dispatch(TaskEvent::PERSIST, new TaskEvent($task));
$this->eventDispatcher->dispatch(new TaskEvent($task), TaskEvent::PERSIST);
$em->flush();
@@ -605,7 +599,7 @@ final class SingleTaskController extends AbstractController
'element_id' => $task->getId(),
'action' => 'show',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
$this->eventDispatcher->dispatch($event, PrivacyEvent::PERSON_PRIVACY_EVENT);
}
$timeline = $this->timelineBuilder

View File

@@ -119,7 +119,7 @@ class TaskController extends AbstractController
->setForm($form)
->setTransition($transitionInstance);
$eventDispatcher->dispatch(UIEvent::SHOW_TRANSITION_PAGE, $event);
$eventDispatcher->dispatch($event, UIEvent::SHOW_TRANSITION_PAGE);
if ($event->hasResponse()) {
return $event->getResponse();

View File

@@ -14,7 +14,7 @@ namespace Chill\TaskBundle\Event;
use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\EventDispatcher\Event;
class TaskEvent extends Event
class TaskEvent extends \Symfony\Contracts\EventDispatcher\Event
{
final public const PERSIST = 'chill_task.task_persist';

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Workflow\Transition;
class UIEvent extends Event
class UIEvent extends \Symfony\Contracts\EventDispatcher\Event
{
final public const EDIT_FORM = 'chill_task.edit_form';

View File

@@ -17,7 +17,7 @@ use Chill\TaskBundle\Entity\AbstractTask;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class AuthorizationEvent extends Event
class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event
{
final public const VOTE = 'chill_task.vote';

View File

@@ -95,7 +95,7 @@ final class TaskVoter extends AbstractChillVoter implements ProvideRoleHierarchy
$event = new AuthorizationEvent($subject, $attribute, $token);
$this->eventDispatcher->dispatch(AuthorizationEvent::VOTE, $event);
$this->eventDispatcher->dispatch($event, AuthorizationEvent::VOTE);
if ($event->hasVote()) {
$this->logger->debug('The TaskVoter is overriding by '