pull/632/head
n0nag0n 4 weeks ago
parent 2e68ccb0d0
commit 046a034455

@ -35,7 +35,7 @@ class EventDispatcher
foreach ($this->listeners[$event] as $callback) {
$result = call_user_func_array($callback, $args);
// If you return false, it will break the loop and stop the other event listeners.
// If you return false, it will break the loop and stop the other event listeners.
if ($result === false) {
break; // Stop executing further listeners
}

@ -195,7 +195,7 @@ class EventSystemTest extends TestCase
Flight::onEvent('test.event', 'not_a_callable');
}
/**
/**
* Test that event propagation stops if a listener returns false.
*/
public function testStopPropagation()

Loading…
Cancel
Save