Skip to content

Commit

Permalink
Merge pull request #478 from karser/fix-root-node-deprecation
Browse files Browse the repository at this point in the history
Fix root node deprecation in symfony/config > 4.1
  • Loading branch information
alexislefebvre authored Dec 20, 2018
2 parents 746f802 + 31829a2 commit 35cf946
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 35cf946

Please sign in to comment.