【ECCUBE】User Deprecatedエラーに対応

まぐろ

ある日、ECCUBE4のサイトにて下記エラーが発生...

User Deprecated: The "Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" annotation is deprecated since version 5.2. Use "Symfony\Component\Routing\Annotation\Route" instead.

これの解消法をメモしておく

Routeの呼び出し元を修正する

発生元を辿ってみると、下記ファイルのよう

/vendor/sensio/framework-extra-bundle/Configuration/Route.php:16行目

@trigger_error(sprintf('The "%s" annotation is deprecated since version 5.2. Use "%s" instead.', Route::class, BaseRoute::class), E_USER_DEPRECATED);

エラーの内容は、
Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
ではなく
Symfony\Component\Routing\Annotation\Route
を使ってね。というもの

Controllerディレクトリ内を下記一括置き換えで解消された

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

use Symfony\Component\Routing\Annotation\Route;

\ 案件のご依頼・ご相談はこちらから /