Skip to content

Commit 046a034

Browse files
committed
prettified
1 parent 2e68ccb commit 046a034

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

flight/core/EventDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function trigger(string $event, ...$args): void
3535
foreach ($this->listeners[$event] as $callback) {
3636
$result = call_user_func_array($callback, $args);
3737

38-
// If you return false, it will break the loop and stop the other event listeners.
38+
// If you return false, it will break the loop and stop the other event listeners.
3939
if ($result === false) {
4040
break; // Stop executing further listeners
4141
}

tests/EventSystemTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,31 +195,31 @@ public function testInvalidCallableThrowsException()
195195
Flight::onEvent('test.event', 'not_a_callable');
196196
}
197197

198-
/**
198+
/**
199199
* Test that event propagation stops if a listener returns false.
200200
*/
201201
public function testStopPropagation()
202202
{
203203
$firstCalled = false;
204204
$secondCalled = false;
205205
$thirdCalled = false;
206-
206+
207207
Flight::onEvent('test.event', function () use (&$firstCalled) {
208208
$firstCalled = true;
209209
return true; // Continue propagation
210210
});
211-
211+
212212
Flight::onEvent('test.event', function () use (&$secondCalled) {
213213
$secondCalled = true;
214214
return false; // Stop propagation
215215
});
216-
216+
217217
Flight::onEvent('test.event', function () use (&$thirdCalled) {
218218
$thirdCalled = true;
219219
});
220-
220+
221221
Flight::triggerEvent('test.event');
222-
222+
223223
$this->assertTrue($firstCalled, 'First listener should be called');
224224
$this->assertTrue($secondCalled, 'Second listener should be called');
225225
$this->assertFalse($thirdCalled, 'Third listener should not be called after propagation stopped');

0 commit comments

Comments
 (0)