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

[6.x] Fixes issue for has_listeners method on dispatcher #31403

Merged
merged 1 commit into from Feb 10, 2020

Conversation

imanghafoori1
Copy link
Contributor

@imanghafoori1 imanghafoori1 commented Feb 8, 2020

Currently the has_listeners method on the dispatcher class is not able to detect the listeners with wildcards, but getListeners() method can detect and return such listeners.
I also added test to cover that.

And of course because the || operator is lazy in php, it does not go for execution of the closure in cases, the first two conditions are true.

The below code demonstrates that :

        Event::listen('foo.*', function () {
            //
        });
        Event::hasListeners('foo.bar'); // false
        Event::getListeners('foo.bar'); // returns closure !

@taylorotwell taylorotwell merged commit 28df132 into laravel:6.x Feb 10, 2020
@imanghafoori1 imanghafoori1 deleted the fix_has_listeners_issue branch February 12, 2020 20:47
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.

None yet

2 participants