Skip to content

Conversation

@nicolas-grekas
Copy link
Member

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

This PR improves support for resource definitions by allowing to parse attributes on abstract classes.

This can be useful for PRs like #61563 and #61545, so that the attribute proposed there could be set on abstract classes.

{
return $this->addTag($name, $attributes)
->addTag('container.excluded', ['source' => \sprintf('by tag "%s"', $name)])
->setAbstract(true);
Copy link
Member Author

Choose a reason for hiding this comment

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

When a resource tag is set using ContainerBuilder::registerAttributeForAutoconfiguration(), this "abstract" flag isn't set on corresponding services. The reason is that autoconfiguration cannot set this flag by design - it's ignored in ResolveInstanceofConditionalsPass (and used for something else - aka cannot be reclaimed).
This means resource definitions are most of the time NOT going to be defined as abstract.
Therefor, this call here is useless, and confusing.

@nicolas-grekas nicolas-grekas force-pushed the di-res-fix branch 2 times, most recently from 0b6e38a to a4c825f Compare September 2, 2025 08:03
@fabpot
Copy link
Member

fabpot commented Sep 2, 2025

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 7278aa0 into symfony:7.4 Sep 2, 2025
11 of 12 checks passed
@nicolas-grekas nicolas-grekas deleted the di-res-fix branch September 3, 2025 12:12
This was referenced Oct 27, 2025
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