pull/632/head
n0nag0n 3 months ago
parent 2e68ccb0d0
commit 046a034455

@ -35,7 +35,7 @@ class EventDispatcher
foreach ($this->listeners[$event] as $callback) { foreach ($this->listeners[$event] as $callback) {
$result = call_user_func_array($callback, $args); $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) { if ($result === false) {
break; // Stop executing further listeners break; // Stop executing further listeners
} }

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

Loading…
Cancel
Save