-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call #43765
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
👍 Thanks. Can you check if other commands have the same problem btw? |
@chalasr I've found 4 |
Maybe we can add an |
It works, expect for the |
if it is in the constructor, it means that it is a deprecation targetting the code running the constructor (i.e. the code registering the command). Deprecation messages needing to use stderr are only deprecation messages where fixing them involves changing the CLI command you run |
55880fa
to
11e1c06
Compare
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php
Outdated
Show resolved
Hide resolved
Ok, so as discussed in #43765 (comment), we don't need to change the way to deprecated methods here. Let's close this, ok for you @chalasr ? |
@@ -183,7 +185,7 @@ protected function printPendingMessagesMessage(ReceiverInterface $receiver, Symf | |||
protected function getReceiver(/* string $name = null */): ReceiverInterface | |||
{ | |||
if (1 > \func_num_args() && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) { | |||
trigger_error_deprecation('symfony/messenger', '5.3', 'The "%s()" method will have a new "string $name" argument in version 6.0, not defining it is deprecated.', __METHOD__); | |||
$this->getOutput()->warning(sprintf('The "%s()" method will have a new "string $name" argument in version 6.0, not defining it is deprecated since version 5.3.', __METHOD__)); |
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.
trigger_error_deprecation
must be trigger_deprecation
right?
11e1c06
to
8b534e8
Compare
…gger_deprecation call
8b534e8
to
663eb29
Compare
Thank you @welcoMattic. |
As discussed in #43758 (comment), I change the way to deprecate options by using warning on stderr instead of
trigger_deprecation
call.