Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] fix wrong use of generator returns #31389

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
May 6, 2019

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented May 6, 2019

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR symfony/symfony-docs#...

I've seen this problem many times: Mixing yield with return [].
Unfortunately it cannot be forbidden at the compiler level because it's actually a feature: https://www.php.net/manual/de/generator.getreturn.php
But usually not intended that way.
Also added some other minor cleanups I've found.

@@ -84,12 +84,12 @@ public function getMessageCount(): int
return ($this->receiver ?? $this->getReceiver())->getMessageCount();
}

private function getReceiver()
private function getReceiver(): AmqpReceiver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added typehints to make it consistent with DoctrineTransport.

@chalasr
Copy link
Member

chalasr commented May 6, 2019

fabbot patch looks good

@Tobion Tobion force-pushed the messenger-generator branch from e931367 to 50c9c8a Compare May 6, 2019 09:28
Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test failures look legit

@xabbuh xabbuh added this to the 4.3 milestone May 6, 2019
@Tobion Tobion force-pushed the messenger-generator branch from 50c9c8a to c9e5853 Compare May 6, 2019 09:54
@Tobion
Copy link
Contributor Author

Tobion commented May 6, 2019

Fixed tests

@fabpot
Copy link
Member

fabpot commented May 6, 2019

@Tobion Can you apply fabbot's patch?

And some other minor cleanups
@Tobion Tobion force-pushed the messenger-generator branch from c9e5853 to e8a09e9 Compare May 6, 2019 10:23
@Tobion
Copy link
Contributor Author

Tobion commented May 6, 2019

Done

@fabpot
Copy link
Member

fabpot commented May 6, 2019

Thank you @Tobion.

@fabpot fabpot merged commit e8a09e9 into symfony:master May 6, 2019
fabpot added a commit that referenced this pull request May 6, 2019
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] fix wrong use of generator returns

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets |
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

I've seen this problem many times: Mixing `yield` with `return []`.
Unfortunately it cannot be forbidden at the compiler level because it's actually a feature: https://www.php.net/manual/de/generator.getreturn.php
But usually not intended that way.
Also added some other minor cleanups I've found.

Commits
-------

e8a09e9 [Messenger] fix wrong use of generator returns
@Tobion Tobion deleted the messenger-generator branch May 6, 2019 13:39
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.

6 participants