Repository: EasyCorp/EasyAdminBundle (language: php)

Issue:
ChoiceField with zero choices results in an InvalidOptionsException
Since 4.9.2:

Exception appears when you have ChoiceField with zero choices provided:

```
Symfony\Component\OptionsResolver\Exception\InvalidOptionsException

An error has occurred resolving the options of the form "Symfony\Component\Form\Extension\Core\Type\EnumType": The option "class" with value null is expected to be of type "string", but is of type "null".
```

**To Reproduce**
symfony/forms 6.4.4 
easycorp/easyadmin-bundle 4.9.2 - 4.9.4

Create ChoiceField with no choices:
```
 ChoiceField::new('myField', '...')
                ->setChoices([]);
```

**Additional context**

Looks like a bug in ChoiceConfigurator.php. `$allChoicesAreEnums` variable (line 53) is `true` even if there are no choices (which is confusing variable naming, how can you say that all choices are enums, if there are no any choices?). Anyway, code used to work until `$field->setFormTypeOptionIfNotSet('class', $enumTypeClass);` line appeared in 4.9.2. Having `$enumTypeClass` equals to `null` it results in InvalidOptionsException described above.



Discussion / hints:

Fix patch:
diff --git a/src/Field/Configurator/ChoiceConfigurator.php b/src/Field/Configurator/ChoiceConfigurator.php
index a1b30a52a5..0183d2c894 100644
--- a/src/Field/Configurator/ChoiceConfigurator.php
+++ b/src/Field/Configurator/ChoiceConfigurator.php
@@ -65,7 +65,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
                 $areChoicesTranslatable = $choicesSupportTranslatableInterface = true;
             }
 
-            if ($allChoicesAreEnums && array_is_list($choices)) {
+            if ($allChoicesAreEnums && array_is_list($choices) && \count($choices) > 0) {
                 $processedEnumChoices = [];
                 foreach ($choices as $choice) {
                     $processedEnumChoices[$choice->name] = $choice;


Test patch: