rectorphp / rector-symfony

Rector upgrade rules for Symfony
https://getrector.com/find-rule?activeRectorSetGroup=symfony
MIT License
185 stars 89 forks source link

[SYMFONY62] Simpler Form Rendering #278

Closed ghost closed 1 year ago

ghost commented 1 year ago

In Symfony 6.2 a simpler way is introduced to render forms: https://symfony.com/blog/new-in-symfony-6-2-dx-improvements#simpler-form-rendering

I suggest we create a rule that removes the function call ->createView() what do you think?

stefantalen commented 1 year ago

Good suggestion 👍 , Symfony docs don't mention the ->createView() anymore either.

I would also include a rule to replace the deprecated AbstractController->renderForm() with AbstractController->render()?

TomasVotruba commented 1 year ago

Thanks for suggestion, they both sounds good 👍 Go for it :)

ghost commented 1 year ago

Fixed with https://github.com/rectorphp/rector-symfony/pull/279

stollr commented 1 year ago

I'll exclude this rule, because it hides the fact, that the template will handle a FormView and not a Form. This might be surprising for newcomers and I like to be explicit about my code ;-)

stefantalen commented 1 year ago

The Symfony documentation suggest implementing it this way. I see no reason for excluding, other than personal preference 🙂

Newcomers should read the documentation to avoid surprises 😬