-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add a messenger middleware to enforce null results #28758
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
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.
Sounds reasonable to have this in core to me. Can you also send a documentation pull-request? 🙏
{ | ||
$result = $next($message); | ||
if (null !== $result) { | ||
throw new NonNullResultException(sprintf('Non null result for message %s.', \get_class($message))); |
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.
- Non null result for message %s.
+ Non null result for message "%s": at least one handler returned something but this is prohibited by this middleware.
Thanks for the suggestion ! Doc: symfony/symfony-docs#10442 |
@sroze do you like the proposed name? |
@javiereguiluz : For myself, I find |
This will stay the case, as the messenger bus now returns |
A little middleware to make sure a message bus doesn't return any result.