diff --git a/composer.json b/composer.json index 851bc29..bfa6d43 100644 --- a/composer.json +++ b/composer.json @@ -3,11 +3,11 @@ "description": "Symfony bundle for lamoda/tactician-rate-limit library", "type": "symfony-bundle", "require": { - "symfony/dependency-injection": "^3.4 || ^4.0", - "symfony/http-kernel": "^3.4 || ^4.0", - "symfony/config": "^3.4 || ^4.0", + "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0", + "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0", + "symfony/config": "^3.4 || ^4.0 || ^5.0", "lamoda/tactician-rate-limit": "^0.1.0", - "symfony/yaml": "^3.4 || ^4.0" + "symfony/yaml": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "phpunit/phpunit": "^7.2", diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index e21ce76..3351d80 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -11,9 +11,12 @@ final class Configuration implements ConfigurationInterface { public function getConfigTreeBuilder(): TreeBuilder { - $builder = new TreeBuilder(); + $builder = new TreeBuilder('lamoda_tactician_rate_limit'); - $root = $builder->root('lamoda_tactician_rate_limit'); + // Keep compatibility with symfony/config < 4.2 + $root = method_exists(TreeBuilder::class, 'getRootNode') + ? $builder->getRootNode() + : $builder->root('lamoda_tactician_rate_limit'); $root ->children()