Skip to content

Commit 95f50d1

Browse files
committed
feature #58939 [RateLimiter] Add RateLimiterFactoryInterface (alexandre-daubois)
This PR was merged into the 7.3 branch. Discussion ---------- [RateLimiter] Add `RateLimiterFactoryInterface` | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #58920 | License | MIT I think it makes sense to create this interface for both being able to implement your own factory logic as well as type-hint against an interface when injecting it. I would however not make the class non-final as suggested in the issue. The interface only contains one method with not that much logic inside the current implementation. Commits ------- 619c0eb1800 [RateLimiter] Add `RateLimiterFactoryInterface`
2 parents dd01d1c + 80ee756 commit 95f50d1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Add JsonEncoder services and configuration
1010
* Add new `framework.property_info.with_constructor_extractor` option to allow enabling or disabling the constructor extractor integration
1111
* Deprecate the `--show-arguments` option of the `container:debug` command, as arguments are now always shown
12+
* Add `RateLimiterFactoryInterface` as an alias of the `limiter` service
1213

1314
7.2
1415
---

Resources/config/rate_limiter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
use Symfony\Component\RateLimiter\RateLimiterFactory;
15+
use Symfony\Component\RateLimiter\RateLimiterFactoryInterface;
1516

1617
return static function (ContainerConfigurator $container) {
1718
$container->services()
@@ -27,4 +28,9 @@
2728
null,
2829
])
2930
;
31+
32+
if (interface_exists(RateLimiterFactoryInterface::class)) {
33+
$container->services()
34+
->alias(RateLimiterFactoryInterface::class, 'limiter');
35+
}
3036
};

0 commit comments

Comments
 (0)