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 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
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/styleci/pr The analysis has passed
Details
@imanghafoori1 imanghafoori1 deleted the imanghafoori1:fix_has_listeners_issue branch Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.