Skip to content

Commit a6e6448

Browse files
committed
Prevent collection type errors (#30)
1 parent 743ea5d commit a6e6448

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Form/Type/PolymorphicCollectionType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Softspring\Component\PolymorphicFormType\Form\DataTransformer\NodeDataTransformer;
66
use Softspring\Component\PolymorphicFormType\Form\Discriminator\NodeDiscriminator;
77
use Softspring\Component\PolymorphicFormType\Form\EventListener\NodesResizeFormListener;
8+
use Softspring\Component\PolymorphicFormType\Form\Type\Node\AbstractNodeType;
89
use Symfony\Component\Form\AbstractType;
910
use Symfony\Component\Form\Exception\RuntimeException;
1011
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
@@ -96,7 +97,7 @@ public function buildView(FormView $view, FormInterface $form, array $options):
9697
*/
9798
protected function getFormFactory(array $options): FormFactory
9899
{
99-
if ($options['form_factory']) {
100+
if ($options['form_factory'] ?? false) {
100101
if (!$options['form_factory'] instanceof FormFactory) {
101102
throw new RuntimeException('form_factory option must contain an instance of FormFactory');
102103
}
@@ -112,7 +113,7 @@ protected function getFormFactory(array $options): FormFactory
112113
/**
113114
* Configure event subscriber for resizing with data transformer.
114115
*/
115-
protected function configureResizeEventSubscriber(FormBuilderInterface $builder, array $options)
116+
protected function configureResizeEventSubscriber(FormBuilderInterface $builder, array $options): void
116117
{
117118
if (empty($options['discriminator_map'])) {
118119
throw new RuntimeException('discriminator_map must be set');

0 commit comments

Comments
 (0)