-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Fixed MessengerPass::guessHandledClasses return type #27633
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
[Messenger] Fixed MessengerPass::guessHandledClasses return type #27633
Conversation
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.
Good catch! Just a few things to change in the tests :)
@@ -40,6 +40,7 @@ | ||
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver; | ||
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender; | ||
use Symfony\Component\Messenger\Transport\ReceiverInterface; | ||
use Symfony\Component\Serializer\Tests\Fixtures\Dummy; |
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.
Can you remove this use
?
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.
👍
|
||
(new MessengerPass())->process($container); | ||
|
||
$this->assertTrue(true); |
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.
Can you use a better assertion? Typically, you want to assert that the DummyMessage
and SecondMessage
messages have a registered handler. Look at the testGetClassesFromTheHandlerSubscriberInterface
test for an inspiration.
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.
Take a look to what I wrote 😄
Thank you @sroze for your review! I'll fix it as soon as possible 😄 |
Also, could you rebase your pull-request to the branch 4.1 as it is a bug? Thank you! |
Thank you @massimilianobraglia. |
…n type (massimilianobraglia) This PR was squashed before being merged into the 4.2-dev branch (closes #27633). Discussion ---------- [Messenger] Fixed MessengerPass::guessHandledClasses return type | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Good evening! Thanks for this amazing project. I've searched over issues and PRs and I didn't find anything about this bug I found. Excuse me if this is a duplicate. If you create an implementation of `MessageSubscriberInterface` and yield results from `getHandledMessages` method, a TypeError (like the following) will be raised: ```TypeError: Return value of Symfony\Component\Messenger\DependencyInjection\MessengerPass::guessHandledClasses() must be of the type array, object returned``` `MessengerPass::guessHandledClasses` return type declared is `array`, when `MessageSubscriberInterface::guessHandledClasses()`'s return type is `iterable`. In this PR I have fixed the return type and wrote a simple test for it. I am looking forward your review. Thank you. Massimiliano Commits ------- 0b1c825 [Messenger] Fixed MessengerPass::guessHandledClasses return type
Thanks to you, @nicolas-grekas and @sroze |
…n type (massimilianobraglia) This PR was merged into the 4.1 branch. Discussion ---------- [Messenger] Fixed MessengerPass::guessHandledClasses return type | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #27633 | License | MIT | Doc PR | ø #27633 should have been merged to 4.1. Commits ------- d6b6e96 [Messenger] Fixed MessengerPass::guessHandledClasses return type
Good evening! Thanks for this amazing project.
I've searched over issues and PRs and I didn't find anything about this bug I found. Excuse me if this is a duplicate.
If you create an implementation of
MessageSubscriberInterface
and yield results fromgetHandledMessages
method, a TypeError (like the following) will be raised:TypeError: Return value of Symfony\Component\Messenger\DependencyInjection\MessengerPass::guessHandledClasses() must be of the type array, object returned
MessengerPass::guessHandledClasses
return type declared isarray
, whenMessageSubscriberInterface::guessHandledClasses()
's return type isiterable
.In this PR I have fixed the return type and wrote a simple test for it.
I am looking forward your review. Thank you.
Massimiliano