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.
@Method is deprecated, use
@Route ? Go home, Symfony, you are drunk 😀
Well.. turns out the message is sane. The new way of specifying the HTTP method is in the
@Route annotation, under
So, I’ve corrected:
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:
Yay! No more deprecation notices 🙂