1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | /* |
||||
6 | * (c) Christian Gripp <[email protected]> |
||||
7 | * |
||||
8 | * For the full copyright and license information, please view the LICENSE |
||||
9 | * file that was distributed with this source code. |
||||
10 | */ |
||||
11 | |||||
12 | namespace Core23\Form\Type; |
||||
13 | |||||
14 | use Symfony\Component\Form\AbstractType; |
||||
15 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
||||
16 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
17 | |||||
18 | final class DACHCountryType extends AbstractType |
||||
19 | { |
||||
20 | public function configureOptions(OptionsResolver $resolver): void |
||||
21 | { |
||||
22 | $countries = $this->getCountries(); |
||||
23 | |||||
24 | $resolver->setDefaults([ |
||||
25 | 'choices' => array_combine($countries, $countries), |
||||
26 | 'choice_label' => static function ($value, $key, $index) { |
||||
0 ignored issues
–
show
The parameter
$index is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
|
|||||
27 | return 'form.choice_'.strtolower($value); |
||||
28 | }, |
||||
29 | 'choice_translation_domain' => 'Core23FormBundle', |
||||
30 | ]); |
||||
31 | } |
||||
32 | |||||
33 | public function getParent() |
||||
34 | { |
||||
35 | return ChoiceType::class; |
||||
36 | } |
||||
37 | |||||
38 | public function getBlockPrefix() |
||||
39 | { |
||||
40 | return 'core23_country'; |
||||
41 | } |
||||
42 | |||||
43 | /** |
||||
44 | * @return string[] |
||||
45 | */ |
||||
46 | protected function getCountries(): array |
||||
47 | { |
||||
48 | return ['DE', 'AT', 'CH']; |
||||
49 | } |
||||
50 | } |
||||
51 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.