Skip to content

[DependencyInjection] Rename #[InnerService] to #[MapDecorated] #46112

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
Apr 22, 2022

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Apr 19, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? no but tweaks one #45834
Deprecations? no
Tickets -
License MIT
Doc PR -

When talking about the decorator pattern outside of Symfony, the term inner is pretty much (if not totally) inexistent. Worse, it makes the concept harder to explain. Take "there is a decorator and a decorated object" vs "there is a decorator and an inner object": using the later form, one has to explain both what is the decorator and what is the inner. While using the former, explaining what the decorator makes it obvious what the decorated is.

I propose to take the addition of this attribute as an opportunity to start making this special term go away.

Also I removed the Service suffix. It is tempting to keep it for explicitness, but it feels kinda redundant and AFAIK no other core attribute has such redundant suffix, maybe because their namespace is enough to indicate their target.

@chalasr chalasr requested a review from dunglas as a code owner April 19, 2022 15:02
@carsonbot carsonbot added this to the 6.1 milestone Apr 19, 2022
@chalasr chalasr changed the title [DependencyInjection] Rename #[InnerService] to `#[Decorated] [DependencyInjection] Rename #[InnerService] to #[Decorated] Apr 19, 2022
@chalasr chalasr changed the title [DependencyInjection] Rename #[InnerService] to #[Decorated] [DependencyInjection] Rename #[InnerService] to #[MapDecorated] Apr 19, 2022
@chalasr chalasr force-pushed the rename-inner branch 8 times, most recently from 512812a to 1c7a20a Compare April 19, 2022 17:12
@fabpot
Copy link
Member

fabpot commented Apr 22, 2022

Thank you @chalasr.

@mbrodala
Copy link
Contributor

Just for understanding: why MapDecorated and not just Decorated? What does the map stand for here?

@fabpot fabpot mentioned this pull request Apr 27, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented May 2, 2022

"map" stands for "inject" or "wire", or "autowire" to be more precise - but using a more compact word.
It builds on this Map* convention that we started with https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/HttpKernel/Attribute/MapDateTime.php

@mbrodala
Copy link
Contributor

mbrodala commented May 2, 2022

Ah OK, I was confused by the "other" kind of map (key=>value storage). Thanks for the insights.

@nicolas-grekas
Copy link
Member

this works :)
key = the argument
value = the decorated service

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.

5 participants