Repository: symfony/symfony
File: src/Symfony/Bridge/Twig/Tests/Form/TwigRendererEngineTest.php (PHP)

Code before:

        $view = $form->createView();
        $renderer->setTheme($view, 'form_layout.html.twig');

        $this->assertSame('[embedded-row]', $renderer->searchAndRenderBlock($view['taskLists'][0], 'row'));
        $this->assertSame('[form-row]', $renderer->searchAndRenderBlock($view['taskLists'][0]['tasks'][0], 'row'));
    }

    private function createRenderer(): FormRenderer
    {
        $twig = new Environment(new ArrayLoader([
            'form_layout.html.twig' => <<<'TWIG'
                {% block form_row %}[form-row]{% endblock %}
                {% block embedded_row %}[embedded-row]{% endblock %}
                TWIG
        ]));

        $engine = new TwigRendererEngine(['form_layout.html.twig'], $twig);

        return new FormRenderer($engine);
    }
}

class TaskManagerType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('taskLists', CollectionType::class, [
            'entry_type' => TaskListType::class,
            'allow_add' => true,
        ]);
    }
}

class TaskListType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('tasks', CollectionType::class, [
            'entry_type' => TaskType::class,
            'allow_add' => true,
        ]);
    }

    public function getParent(): ?string
    {
        return EmbeddedType::class;
    }
}

class TaskType extends AbstractType

Review comment (suggestion):
```suggestion
    public function buildForm(FormBuilderInterface $builder, array $options): void
```

to satisfy the job running with patched return types (and there’s other places needing the same)

Code after:

        $view = $form->createView();
        $renderer->setTheme($view, 'form_layout.html.twig');

        $this->assertSame('[embedded-row]', $renderer->searchAndRenderBlock($view['taskLists'][0], 'row'));
        $this->assertSame('[form-row]', $renderer->searchAndRenderBlock($view['taskLists'][0]['tasks'][0], 'row'));
    }

    private function createRenderer(): FormRenderer
    {
        $twig = new Environment(new ArrayLoader([
            'form_layout.html.twig' => <<<'TWIG'
                {% block form_row %}[form-row]{% endblock %}
                {% block embedded_row %}[embedded-row]{% endblock %}
                TWIG,
        ]));

        $engine = new TwigRendererEngine(['form_layout.html.twig'], $twig);

        return new FormRenderer($engine);
    }
}

class TaskManagerType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('taskLists', CollectionType::class, [
            'entry_type' => TaskListType::class,
            'allow_add' => true,
        ]);
    }
}

class TaskListType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('tasks', CollectionType::class, [
            'entry_type' => TaskType::class,
            'allow_add' => true,
        ]);
    }

    public function getParent(): ?string
    {
        return EmbeddedType::class;
    }
}

class TaskType extends AbstractType