How to fix Symfony 3.4 @Route and @Method deprecation

Strabek picture Strabek · Jul 4, 2018 · Viewed 8.5k times · Source

I have a Symfony 3.4 project and I have found below messages in profiler:

  1. “Sensio\Bundle\FrameworkExtraBundle\Configuration\Route” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route”
  2. “Sensio\Bundle\FrameworkExtraBundle\Configuration\Method” annotation is deprecated since version 5.2. Use “Symfony\Component\Routing\Annotation\Route”
  3. “sensio_framework_extra.router.annotations” configuration is deprecated since version 5.2. Set it to false and use the “Symfony\Component\Routing\Annotation\Route”

I have spent some time on looking for a solution, but found nothing really helpful. Some findings here or here.

Answer

Strabek picture Strabek · Jul 4, 2018

Here is a solution I have found. This post helped me a lot with a tweak in no. 3 In no. 3 instead of adding config/packages/framework_extra.yaml, I have added that setting to my config.yml.