Skip to content

[DependencyInjection] Add argument $target to ContainerBuilder::registerAliasForArgument() #60910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

This makes the API simpler and fixes debug:autowiring, which now displays e.g.:

 Symfony\Component\Workflow\WorkflowInterface $commentStateMachine - target:comment - alias:state_machine.comment

if ($container->hasAlias($internalAliasId)) {
$container->getAlias($internalAliasId)->setDeprecated('symfony/framework-bundle', '7.3', \sprintf('The "%%alias_id%%" autowiring alias is deprecated and will be removed in 8.0, use "%s $%s" instead.', RateLimiterFactoryInterface::class, (new Target($name.'.limiter'))->getParsedName()));
}
$factoryAlias->setDeprecated('symfony/framework-bundle', '7.3', 'The "%alias_id%" autowiring alias is deprecated and will be removed in 8.0, use "RateLimiterFactoryInterface" instead.');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use a short RateLimiterFactoryInterface, that's the only thing that one needs to change when upgrading.

@nicolas-grekas
Copy link
Member Author

Status: needs work

This creates a convention that AutowirePass cannot handle at the moment.

@nicolas-grekas nicolas-grekas merged commit a7bd15e into symfony:7.4 Jun 27, 2025
9 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the di-target branch June 30, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants