Symfony: Deprecated @Route and @Method Annotations

Doing a composer update on my pet project got me a bunch of deprecation notices:

The “Sensio\Bundle\FrameworkExtraBundle\Configuration\Route” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route” instead.

OK, that sounds familiar..
 I’ve always had a dilemma when auto-importing @Route in PHPStorm,which of the two should I choose.
 Guess I went with the wrong one :(
 Correcting was easy, yet boring:

The other depreecation looked similar:

The “Sensio\Bundle\FrameworkExtraBundle\Configuration\Method” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route” instead.

OK, what? @Method is deprecated, use @Route ? Go home, Symfony, you are drunk :D
 Well.. turns out the message is sane. The new way of specifying the HTTP method is in the @Route annotation, under methods key.
 So, I've corrected:

To this:

After updating all the annotations, I was left was a cryptic deprecation notice:

Enabling the “sensio_framework_extra.router.annotations” configuration is deprecated since version 5.2. Set it to false and use the “Symfony\Component\Routing\Annotation\Route” annotation from Symfony itself.

I say “cryptic” because I did not enable that configuration myself. It was enabled by default. And there’s a pull request to make it disabled by default.
 Until that pull request gets merged, the fix that worked for me was to create a config/packages/framework_extra.yaml and disable those annotations explicitly:

EDIT: If you’re using Symfony 3.4, you can put these settings in app/config/config.yml instead. Thanks Strabek!

EDIT 2: the pull request did get merged as a Flex recipe, so installing sensio/framework-bundle from a Symfony app with Flex, this config should be autogenerated :)

Yay! No more deprecation notices :)

Originally published at Nebojš