Skip to content

[5.8] Fix event:list command#28624

Merged
taylorotwell merged 1 commit intolaravel:5.8from
joedixon:fix-event-list
May 27, 2019
Merged

[5.8] Fix event:list command#28624
taylorotwell merged 1 commit intolaravel:5.8from
joedixon:fix-event-list

Conversation

@joedixon
Copy link
Copy Markdown
Contributor

When using a combination of manually registering events in the EventServiceProvider and event auto discovery, the output of php artisan event:list can be unexpected.

Example
If I have two listeners in the app/Listeners directory for the VoteWasCast event (e.g. StoreVote and SendVote), but I only have one of those manually registered in the EventServiceProvider as below, I would still expect both to be included in the output of php artisan event:list.

class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        VoteWasCast::class => [
            StoreVote::class,
        ]
    ];
}

However, below is the output I get:

Screenshot 2019-05-27 at 09 49 31

This PR provides the following output which is in line with what I would expect.

Screenshot 2019-05-27 at 09 51 01

@driesvints driesvints changed the title Fix event:list command [5.8] Fix event:list command May 27, 2019
@driesvints
Copy link
Copy Markdown
Member

Isn't it weird that the StoreVote class is now listed twice?

@joedixon
Copy link
Copy Markdown
Contributor Author

joedixon commented May 27, 2019

Well, I think it’s probably expected behaviour. If I add it to the $listen array and have auto discovery on, my listener fires twice. I assume it’s the developers responsibility not to list it there and use auto discovery?

@driesvints
Copy link
Copy Markdown
Member

@joedixon ah, if it's fired twice than that definitely makes sense. I can follow that reasoning 👍

@taylorotwell taylorotwell merged commit 76703ab into laravel:5.8 May 27, 2019
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

Successfully merging this pull request may close these issues.

3 participants