首页 文章

PHP不推荐使用:Symfony \ Component \ DependencyInjection \ Definition :: getFactoryClass symfony 2.6

提问于
浏览
1

我看到一条错误消息:

PHP已弃用:Symfony \ Component \ DependencyInjection \ Definition :: getFactoryClass方法自2.6版以来已弃用,将在3.0中删除 .

跑步的时候

composer update
composer run-script post-update-cmd

在我的symfony 2.7项目上 .

我检查了app / bootstrap.php.cache

error_reporting(error_reporting() & ~E_USER_DEPRECATED);

CLI / php.ini中

error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT

即使我在调试期间看到error_reporting()= 0,它仍然会向我显示这些消息 .

如何在Symfony 2.7中抑制不推荐使用的消息?

2 回答

  • 3

    在App.php的开头

    ini_set("error_reporting", E_ALL & ~E_USER_DEPRECATED);
    
  • 0

    通过将error_reporting级别传递给app / console中的Debug :: enable来管理以抑制不推荐使用的消息,如下所示:

    if ($debug) {
        Debug::enable(E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED);
    }
    

相关问题