Skip to content

Commit

Permalink
Avoid deprecation warning when using symfony/config > 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot committed Dec 7, 2018
1 parent 7f1bbce commit 3c5c6a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions DependencyInjection/Configuration.php
Expand Up @@ -24,9 +24,14 @@ public function getConfigTreeBuilder()
return $fixedOptions;
};

$treeBuilder = new TreeBuilder();
$treeBuilder = new TreeBuilder('knp_snappy');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC for symfony/config < 4.2
$rootNode = $treeBuilder->root('knp_snappy');
}

$rootNode = $treeBuilder->root('knp_snappy');
$rootNode
->children()
->scalarNode('temporary_folder')->end()
Expand Down

0 comments on commit 3c5c6a1

Please sign in to comment.