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

@@ -74,7 +74,7 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface
private function getCenters(): Iterator
{
$references = array_map(
function ($a) { return $a['ref']; },
static function ($a) { return $a['ref']; },
LoadCenters::$centers
);
$number = random_int(1, count($references));

View File

@@ -351,7 +351,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
*/
public function getActiveChildren(): Collection
{
return $this->children->filter(fn (ThirdParty $tp) => $tp->getActive());
return $this->children->filter(static fn (ThirdParty $tp) => $tp->getActive());
}
public function getAddress(): ?Address
@@ -806,7 +806,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
public function setTypesAndCategories(array $typesAndCategories): self
{
$types = array_filter($typesAndCategories, fn ($item) => !$item instanceof ThirdPartyCategory);
$types = array_filter($typesAndCategories, static fn ($item) => !$item instanceof ThirdPartyCategory);
$this->setTypes($types);
// handle categories
@@ -814,8 +814,8 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
$this->addTypesAndCategories($t);
}
$categories = array_filter($typesAndCategories, fn ($item) => $item instanceof ThirdPartyCategory);
$categoriesHashes = array_map(fn (ThirdPartyCategory $c) => spl_object_hash($c), $categories);
$categories = array_filter($typesAndCategories, static fn ($item) => $item instanceof ThirdPartyCategory);
$categoriesHashes = array_map(static fn (ThirdPartyCategory $c) => spl_object_hash($c), $categories);
foreach ($categories as $c) {
$this->addCategory($c);

View File

@@ -104,7 +104,7 @@ class ThirdPartyType 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');
},
@@ -117,7 +117,7 @@ class ThirdPartyType extends AbstractType
'choice_label' => function (ThirdPartyProfession $profession): string {
return $this->translatableStringHelper->localize($profession->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
'query_builder' => static function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('p')
->where('p.active = true');
},

View File

@@ -96,7 +96,7 @@ class PickThirdPartyType extends AbstractType
$resolver
->setDefault('class', ThirdParty::class)
->setDefault('choice_label', function (ThirdParty $tp) {
->setDefault('choice_label', static function (ThirdParty $tp) {
return $tp->getName();
})
->setDefault('choice_loader', function (Options $options) {