-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels

Description
When adding and removing a listener the hasListeners() function returns an incorrect result:
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addListener('test_event', 'some_callback');
$eventDispatcher->removeListener('test_event', 'some_callback');
// This should be false but instead returns true
$eventDispatcher->hasListeners();
Or another example:
$eventDispatcher = new EventDispatcher();
// Correctly returns false
$eventDispatcher->hasListeners('test_event');
// Incorrectly returns true because of the previous call
$eventDispatcher->hasListeners();