cs: Enable risky rule static_lambda.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:43:34 +01:00
parent a9188355c5
commit 91d12c4a96
111 changed files with 212 additions and 212 deletions

View File

@@ -296,7 +296,7 @@ final class SingleTaskController extends AbstractController
$filterOrder = $this->buildFilterOrder();
$flags = array_merge(
$filterOrder->getCheckboxData('status'),
array_map(fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
);
$nb = $this->singleTaskAclAwareRepository->countByAllViewable(
$filterOrder->getQueryString(),
@@ -341,7 +341,7 @@ final class SingleTaskController extends AbstractController
$filterOrder = $this->buildFilterOrder();
$flags = array_merge(
$filterOrder->getCheckboxData('status'),
array_map(fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
);
$nb = $this->singleTaskAclAwareRepository->countByCourse(
$course,
@@ -390,7 +390,7 @@ final class SingleTaskController extends AbstractController
$filterOrder = $this->buildFilterOrder();
$flags = array_merge(
$filterOrder->getCheckboxData('status'),
array_map(fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
);
$nb = $this->singleTaskAclAwareRepository->countByPerson(
$person,
@@ -440,7 +440,7 @@ final class SingleTaskController extends AbstractController
$filterOrder = $this->buildFilterOrder();
$flags = array_merge(
$filterOrder->getCheckboxData('status'),
array_map(fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
array_map(static fn ($i) => 'state_' . $i, $filterOrder->getCheckboxData('states'))
);
$nb = $this->singleTaskAclAwareRepository->countByCurrentUsersTasks(
$filterOrder->getQueryString(),

View File

@@ -91,7 +91,7 @@ class TaskController extends AbstractController
$transitionInstance = array_values( // array_values needed to reset keys (array_filter preserves keys)
array_filter(
$workflow->getEnabledTransitions($task),
function (Transition $t) use ($transition) {
static function (Transition $t) use ($transition) {
return $t->getName() === $transition;
}
))[0];

View File

@@ -215,9 +215,9 @@ class SingleTaskListType extends AbstractType
$users = $this->getUsersAssigneedToTask($options);
$choices = array_combine(
// get usernames
array_map(function (User $user) { return $user->getUsername(); }, $users),
array_map(static function (User $user) { return $user->getUsername(); }, $users),
// get ids
array_map(function (User $user) { return $user->getId(); }, $users)
array_map(static function (User $user) { return $user->getId(); }, $users)
);
$choices['Unassigned'] = '_unassigned';

View File

@@ -90,7 +90,7 @@ class SingleTaskControllerTest extends WebTestCase
$center = array_filter(
$centers,
function (Center $c) use ($centerName) {
static function (Center $c) use ($centerName) {
return $c->getName() === $centerName;
}
)[0];

View File

@@ -83,7 +83,7 @@ class SingleTaskTaskLifeCycleEventTimelineProvider implements TimelineProviderIn
->findBy(['id' => $ids]);
return array_combine(
array_map(function ($e) { return $e->getId(); }, $events),
array_map(static function ($e) { return $e->getId(); }, $events),
$events
);
}

View File

@@ -94,7 +94,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
->findBy(['id' => $ids]);
return array_combine(
array_map(function ($e) { return $e->getId(); }, $events),
array_map(static function ($e) { return $e->getId(); }, $events),
$events
);
}