mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
cs: Enable risky rule static_lambda
.
This commit is contained in:
@@ -59,7 +59,7 @@ class EventChoiceLoader implements ChoiceLoaderInterface
|
||||
{
|
||||
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
|
||||
$this->lazyLoadedEvents,
|
||||
function (Event $p) use ($value) {
|
||||
static function (Event $p) use ($value) {
|
||||
return call_user_func($value, $p);
|
||||
}
|
||||
);
|
||||
|
@@ -106,14 +106,14 @@ class PickEventType extends AbstractType
|
||||
// add the default options
|
||||
$resolver->setDefaults([
|
||||
'class' => Event::class,
|
||||
'choice_label' => function (Event $e) {
|
||||
'choice_label' => static function (Event $e) {
|
||||
return $e->getDate()->format('d/m/Y, H:i') . ' → ' .
|
||||
// $e->getType()->getName()['fr'] . ': ' . // display the type of event
|
||||
$e->getName();
|
||||
},
|
||||
'placeholder' => 'Pick an event',
|
||||
'attr' => ['class' => 'select2 '],
|
||||
'choice_attr' => function (Event $e) {
|
||||
'choice_attr' => static function (Event $e) {
|
||||
return ['data-center' => $e->getCenter()->getId()];
|
||||
},
|
||||
'choiceloader' => function (Options $options) {
|
||||
@@ -140,7 +140,7 @@ class PickEventType extends AbstractType
|
||||
// option role
|
||||
if (null === $options['role']) {
|
||||
$centers = array_map(
|
||||
function (GroupCenter $g) {
|
||||
static function (GroupCenter $g) {
|
||||
return $g->getCenter();
|
||||
},
|
||||
$this->user->getGroupCenters()->toArray()
|
||||
@@ -169,7 +169,7 @@ class PickEventType extends AbstractType
|
||||
}
|
||||
|
||||
if (!in_array($c->getId(), array_map(
|
||||
function (Center $c) { return $c->getId(); },
|
||||
static function (Center $c) { return $c->getId(); },
|
||||
$centers
|
||||
))) {
|
||||
throw new AccessDeniedException('The given center is not reachable');
|
||||
|
@@ -37,14 +37,14 @@ class PickEventTypeType extends AbstractType
|
||||
$resolver->setDefaults(
|
||||
[
|
||||
'class' => EventType::class,
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('et')
|
||||
->where('et.active = true');
|
||||
},
|
||||
'choice_label' => function (EventType $t) use ($helper) {
|
||||
'choice_label' => static function (EventType $t) use ($helper) {
|
||||
return $helper->localize($t->getName());
|
||||
},
|
||||
'choice_attrs' => function (EventType $t) {
|
||||
'choice_attrs' => static function (EventType $t) {
|
||||
return ['data-link-category' => $t->getId()];
|
||||
},
|
||||
]
|
||||
|
@@ -109,13 +109,13 @@ class PickRoleType extends AbstractType
|
||||
'class' => Role::class,
|
||||
'query_builder' => $qb,
|
||||
'group_by' => null,
|
||||
'choice_attr' => function (Role $r) {
|
||||
'choice_attr' => static function (Role $r) {
|
||||
return [
|
||||
'data-event-type' => $r->getType()->getId(),
|
||||
'data-link-category' => $r->getType()->getId(),
|
||||
];
|
||||
},
|
||||
'choice_label' => function (Role $r) use ($translatableStringHelper, $translator) {
|
||||
'choice_label' => static function (Role $r) use ($translatableStringHelper, $translator) {
|
||||
return $translatableStringHelper->localize($r->getName()) .
|
||||
($r->getActive() === true ? '' :
|
||||
' (' . $translator->trans('unactive') . ')');
|
||||
|
@@ -110,13 +110,13 @@ class PickStatusType extends AbstractType
|
||||
'class' => Status::class,
|
||||
'query_builder' => $qb,
|
||||
'group_by' => null,
|
||||
'choice_attr' => function (Status $s) {
|
||||
'choice_attr' => static function (Status $s) {
|
||||
return [
|
||||
'data-event-type' => $s->getType()->getId(),
|
||||
'data-link-category' => $s->getType()->getId(),
|
||||
];
|
||||
},
|
||||
'choice_label' => function (Status $s) use ($translatableStringHelper, $translator) {
|
||||
'choice_label' => static function (Status $s) use ($translatableStringHelper, $translator) {
|
||||
return $translatableStringHelper->localize($s->getName()) .
|
||||
($s->getActive() === true ? '' :
|
||||
' (' . $translator->trans('unactive') . ')');
|
||||
|
Reference in New Issue
Block a user