Skip to content

Commit a706ecc

Browse files
committed
Run PHP-CS-Fixer (no_useless_else & static_lambda)
1 parent 64b85ba commit a706ecc

File tree

77 files changed

+362
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+362
-365
lines changed

apps/e2e/src/Controller/TestAutocompleteController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function movie(Request $request): JsonResponse
3939
['value' => 'movie_5', 'text' => 'Pulp Fiction (1994)', 'title' => 'movie Movie #5'],
4040
];
4141

42-
$results = array_filter($movies, function ($movie) use ($query) {
42+
$results = array_filter($movies, static function ($movie) use ($query) {
4343
return '' === $query || false !== stripos($movie['text'], $query);
4444
});
4545

@@ -61,7 +61,7 @@ public function videogame(Request $request): JsonResponse
6161
['value' => 'videogame_5', 'text' => 'Mass Effect 2 (2010)', 'title' => 'videogame Game #5'],
6262
];
6363

64-
$results = array_filter($games, function ($game) use ($query) {
64+
$results = array_filter($games, static function ($game) use ($query) {
6565
return '' === $query || false !== stripos($game['text'], $query);
6666
});
6767

apps/e2e/src/Form/Type/ProductionType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3737
'data-test-id' => 'production-type',
3838
],
3939
])
40-
->addDependent('movieSearch', ['type'], function (DependentField $field, ?string $type) {
40+
->addDependent('movieSearch', ['type'], static function (DependentField $field, ?string $type) {
4141
if ('movie' !== $type) {
4242
return;
4343
}
@@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4747
'required' => false,
4848
]);
4949
})
50-
->addDependent('videogameSearch', ['type'], function (DependentField $field, ?string $type) {
50+
->addDependent('videogameSearch', ['type'], static function (DependentField $field, ?string $type) {
5151
if ('videogame' !== $type) {
5252
return;
5353
}

apps/e2e/src/Repository/ExampleRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function findAllGroupedByPackage(?string $query = null): array
9797
if (null !== $query) {
9898
$query = strtolower($query);
9999
$examples = array_filter($examples,
100-
fn (Example $example) => false !== mb_stripos($example->uxPackage->name.' '.$example->name.' '.$example->description, $query)
100+
static fn (Example $example) => false !== mb_stripos($example->uxPackage->name.' '.$example->name.' '.$example->description, $query)
101101
);
102102
}
103103

apps/e2e/src/Twig/Extension/AppExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AppExtension extends AbstractExtension
1818
{
1919
public function getFunctions(): iterable
2020
{
21-
yield new TwigFunction('print_r', function (mixed $value): string {
21+
yield new TwigFunction('print_r', static function (mixed $value): string {
2222
return '<pre>'.print_r($value, true).'</pre>';
2323
}, ['is_safe' => ['html']]);
2424
}

src/Autocomplete/src/AutocompleteResultsExecutor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function fetchResults(EntityAutocompleterInterface $autocompleter, string
8585

8686
if ($groupBy instanceof PropertyPathInterface) {
8787
$accessor = $this->propertyAccessor;
88-
$groupBy = function ($choice) use ($accessor, $groupBy) {
88+
$groupBy = static function ($choice) use ($accessor, $groupBy) {
8989
try {
9090
return $accessor->getValue($choice, $groupBy);
9191
} catch (UnexpectedTypeException) {
@@ -114,7 +114,7 @@ public function fetchResults(EntityAutocompleterInterface $autocompleter, string
114114
$results[] = $result;
115115
}
116116

117-
$optgroups = array_map(fn (string $label) => ['value' => $label, 'label' => $label], array_unique($optgroupLabels));
117+
$optgroups = array_map(static fn (string $label) => ['value' => $label, 'label' => $label], array_unique($optgroupLabels));
118118

119119
return new AutocompleteResults($results, $hasNextPage, $optgroups);
120120
}

src/Autocomplete/src/Controller/EntityAutocompleteController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function validateChecksum(string $checksum, array $extraOptions): void
106106
{
107107
$extraOptionsWithoutChecksum = array_filter(
108108
$extraOptions,
109-
fn (string $key) => AutocompleteChoiceTypeExtension::CHECKSUM_KEY !== $key,
109+
static fn (string $key) => AutocompleteChoiceTypeExtension::CHECKSUM_KEY !== $key,
110110
\ARRAY_FILTER_USE_KEY,
111111
);
112112

src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ public function configureOptions(OptionsResolver $resolver): void
156156
]);
157157

158158
// if autocomplete_url is passed, then HTML options are already supported
159-
$resolver->setNormalizer('options_as_html', function (Options $options, $value) {
159+
$resolver->setNormalizer('options_as_html', static function (Options $options, $value) {
160160
return null === $options['autocomplete_url'] ? $value : false;
161161
});
162162

163-
$resolver->setNormalizer('preload', function (Options $options, $value) {
163+
$resolver->setNormalizer('preload', static function (Options $options, $value) {
164164
if (\is_bool($value)) {
165165
$value = $value ? 'true' : 'false';
166166
}

src/Autocomplete/src/Form/BaseEntityAutocompleteType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function configureOptions(OptionsResolver $resolver): void
7171
$resolver->setAllowedTypes('security', ['boolean', 'string', 'callable']);
7272
$resolver->setAllowedTypes('max_results', ['int', 'null']);
7373
$resolver->setAllowedTypes('filter_query', ['callable', 'null']);
74-
$resolver->setNormalizer('searchable_fields', function (Options $options, ?array $searchableFields) {
74+
$resolver->setNormalizer('searchable_fields', static function (Options $options, ?array $searchableFields) {
7575
if (null !== $searchableFields && null !== $options['filter_query']) {
7676
throw new RuntimeException('Both the searchable_fields and filter_query options cannot be set.');
7777
}

src/Autocomplete/src/Form/ParentEntityAutocompleteType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function configureOptions(OptionsResolver $resolver): void
9090
$resolver->setAllowedTypes('security', ['boolean', 'string', 'callable']);
9191
$resolver->setAllowedTypes('max_results', ['int', 'null']);
9292
$resolver->setAllowedTypes('filter_query', ['callable', 'null']);
93-
$resolver->setNormalizer('searchable_fields', function (Options $options, ?array $searchableFields) {
93+
$resolver->setNormalizer('searchable_fields', static function (Options $options, ?array $searchableFields) {
9494
if (null !== $searchableFields && null !== $options['filter_query']) {
9595
throw new RuntimeException('Both the searchable_fields and filter_query options cannot be set.');
9696
}

src/Autocomplete/src/Maker/MakeAutocompleteField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
8181

8282
$question = new Question('The class name of the entity you want to autocomplete');
8383
$question->setAutocompleterValues($entities);
84-
$question->setValidator(function ($choice) use ($entities) {
84+
$question->setValidator(static function ($choice) use ($entities) {
8585
return Validator::entityExists($choice, $entities);
8686
});
8787

0 commit comments

Comments
 (0)