Skip to content

Commit ea93be8

Browse files
feature #60874 [FrameworkBundle] Allow using their name without added suffix when using #[Target] for custom services (Valmonzo)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [FrameworkBundle] Allow using their name without added suffix when using #[Target] for custom services | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #60349 | License | MIT Commits ------- 8df669125bf [FrameworkBundle] Allow using their name without added suffix when using #[Target] for custom services
2 parents 72ae2d5 + db1ad02 commit ea93be8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

DependencyInjection/Security/Factory/LoginThrottlingFactory.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\HttpFoundation\RateLimiter\RequestRateLimiterInterface;
2222
use Symfony\Component\Lock\LockInterface;
2323
use Symfony\Component\RateLimiter\RateLimiterFactory;
24+
use Symfony\Component\RateLimiter\RateLimiterFactoryInterface;
2425
use Symfony\Component\RateLimiter\Storage\CacheStorage;
2526
use Symfony\Component\Security\Http\RateLimiter\DefaultLoginRateLimiter;
2627

@@ -115,6 +116,12 @@ private function registerRateLimiter(ContainerBuilder $container, string $name,
115116
$limiterConfig['id'] = $name;
116117
$limiter->replaceArgument(0, $limiterConfig);
117118

118-
$container->registerAliasForArgument($limiterId, RateLimiterFactory::class, $name.'.limiter');
119+
$factoryAlias = $container->registerAliasForArgument($limiterId, RateLimiterFactory::class, $name.'.limiter');
120+
121+
if (interface_exists(RateLimiterFactoryInterface::class)) {
122+
$container->registerAliasForArgument($limiterId, RateLimiterFactoryInterface::class, $name.'.limiter');
123+
$container->registerAliasForArgument($limiterId, RateLimiterFactoryInterface::class, $name);
124+
$factoryAlias->setDeprecated('symfony/security-bundle', '7.4', 'The "%alias_id%" autowiring alias is deprecated and will be removed in 8.0, use "RateLimiterFactoryInterface" instead.');
125+
}
119126
}
120127
}

0 commit comments

Comments
 (0)