Skip to content

Commit

Permalink
Merge pull request #27 from AkenRoberts/fix/tree-root-node
Browse files Browse the repository at this point in the history
Fix TreeBuilder root node deprecation in Symfony 4.1+
  • Loading branch information
eymengunay authored Aug 30, 2019
2 parents e4e2ae9 + 8345c5e commit fbb3f8d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions 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 = new TreeBuilder();
$rootNode = $treeBuilder->root('eo_honeypot');
if (\method_exists(TreeBuilder::class, 'getRootNode')) {
// Symfony 4.1+
$treeBuilder = new TreeBuilder('eo_honeypot');
$rootNode = $treeBuilder->getRootNode();
} else {
// Symfony <= 4.0
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('eo_honeypot');
}

$rootNode
->children()
Expand Down

0 comments on commit fbb3f8d

Please sign in to comment.