Symfony 4.2 中没有根节点的树生成器

A tree builder without a root node in Symfony 4.2

我将我的 Symfony 项目从 4.1 升级到 4.2,并在分析器中收到此通知 12 次:

A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.

日志的轨迹是:

{▼
  /home/user/foo/bar/project/vendor/symfony/config/Definition/Builder/TreeBuilder.php:30 {▼
    › if (null === $name) {
    ›     @trigger_error('A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.', E_USER_DEPRECATED);
    › } else {
  }
  /home/user/foo/bar/project/vendor/sensio/framework-extra-bundle/DependencyInjection/Configuration.php:32 {▼
    › {
    ›     $treeBuilder = new TreeBuilder();
    ›     $rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
  }
}

如何解决这个问题?

此问题已在 sensio/framework-extra-bundle 中修复: https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues/593

您需要等待下一次更新(更高版本 5.2.2)。