Skip to content

Commit

Permalink
fix deprecations for symfony >= 4.2
Browse files Browse the repository at this point in the history
 tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.
  • Loading branch information
addfs authored Feb 22, 2022
1 parent fcd8b08 commit 1df45e9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('intaro_twig_sandbox');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
$treeBuilder = new TreeBuilder('intaro_twig_sandbox');
if (\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('intaro_twig_sandbox');
}

return $treeBuilder;
}
Expand Down

0 comments on commit 1df45e9

Please sign in to comment.