Skip to content

Commit

Permalink
Merge pull request #5 from birkof/fix-deprecated-treebuilder
Browse files Browse the repository at this point in the history
Fix deprecated TreeBuilder::root()" method
  • Loading branch information
birkof authored Oct 19, 2019
2 parents 5884af0 + 710d389 commit e98180f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ class Configuration implements ConfigurationInterface
/**
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root(NetopiaMobilPayBundle::ALIAS);
if (Kernel::VERSION_ID >= 40200) {
$builder = new TreeBuilder(NetopiaMobilPayBundle::ALIAS);
} else {
$builder = new TreeBuilder();
}
$rootNode = \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root(NetopiaMobilPayBundle::ALIAS);

$rootNode
->children()
Expand All @@ -35,6 +39,6 @@ public function getConfigTreeBuilder()
->scalarNode('private_key')->defaultNull()->end()
->scalarNode('signature')->cannotBeEmpty()->defaultValue('XXXX-XXXX-XXXX-XXXX-XXXX')->end();

return $treeBuilder;
return $builder;
}
}

0 comments on commit e98180f

Please sign in to comment.