Skip to content

FormBuilderInterface::getForm() should not return FormInterface<TData|null>, but FormInterface<TData>? #466

@devnix

Description

@devnix

I think https://github.com/phpstan/phpstan-symfony/blob/2.0.x/stubs/Symfony/Component/Form/FormBuilderInterface.stub#L14-L17 is wrong: when I'm carrying around a FormBuilderInterface<SomeModel>, I would expect to build a form for a function that receives FormInterface<SomeModel>.

Indeed, then FormInterface::getData() would return SomeModel|null, but that would not be a requirement for FormBuilderInterface::getForm() to return FormInterface<SomeModel|null>. But maybe I'm missing something obvious here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions