-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Dont trigger deprecation for event_dispatcher service #22223
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
Conversation
7e21534
to
61f3922
Compare
|
||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); | ||
// don't trigger deprecations for internal uses, to be removed in 4.0 along with the 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.
personally, I try to always add the @deprecated
string to ease doing grep. I don't expect anyone to read all the source code looking for specific notices about 4.0 (or we'd expect to miss some for sure)
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.
👍 with minor comment
61f3922
to
a49fe25
Compare
@deprec annotation added |
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.
👍
Thank you @chalasr. |
… (chalasr) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Dont trigger deprecation for event_dispatcher service | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22208 | License | MIT | Doc PR | n/a Mute deprecations for the event_dispatcher service keeping only relevant ones i.e when the api of the deprecated class is used intentionally, ugly but prevent breaking test suites like the [LexikJWTAuthenticationBundle one](https://travis-ci.org/lexik/LexikJWTAuthenticationBundle/jobs/216664013#L278). Commits ------- a49fe25 [DI] Dont trigger deprecation for event_dispatcher service
This is not working for me. I'm on 3.3.0 and I still get deprecations, both in tests and in profiler: "The Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure-proxy injection instead: 160x" |
@garak the deprecation you are getting is not the one fixed here. |
You can reproduce by installing KnpPaginatorBundle, so protected function getDebug_EventDispatcherService()
{
$this->services['debug.event_dispatcher'] = $instance = new \Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher(new \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher($this), ${($_ = isset($this->services['debug.stopwatch']) ? $this->services['debug.stopwatch'] : $this->get('debug.stopwatch')) && false ?: '_'}, ${($_ = isset($this->services['monolog.logger.event']) ? $this->services['monolog.logger.event'] : $this->get('monolog.logger.event', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
// ...
} |
I was not able to reproduce this by just adding the KnpPaginatorBundle to a blank Symfony 3.3 Standard Edition. Please open a new issue with steps to perform to be able to reproduce your issue if this persists for you. |
Mute deprecations for the event_dispatcher service keeping only relevant ones i.e when the api of the deprecated class is used intentionally, ugly but prevent breaking test suites like the LexikJWTAuthenticationBundle one.