-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Deprecate configuring tag names and service ids in compiler passes #40468
Conversation
5e88f8e
to
71e66b1
Compare
src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php
Show resolved
Hide resolved
71e66b1
to
6fe82d8
Compare
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] fix test case name | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Should make #40468 green. Commits ------- e2dffea [Translation] fix test case name
…or (andrew-demb) This PR was merged into the 5.3-dev branch. Discussion ---------- Use symfony/deprecation-contracts instead of trigger_error | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | - <!-- required for new features --> As `symfony/deprecation-contracts` added to requirements with PR #40468, we can update `trigger_error` call in favor reusing deprecation abstractions Commits ------- 1acc296 Use symfony/deprecation-contracts instead of trigger_error
When resolving this deprecation, would you rather…
|
… inline all configurable strings |
…erListenersPass (derrabus) This PR was merged into the 5.4 branch. Discussion ---------- [EventDispatcher] Deprecate configuring tags on RegisterListenersPass | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | N/A | License | MIT | Doc PR | N/A Follow-up to #40468. Commits ------- 2c4effe Deprecate configuring tags on RegisterListenersPass
Description ----------- The `FragmentRendererPass` arguments have become deprecated in symfony/symfony#40468. Luckily, we don't actually need to use the compiler pass to get a list of services 😅 Commits ------- e10c533 Replace FragmentRendererPass with tagged locator ff626d6 CS d270e6e CS
Description ----------- The `FragmentRendererPass` arguments have become deprecated in symfony/symfony#40468. Luckily, we don't actually need to use the compiler pass to get a list of services 😅 Commits ------- e10c5339 Replace FragmentRendererPass with tagged locator ff626d63 CS d270e6e7 CS
Looks like we are using it for custom event listener tags in grumphp configuration @nicolas-grekas 👯 |
@@ -26,6 +26,10 @@ class AddEventAliasesPass implements CompilerPassInterface | |||
|
|||
public function __construct(array $eventAliases, string $eventAliasesParameter = 'event_dispatcher.event_aliases') | |||
{ | |||
if (1 < \func_num_args()) { | |||
trigger_deprecation('symfony/event-dispatcher', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like it still can be configured with $eventAliases
, what do you think about mentioning $eventAliasesParameter
in the deprecation message?
For the record:
I think the tag name 'kernel.event_dispatcher' is not meant to imply that all the events are "kernel events", so this justification seems questionable in hindsight.
I think these customization options are typically not needed for projects that are built with symfony directly, but they can be useful for other frameworks or systems that use symfony classes and components selectively, instead of using symfony as a complete system. A good reason for custom tag names and service ids could be to avoid conflicts with other tag names and service ids from non-symfony components, or to have multiple instances of e.g. the event dispatcher - for whichever reason.
Or add another pass to rename the tag on each service that uses it - if we don't care if the old tag is restored afterwards. Still this is less clean than the parameter - but ok. To be clear: I am not necessarily requesting to revert this, I just want to give feedback on the "nobody uses this". |
This PR is aimed at reducing the code complexity by hardcoding the name of tags and service ids that compiler passes have to deal with.
I think making these names configurable only adds boilerplate and maintenance overhead for no benefit:
Side note: I skipped updating changelog+upgrade files. This would be just noise to me (nobody uses this possibility anyway ;) )