-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add async commands #57
Comments
if (!$handledStamps) {
// async command
return null;
} Note that still a normal sync command must meet a handler. By removing the logic exception you'll miss that rule. The alternative to allow async without losing the sync validation would be: if (!$handledStamps) {
if ($envelope->all(SentStamp::class)) {
// async command
return null;
}
throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', get_debug_type($envelope->getMessage()), static::class, __FUNCTION__));
} Checking by |
Thank you for your response 👍 However my problem described above is about PHPStan and generics :)
I believe |
Hi, I am using this repository as base for my new project. However this repo does not implement async commands and as a consequence it does not show how to consider async commands inside a command bus implementation.
I rewritten the MessengerCommandBus implementation however this does not satisfy PHPStan as returning null for async commands results in error
The text was updated successfully, but these errors were encountered: