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 f7c2541 commit c8cebc6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
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 c8cebc6

Please sign in to comment.