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

时间:2015-06-03 15:04:16

标签: php symfony

我看到一条错误消息:

  

PHP已弃用:The   Symfony的\分量\ DependencyInjection \定义:: getFactoryClass   method从版本2.6开始不推荐使用,将在3.0中删除。

运行时

composer update
composer run-script post-update-cmd

在我的symfony 2.7项目中。

我检查了一下 应用程序/ 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 个答案:

答案 0 :(得分:3)

在App.php的开头

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

答案 1 :(得分:0)

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

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