Skip to content
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

How to deal with command / event busses? #91

Open
ruudk opened this issue Sep 14, 2024 · 1 comment
Open

How to deal with command / event busses? #91

ruudk opened this issue Sep 14, 2024 · 1 comment

Comments

@ruudk
Copy link

ruudk commented Sep 14, 2024

Let's say you have the following:

class MyHandler {
    public function __construct(private SomeDependency $dep) {}

    public function __invoke(MyCommand $command) {}
}

class MyCommand {
    public function __construct(public string $name) {}
}

class MyController {
    public function __invoke() {
        $this->commandBus->dispatch(new MyCommand('Ruud'));
    }
}

The above should return in no dead classes.

But when MyCommand is not dispatched anywhere, it should mark MyHandler + MyCommand as dead.

Same with an Event and multiple event subscribers to that event. If the event is never dispatched, the event + all the subscribers should be marked as dead.

https://symfony.com/doc/current/components/messenger.html

@janedbal
Copy link
Member

I believe that in order to support this (and #83), we need some HiddenCallProvider which will be based on AST, not based on reflection like EntrypointProvider is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants