Skip to content

Commit

Permalink
Fix root node deprecation in symfony/config > 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
karser committed Dec 19, 2018
1 parent 746f802 commit 31829a2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('liip_functional_test', 'array');
if (method_exists(TreeBuilder::class, 'getRootNode')) {
$treeBuilder = new TreeBuilder('liip_functional_test');
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('liip_functional_test', 'array');
}

$rootNode
->children()
->arrayNode('cache_db')
Expand Down

0 comments on commit 31829a2

Please sign in to comment.