umpirsky / Symfony-Upgrade-Fixer

Analyzes your Symfony project and tries to make it compatible with the new version of Symfony framework.
MIT License
275 stars 18 forks source link

Add fixer for form type getName method. #15

Closed kristijanhusak closed 8 years ago

kristijanhusak commented 8 years ago

From https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md

As a further consequence, the method FormTypeInterface::getName() was deprecated and will be removed in Symfony 3.0. You should remove this method from your form types.

If you want to customize the block prefix of a type in Twig, you should now implement FormTypeInterface::getBlockPrefix() instead:

Before:

   class UserProfileType extends AbstractType
   {
       public function getName()
       {
           return 'profile';
       }
   }

After:

   class UserProfileType extends AbstractType
   {
       public function getBlockPrefix()
       {
           return 'profile';
       }
   }
umpirsky commented 8 years ago

Thanks @kristijanhusak! :+1: I was planning to do this one for a while, lack of time as always. :)

I will review your PR later today.

kristijanhusak commented 8 years ago

No problem :wink:

I really missed this one today when i was updating a project.

This is really helpful package, it saved me a lot of time and search/replace actions, keep up the good work!

umpirsky commented 8 years ago

@kristijanhusak It also says "If you define your form types in the Dependency Injection configuration, you should further remove the "alias" attribute.". Does it works if you leave it?

kristijanhusak commented 8 years ago

It works, it just ignores the alias.

umpirsky commented 8 years ago

@kristijanhusak Cool. Then we can merge this after you fix my last remark and release new version. :+1:

umpirsky commented 8 years ago

Perfect, thanks @kristijanhusak! :+1: