Deprecation Fixing Tools


The video for this tutorial will be ready very soon!

Ideally, your outside bundles are no longer triggering deprecated warnings. Now it's time to update our code for Symfony 3. This means finding deprecation warnings, fixing them everywhere you can think of, and, well, repeating! It's pretty simple, but sometimes the true source of a deprecation can be tricky to find.

Symfony Upgrade Fixer

Fortunately, there are 2 tools to help us. Google for Symfony Upgrade Fixer. This is a sweet tool made by my good friend Saša. It tries to find deprecated code and fix it for you. How nice!? It only supports a few things, but it aims to fix the most annoying ones, like form changes.

Copy the wget line and paste it into your command line. Or just use that URL to download the file manually. Copy the second permissions line to make that file executable. Cool! Now we have a symfony-upgrade-fixer utility! Run it!


And then actually use it with fix and then . to fix this directory:

symfony-upgrade-fixer fix .

Behind the scenes, that's snooping through your project and writing new code for you. Ding! It fixed two form classes:

80 lines src/AppBundle/Form/PostType.php
... lines 1 - 25
class PostType extends AbstractType
... lines 28 - 30
public function buildForm(FormBuilderInterface $builder, array $options)
... lines 33 - 42
... lines 44 - 47
->add('summary', TextareaType::class, array('label' => 'label.summary'))
->add('content', TextareaType::class, array(
... lines 50 - 51
->add('authorEmail', EmailType::class, array('label' => 'label.author_email'))
... lines 54 - 55
... lines 59 - 78

75 lines src/AppBundle/Form/Type/DateTimePickerType.php
... lines 1 - 27
class DateTimePickerType extends AbstractType
... lines 30 - 61
public function getParent()
return DateTimeType::class;
... lines 66 - 73

By using git diff, I can see that it updated to the new TextareaType::class format. If you have a lot of forms, this is awesome.

Symfony Deprecation Detector

This tool caught a few things, but there's a lot more. So... let's try another tool! Google for Symfony Deprecation Detector. This tool doesn't fix your project, but it detects more things than the first one.

Copy the clone command and run it in the terminal:

cd any/path
git clone

Move into the directory and install the composer libraries:

cd deprecation-detector
composer install

This will give us a new binary that we can use on our project. Switch back into the directory of our project, then run the bin/deprecation-detector command from that project:


Boom! This correctly sees that 3 form types still have a getName() method, which they should not have anymore. Go into AppBundle/Form, open up each form type, and remove the getName() method from the bottom.

Perfect! Try the command again:


No violations! I wish this meant that you had no more deprecated features, but it's an imperfect tool. We need to hunt for the last few deprecations.

Leave a comment!

  • 2016-12-12 Victor Bocharsky

    Hey kruben ,

    It's due to the SSH URL, have you logged in into your GitHub account? Anyway, HTTPS URL will work for you:

    git clone

    Let me know if it helps.

    P.S. You can switch between SSH and HTTPS links on a GitHub project page when clicking on "Clone or download" button.


  • 2016-12-11 kruben

    If I try cloning the deprecation-detector, I get "Permission denied (publickey). Is there another way to get this?
    Edit: Did it now with the phar.

  • 2016-02-09 weaverryan

    Cool, nice!

  • 2016-02-08 ypereirareis

    Hi !

    I created two docker images to run those tools, really usefull and easy to use on Symfony projects.


  • 2016-01-14 DevDonkey

    Just a note to anyone using the symfony upgrade fixer, it doesn't always detect and fix 'text, entity, date, choice' form-field types.

    It also has a habit of changing the use statement order of files that its not touched in any way. So if you have a touchy tech-lead and your using VCS it'll look like you've touched more files than you have.

    This is just a note to suggest that the tools isn't followed blindly.

    These issues have been noted to the author on the git repo.