Skip to content

Commit 01c7df9

Browse files
committed
minor #9765 Updated from new MyFormType() to MyFormType::class (ThomasLandauer)
This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #9765). Discussion ---------- Updated from `new MyFormType()` to `MyFormType::class` Passing a new instance of the form type gave me this error: > Type error: Argument 1 passed to Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener::__construct() must be of the type string, object given <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- b031b97 Updated from `new MyFormType()` to `MyFormType::class`
2 parents 6b5b1b2 + b031b97 commit 01c7df9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reference/forms/types/collection.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ entry_type
340340
This is the field type for each item in this collection (e.g. ``TextType``,
341341
``ChoiceType``, etc). For example, if you have an array of email addresses,
342342
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
343-
to embed a collection of some other form, create a new instance of your
344-
form type and pass it as this option.
343+
to embed a collection of some other form, pass the form type class as this
344+
option (e.g. ``MyFormType::class``)
345345

346346
prototype
347347
~~~~~~~~~

0 commit comments

Comments
 (0)