@@ -6,7 +6,7 @@ |
||
6 | 6 | $signals = \pcntl_signal_list(['SIGINT']); |
7 | 7 | |
8 | 8 | foreach ($signals as $signal) { |
9 | - \ensign_signal($signal, function ($sigNo) { |
|
9 | + \ensign_signal($signal, function($sigNo) { |
|
10 | 10 | echo \sprintf('System signal "%d" received.' . \PHP_EOL, $sigNo); |
11 | 11 | }); |
12 | 12 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | Amp\Loop::run(function() { |
19 | 19 | $handlers = new HandlerMap(); |
20 | - $handlers->register('emit', function (int $num) { |
|
20 | + $handlers->register('emit', function(int $num) { |
|
21 | 21 | yield new SimpleEvent($num - 1); |
22 | 22 | yield new Amp\Delayed(1000); // Just do some heavy calculations |
23 | 23 | |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | $dispatcher = new SignalDispatcher($handlers); |
35 | 35 | |
36 | 36 | $task = $dispatcher->dispatch('emit', 10); |
37 | - $task->onResolve(function (\Throwable $error = null, $data) { |
|
37 | + $task->onResolve(function(\Throwable $error = null, $data) { |
|
38 | 38 | echo \sprintf('Task resolved with value: %d at %s' . \PHP_EOL, $data, \microtime(true)); |
39 | 39 | }); |
40 | 40 | |
41 | 41 | $eventOne = $task->wait(SimpleEvent::class); |
42 | - $eventOne->onResolve(function (\Throwable $error = null, SimpleEvent $event = null) { |
|
42 | + $eventOne->onResolve(function(\Throwable $error = null, SimpleEvent $event = null) { |
|
43 | 43 | echo \sprintf('Event one resolved with value: %d at %s' . \PHP_EOL, $event->num, \microtime(true)); |
44 | 44 | }); |
45 | 45 | |
46 | 46 | $eventTwo = $task->wait(SimpleEvent::class); |
47 | - $eventTwo->onResolve(function (\Throwable $error = null, SimpleEvent $event = null) { |
|
47 | + $eventTwo->onResolve(function(\Throwable $error = null, SimpleEvent $event = null) { |
|
48 | 48 | echo \sprintf('Event two resolved with value: %d at %s' . \PHP_EOL, $event->num, \microtime(true)); |
49 | 49 | }); |
50 | 50 | |
51 | 51 | $eventThree = $task->wait(SimpleEvent::class); |
52 | - $eventThree->onResolve(function (\Throwable $error = null, SimpleEvent $event = null) { |
|
52 | + $eventThree->onResolve(function(\Throwable $error = null, SimpleEvent $event = null) { |
|
53 | 53 | echo \sprintf('Event three resolved with value: %d at %s' . \PHP_EOL, $event->num, \microtime(true)); |
54 | 54 | }); |
55 | 55 | }); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | Amp\Loop::run(function() { |
9 | 9 | $handlers = new HandlerMap(); |
10 | - $handlers->register('emit', function (string $string, int $num, int $delay) { |
|
10 | + $handlers->register('emit', function(string $string, int $num, int $delay) { |
|
11 | 11 | for ($i = 0; $i < $num; $i++) { |
12 | 12 | echo $string; |
13 | 13 |