Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[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

Merged
merged 1 commit into from
Jun 19, 2018
Merged

[Messenger] Fixed MessengerPass::guessHandledClasses return type #27633

merged 1 commit into from
Jun 19, 2018

Conversation

massimilianobraglia
Copy link
Contributor

@massimilianobraglia massimilianobraglia commented Jun 18, 2018

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

@massimilianobraglia massimilianobraglia changed the title Fixed MessengerPass::guessHandledClasses return type [Messenger] Fixed MessengerPass::guessHandledClasses return type Jun 18, 2018
Copy link
Contributor

@sroze sroze left a 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;
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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 😄

@sroze sroze added this to the next milestone Jun 19, 2018
@massimilianobraglia
Copy link
Contributor Author

Thank you @sroze for your review! I'll fix it as soon as possible 😄

@sroze
Copy link
Contributor

sroze commented Jun 19, 2018

Also, could you rebase your pull-request to the branch 4.1 as it is a bug? Thank you!

@sroze sroze modified the milestones: next, 4.1 Jun 19, 2018
@nicolas-grekas
Copy link
Member

Thank you @massimilianobraglia.

@nicolas-grekas nicolas-grekas merged commit 0b1c825 into symfony:master Jun 19, 2018
nicolas-grekas added a commit that referenced this pull request Jun 19, 2018
…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
@massimilianobraglia
Copy link
Contributor Author

Thanks to you, @nicolas-grekas and @sroze

nicolas-grekas added a commit that referenced this pull request Jun 20, 2018
…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
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.