Skip to content

Commit

Permalink
Merge pull request #42 from eschmar/develop
Browse files Browse the repository at this point in the history
Not passing the root node name to TreeBuilder was deprecated
  • Loading branch information
eschmar authored Oct 27, 2019
2 parents 454b47b + af30a6e commit b7cce02
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@
*/
class Configuration implements ConfigurationInterface
{
const ROOT_NODE = 'eschmar_time_ago';

/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('eschmar_time_ago');
$treeBuilder = new TreeBuilder(static::ROOT_NODE);

// Symfony 4.2+
if (method_exists($treeBuilder, 'getRootNode')) $rootNode = $treeBuilder->getRootNode();
// Symfony 4.1 and below
else $rootNode = $treeBuilder->root(static::ROOT_NODE);

$rootNode
$treeBuilder->getRootNode()
->children()
->scalarNode('format')
->defaultValue('r')
Expand Down

0 comments on commit b7cce02

Please sign in to comment.