Skip to content

Missing method in stub Symfony Form FormFactoryInterface #445

@Kazadri

Description

@Kazadri

Hi ! I noticed that the interface FormFactoryInterface define 6 methods, but the current stub only includes two of them.
For example, in this snippet:

class MyService
{
	public function __construct(private FormFactoryInterface $formFactory) {}

	/**
	 * @return FormInterface<Foo>
     */
	public function getForm(): FormInterface
	{
		$builder = $this->formFactoryInterface->createBuilder(FormType::class, new Foo());

		// add field(s)
		
		return $builder->getForm();
	}
}

PHPStan reports the following error:

Method MyService::getForm() should return Symfony\Component\Form\FormInterface<Foo> but return Symfony\Component\Form\FormInterface<mixed>.

I'd be happy to help contribute a PR to complete the stub if that's welcome! :)

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