Skip to content

Commit 29b83ef

Browse files
Olivier DolbeauNyholm
authored andcommitted
Avoid deprecated notice when using symfony/config > 4.2 (#273)
1 parent fe29aef commit 29b83ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

DependencyInjection/Configuration.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ public function __construct(ContainerBuilder $container)
3333
*/
3434
public function getConfigTreeBuilder()
3535
{
36-
$treeBuilder = new TreeBuilder();
37-
$root = $treeBuilder->root('translation');
36+
$treeBuilder = new TreeBuilder('translation');
37+
// Keep compatibility with symfony/config < 4.2
38+
if (!method_exists($treeBuilder, 'getRootNode')) {
39+
$root = $treeBuilder->root('translation');
40+
} else {
41+
$root = $treeBuilder->getRootNode();
42+
}
3843

3944
$this->configsNode($root);
4045
$this->addAutoTranslateNode($root);

0 commit comments

Comments
 (0)