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 GenderType extends AbstractType |
||
19 | { |
||
20 | public const TYPE_MALE = 'm'; |
||
21 | |||
22 | public const TYPE_FEMALE = 'f'; |
||
23 | |||
24 | public function configureOptions(OptionsResolver $resolver): void |
||
25 | { |
||
26 | $resolver->setDefaults([ |
||
27 | 'choices' => [ |
||
28 | 'male' => static::TYPE_MALE, |
||
29 | 'female' => static::TYPE_FEMALE, |
||
30 | ], |
||
31 | 'choice_label' => static function ($value, $key, $index) { |
||
0 ignored issues
–
show
|
|||
32 | return 'gender.'.$key; |
||
33 | }, |
||
34 | 'choice_translation_domain' => 'Core23FormBundle', |
||
35 | ]); |
||
36 | } |
||
37 | |||
38 | public function getParent() |
||
39 | { |
||
40 | return ChoiceType::class; |
||
41 | } |
||
42 | |||
43 | public function getBlockPrefix() |
||
44 | { |
||
45 | return 'gender'; |
||
46 | } |
||
47 | } |
||
48 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.