-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
@@ -84,12 +84,12 @@ public function getMessageCount(): int | |||
return ($this->receiver ?? $this->getReceiver())->getMessageCount(); | |||
} | |||
|
|||
private function getReceiver() | |||
private function getReceiver(): AmqpReceiver |
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.
Added typehints to make it consistent with DoctrineTransport.
fabbot patch looks good |
e931367
to
50c9c8a
Compare
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.
test failures look legit
50c9c8a
to
c9e5853
Compare
Fixed tests |
@Tobion Can you apply fabbot's patch? |
And some other minor cleanups
c9e5853
to
e8a09e9
Compare
Done |
Thank you @Tobion. |
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
I've seen this problem many times: Mixing
yield
withreturn []
.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.