Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] #[AsMessageHandler] with union type doesn't compile #47206

Copy link
Copy link
Closed
@alex-dev

Description

@alex-dev
Issue body actions

Symfony version(s) affected

6.0

Description

Having a #[AsMessageHandler] on a method (except __invoke) taking a union will prevent compilation.

How to reproduce

#[AsMessageHandler]
public function method(A|B $message): void {}

Possible Solution

In the MessengerPass::guessHandledClasses() method, every path except the one dealing with union types return if method is known array<class-string, method> else array<int, class-string>. Code path dealing with unions does not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.