如何修复:不推荐使用"Sensio\Bundle\FrameworkExtraBundle\Configuration\Route"

KaL*_*aKi 7 php symfony

Symfony版本:4.1

当我使用PHPUnit运行测试时,我有以下弃用消息:

从版本5.2开始,不推荐使用注释"Sensio\Bundle\FrameworkExtraBundle\Configuration\Route".请改用"Symfony\Component\Routing\Annotation\Route".

我想澄清我放入我的framework.yaml:

sensio_framework_extra:
     router:
         annotations: false
Run Code Online (Sandbox Code Playgroud)

我还想澄清use Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route我的控制器中没有.

我使用FOSRestBundle,我得到的印象是问题来自那里,但我试图修复FOSREST文档中提供的配置.

你有这种类型的错误和/或你知道我应该在哪里看吗?

JuZ*_*Zer 8

实际上这不是错误,而是弃用通知.在composer.json中检查"sensio/framework-extra-bundle",它可能就在那里.

但是要删除弃用消息,请将以下行添加到config.yml文件中

sensio_framework_extra:
 router:
     annotations: false
Run Code Online (Sandbox Code Playgroud)

见附图.

在此输入图像描述


小智 8

Sensio\Bundle\FrameworkExtraBundle\Configuration\Route已弃用。

使用Symfony\Component\Routing\Annotation\Route