Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| UserType | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| buildForm | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| configureOptions | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Form; |
| 6 | |
| 7 | use App\Entity\User; |
| 8 | use Override; |
| 9 | use Symfony\Component\Form\AbstractType; |
| 10 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
| 11 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
| 12 | use Symfony\Component\Form\FormBuilderInterface; |
| 13 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 14 | |
| 15 | class UserType extends AbstractType |
| 16 | { |
| 17 | #[Override] |
| 18 | public function buildForm( |
| 19 | FormBuilderInterface $builder, |
| 20 | array $options |
| 21 | ): void |
| 22 | { |
| 23 | $builder |
| 24 | ->add('name', TextType::class) |
| 25 | ->add('email', EmailType::class); |
| 26 | } |
| 27 | |
| 28 | #[Override] |
| 29 | public function configureOptions(OptionsResolver $resolver): void |
| 30 | { |
| 31 | $resolver->setDefaults( |
| 32 | [ |
| 33 | 'data_class' => User::class, |
| 34 | ] |
| 35 | ); |
| 36 | } |
| 37 | } |