Skip to content

Commit

Permalink
Use TreeBuilder::getRootNode() instead of TreeBuilder::root() when po…
Browse files Browse the repository at this point in the history
…ssible
  • Loading branch information
Oliboy50 committed Feb 18, 2019
1 parent e6d7cf4 commit 89dfcfd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder($this->alias);

$rootNode = $treeBuilder->root($this->alias);
if (method_exists($treeBuilder, 'getRootNode')) {
// Symfony 4.2 +
$rootNode = $treeBuilder->getRootNode();
} else {
// Symfony 4.1 and below
$rootNode = $treeBuilder->root($this->alias);
}

$rootNode
->addDefaultsIfNotSet()
->children()
Expand Down

0 comments on commit 89dfcfd

Please sign in to comment.