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:
@@ -52,7 +52,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
{
|
||||
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
|
||||
$this->lazyLoadedPersons,
|
||||
function (Person $p) use ($value) {
|
||||
static function (Person $p) use ($value) {
|
||||
return call_user_func($value, $p);
|
||||
}
|
||||
);
|
||||
|
@@ -111,10 +111,10 @@ class PersonType extends AbstractType
|
||||
]);
|
||||
|
||||
$builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer(
|
||||
function ($string) {
|
||||
static function ($string) {
|
||||
return strtoupper($string);
|
||||
},
|
||||
function ($string) {
|
||||
static function ($string) {
|
||||
return strtoupper($string);
|
||||
}
|
||||
));
|
||||
@@ -148,7 +148,7 @@ class PersonType extends AbstractType
|
||||
'allow_delete' => true,
|
||||
'by_reference' => false,
|
||||
'label' => false,
|
||||
'delete_empty' => function (?PersonPhone $pp = null) {
|
||||
'delete_empty' => static function (?PersonPhone $pp = null) {
|
||||
return null === $pp || $pp->isEmpty();
|
||||
},
|
||||
'error_bubbling' => false,
|
||||
@@ -192,7 +192,7 @@ class PersonType extends AbstractType
|
||||
'choice_label' => function (Civility $civility): string {
|
||||
return $this->translatableStringHelper->localize($civility->getName());
|
||||
},
|
||||
'query_builder' => function (EntityRepository $er): QueryBuilder {
|
||||
'query_builder' => static function (EntityRepository $er): QueryBuilder {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.active = true');
|
||||
},
|
||||
|
@@ -110,11 +110,11 @@ class PickPersonType extends AbstractType
|
||||
// add the default options
|
||||
$resolver->setDefaults([
|
||||
'class' => Person::class,
|
||||
'choice_label' => function (Person $p) {
|
||||
'choice_label' => static function (Person $p) {
|
||||
return $p->getFirstname() . ' ' . $p->getLastname();
|
||||
},
|
||||
'placeholder' => 'Pick a person',
|
||||
'choice_attr' => function (Person $p) {
|
||||
'choice_attr' => static function (Person $p) {
|
||||
return [
|
||||
'data-center' => $p->getCenter()->getId(),
|
||||
];
|
||||
@@ -136,7 +136,7 @@ class PickPersonType extends AbstractType
|
||||
protected function filterCentersfom(Options $options)
|
||||
{
|
||||
if (null === $options['role']) {
|
||||
$centers = array_map(function (GroupCenter $g) {
|
||||
$centers = array_map(static function (GroupCenter $g) {
|
||||
return $g->getCenter();
|
||||
}, $this->user->getGroupCenters()->toArray());
|
||||
} else {
|
||||
@@ -160,7 +160,7 @@ class PickPersonType 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');
|
||||
|
Reference in New Issue
Block a user