Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC][Messenger] add MessageInstanceOf helper #27188

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

Closed
wants to merge 1 commit into from
Closed

[RFC][Messenger] add MessageInstanceOf helper #27188

wants to merge 1 commit into from

Conversation

kbond
Copy link
Member

@kbond kbond commented May 7, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27076
License MIT
Doc PR todo

This adds a helper class to easily let your message subscribers handle all messages that implement an interface or extend a class:

class MyMessageSubscriber implements MessageSubscriberInterface
{
    public static function getHandledMessages(): iterable
    {
        return new MessageInstanceOf(SomeInterface::class);
    }
}

This depends on #27034 which allows MessageSubscriberInterface::getHandledMessages() to return iterable.

@carsonbot carsonbot added Status: Needs Review RFC RFC = Request For Comments (proposals about features that you want to be discussed) Feature labels May 7, 2018
@nicolas-grekas
Copy link
Member

I'm sorry I feel like I -1 a lot these days, but 👎.
This is just totally magic: loading order dependent, global, unconfigurable.

@kbond
Copy link
Member Author

kbond commented May 7, 2018

Fair enough - I didn't think this implementation would fly.

@sroze sroze added the Messenger label May 8, 2018
@sroze
Copy link
Contributor

sroze commented May 8, 2018

I quite like the intellectual exercise here and also don't believe it should be in core at least, so closing. Thanks for exploring that option!

@sroze sroze closed this May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Messenger RFC RFC = Request For Comments (proposals about features that you want to be discussed) Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants