mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -29,7 +29,6 @@ use Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface;
|
||||
use Chill\TaskBundle\Repository\SingleTaskRepository;
|
||||
use Chill\TaskBundle\Repository\SingleTaskStateRepository;
|
||||
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
||||
use LogicException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -41,12 +40,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_map;
|
||||
use function array_merge;
|
||||
|
||||
final class SingleTaskController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
@@ -78,7 +73,7 @@ final class SingleTaskController extends AbstractController
|
||||
throw $this->createNotFoundException('Unable to find Task entity.');
|
||||
}
|
||||
|
||||
if ($task->getPerson() !== null) {
|
||||
if (null !== $task->getPerson()) {
|
||||
$personId = $task->getPerson()->getId();
|
||||
|
||||
if (null === $personId) {
|
||||
@@ -115,7 +110,7 @@ final class SingleTaskController extends AbstractController
|
||||
|
||||
$form = $this->createDeleteForm($id);
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||
if (Request::METHOD_DELETE === $request->getMethod()) {
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
@@ -174,7 +169,7 @@ final class SingleTaskController extends AbstractController
|
||||
Request $request
|
||||
) {
|
||||
$this->denyAccessUnlessGranted(TaskVoter::UPDATE, $task, 'You are not '
|
||||
. 'allowed to edit this task');
|
||||
.'allowed to edit this task');
|
||||
|
||||
$event = (new UIEvent('single-task', $task))
|
||||
->setForm($this->setCreateForm($task, TaskVoter::UPDATE));
|
||||
@@ -275,9 +270,9 @@ final class SingleTaskController extends AbstractController
|
||||
|
||||
$filteredUsers = $filterOrder->getUserPickerData('userPicker');
|
||||
|
||||
$flags = array_merge(
|
||||
$flags = \array_merge(
|
||||
$filterOrder->getCheckboxData('status'),
|
||||
array_map(static fn ($i) => 'state_' . $i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
\array_map(static fn ($i) => 'state_'.$i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
);
|
||||
|
||||
if ($showMissionTypeFilter) {
|
||||
@@ -329,9 +324,9 @@ final class SingleTaskController extends AbstractController
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $course);
|
||||
|
||||
$filterOrder = $this->buildFilterOrder();
|
||||
$flags = array_merge(
|
||||
$flags = \array_merge(
|
||||
$filterOrder->getCheckboxData('status'),
|
||||
array_map(static fn ($i) => 'state_' . $i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
\array_map(static fn ($i) => 'state_'.$i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
);
|
||||
$nb = $this->singleTaskAclAwareRepository->countByCourse(
|
||||
$course,
|
||||
@@ -378,9 +373,9 @@ final class SingleTaskController extends AbstractController
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $person);
|
||||
|
||||
$filterOrder = $this->buildFilterOrder();
|
||||
$flags = array_merge(
|
||||
$flags = \array_merge(
|
||||
$filterOrder->getCheckboxData('status'),
|
||||
array_map(static fn ($i) => 'state_' . $i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
\array_map(static fn ($i) => 'state_'.$i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
);
|
||||
$nb = $this->singleTaskAclAwareRepository->countByPerson(
|
||||
$person,
|
||||
@@ -418,6 +413,7 @@ final class SingleTaskController extends AbstractController
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/list/my",
|
||||
* name="chill_task_singletask_my_tasks",
|
||||
@@ -433,9 +429,9 @@ final class SingleTaskController extends AbstractController
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
||||
$filterOrder = $this->buildFilterOrder(false);
|
||||
$flags = array_merge(
|
||||
$flags = \array_merge(
|
||||
$filterOrder->getCheckboxData('status'),
|
||||
array_map(static fn ($i) => 'state_' . $i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
\array_map(static fn ($i) => 'state_'.$i, $filterOrder->hasCheckboxData('states') ? $filterOrder->getCheckboxData('states') : [])
|
||||
);
|
||||
$nb = $this->singleTaskAclAwareRepository->countByCurrentUsersTasks(
|
||||
$filterOrder->getQueryString(),
|
||||
@@ -541,7 +537,7 @@ final class SingleTaskController extends AbstractController
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted($role, $task, 'You are not '
|
||||
. 'allowed to create this task');
|
||||
.'allowed to create this task');
|
||||
|
||||
$form = $this->setCreateForm($task, $role);
|
||||
|
||||
@@ -589,7 +585,7 @@ final class SingleTaskController extends AbstractController
|
||||
'task' => $task,
|
||||
'accompanyingCourse' => $task->getCourse(),
|
||||
]),
|
||||
default => throw new LogicException('entity context not supported'),
|
||||
default => throw new \LogicException('entity context not supported'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -673,7 +669,7 @@ final class SingleTaskController extends AbstractController
|
||||
if ($includeMissionType) {
|
||||
$filterBuilder->addCheckbox(
|
||||
'missionTypePicker',
|
||||
array_map(
|
||||
\array_map(
|
||||
fn ($row) => $row['type'],
|
||||
$this->singleTaskRepository->findAllTaskDistinctTypes()
|
||||
)
|
||||
|
@@ -25,7 +25,6 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Workflow\Registry;
|
||||
use Symfony\Component\Workflow\Transition;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_filter;
|
||||
use function array_values;
|
||||
|
||||
@@ -43,7 +42,7 @@ class TaskController extends AbstractController
|
||||
* )
|
||||
*
|
||||
* @param string $kind
|
||||
* @param int $taskId
|
||||
* @param int $taskId
|
||||
* @param string $transition
|
||||
*
|
||||
* @return Response
|
||||
@@ -70,7 +69,7 @@ class TaskController extends AbstractController
|
||||
'list_params' => $request->query->get('list_params', []),
|
||||
]
|
||||
);
|
||||
$task->getCourse() === null ? $defaultTemplate = '@ChillTask/SingleTask/Person/transition.html.twig' : $defaultTemplate = '@ChillTask/SingleTask/AccompanyingCourse/transition.html.twig';
|
||||
null === $task->getCourse() ? $defaultTemplate = '@ChillTask/SingleTask/Person/transition.html.twig' : $defaultTemplate = '@ChillTask/SingleTask/AccompanyingCourse/transition.html.twig';
|
||||
|
||||
break;
|
||||
|
||||
@@ -82,8 +81,7 @@ class TaskController extends AbstractController
|
||||
}
|
||||
|
||||
if (null === $task) {
|
||||
throw $this->createNotFoundException("task with id '{$taskId}' and type "
|
||||
. "'{$kind}' does not exists");
|
||||
throw $this->createNotFoundException("task with id '{$taskId}' and type '{$kind}' does not exists");
|
||||
}
|
||||
|
||||
$workflow = $registry->get($task);
|
||||
@@ -91,8 +89,8 @@ class TaskController extends AbstractController
|
||||
if (!$workflow->can($task, $transition)) {
|
||||
throw $this->createAccessDeniedException('You are not allowed to apply this transition');
|
||||
}
|
||||
$transitionInstance = array_values( // array_values needed to reset keys (array_filter preserves keys)
|
||||
array_filter(
|
||||
$transitionInstance = \array_values( // array_values needed to reset keys (array_filter preserves keys)
|
||||
\array_filter(
|
||||
$workflow->getEnabledTransitions($task),
|
||||
static fn (Transition $t) => $t->getName() === $transition
|
||||
)
|
||||
|
Reference in New Issue
Block a user