diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 0739256323e47..a134940add3b7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1846,7 +1846,7 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode) ->enumNode('strategy') ->info('The rate limiting algorithm to use for this rate') ->isRequired() - ->values(['fixed_window', 'token_bucket', 'sliding_window']) + ->values(['fixed_window', 'token_bucket', 'sliding_window', 'no_limit']) ->end() ->integerNode('limit') ->info('The maximum allowed hits in a fixed interval or burst') diff --git a/src/Symfony/Component/RateLimiter/RateLimiter.php b/src/Symfony/Component/RateLimiter/RateLimiter.php index 45edecd877942..078d70ad0891a 100644 --- a/src/Symfony/Component/RateLimiter/RateLimiter.php +++ b/src/Symfony/Component/RateLimiter/RateLimiter.php @@ -54,8 +54,11 @@ public function create(?string $key = null): LimiterInterface case 'sliding_window': return new SlidingWindowLimiter($id, $this->config['limit'], $this->config['interval'], $this->storage, $lock); + case 'no_limit': + return new NoLimiter(); + default: - throw new \LogicException(sprintf('Limiter strategy "%s" does not exists, it must be either "token_bucket", "sliding_window" or "fixed_window".', $this->config['strategy'])); + throw new \LogicException(sprintf('Limiter strategy "%s" does not exists, it must be either "token_bucket", "sliding_window", "fixed_window" or "no_limit".', $this->config['strategy'])); } }