Avoid deprecation warning when using symfony/config >= 4.2

This commit is contained in:
Anto 2018-12-10 20:33:28 +01:00 committed by Anto
commit c2b7faa646
No known key found for this signature in database
GPG key ID: D33172CA4E946C66

View file

@ -14,9 +14,11 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder = new TreeBuilder('knp_markdown');
// BC layer for symfony/config < 4.2
$rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('knp_markdown');
$treeBuilder->root('knp_markdown', 'array')
$rootNode
->addDefaultsIfNotSet()
->children()
->arrayNode('parser')