-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] #[AsMessageHandler] with union type doesn't compile #47206
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
Labels
Comments
Can you create a small example application that allows to reproduce your issue? |
ArchitectNate
added a commit
to ArchitectNate/symfony-47206
that referenced
this issue
Aug 8, 2022
I've replicated the bug here: https://github.com/ArchitectNate/symfony-47206 I'll start digging into a fix Status: Needs Work |
Status: Needs Review |
@xabbuh is the example application and subsequent PR sufficient? Thoughts? |
fabpot
added a commit
that referenced
this issue
Sep 13, 2022
… Union type tagged with #[AsMessageHandler] (ArchitectNate) This PR was squashed before being merged into the 6.1 branch. Discussion ---------- [Messenger] Support for custom handler method containing a Union type tagged with #[AsMessageHandler] | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #47206 | License | MIT | Doc PR | No When Union Types were implemented for the #[AsMessageHandler] attribute, it wasn't designed with non `__invoke` methods in mind. This fix detects if we are using `__invoke` or not and constructs the return to match the rest of the logic, mainly it allows for a `type => methodName` map if `__invoke` is not being used. Commits ------- f38d8f8 [Messenger] Support for custom handler method containing a Union type tagged with #[AsMessageHandler]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
6.0
Description
Having a
#[AsMessageHandler]
on a method (except__invoke
) taking a union will prevent compilation.How to reproduce
Possible Solution
In the
MessengerPass::guessHandledClasses()
method, every path except the one dealing with union types return if method is knownarray<class-string, method>
elsearray<int, class-string>
. Code path dealing with unions does not.The text was updated successfully, but these errors were encountered: