@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public static function error(\Exception $error): self |
54 | 54 | { |
55 | - return self::define(function () use ($error) { |
|
55 | + return self::define(function() use ($error) { |
|
56 | 56 | throw $error; |
57 | 57 | }); |
58 | 58 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $handler = $this->handler($signal); |
36 | 36 | $channel = Channel::open($signal); |
37 | 37 | |
38 | - $promise = \future(function () use ($channel, $handler, $arguments) { |
|
38 | + $promise = \future(function() use ($channel, $handler, $arguments) { |
|
39 | 39 | $result = $handler(...$arguments); |
40 | 40 | |
41 | 41 | if ($result instanceof \Generator) { |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | require __DIR__ . '/../vendor/autoload.php'; |
4 | 4 | |
5 | -Amp\Loop::run(function () { |
|
5 | +Amp\Loop::run(function() { |
|
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 | } |
@@ -5,9 +5,9 @@ |
||
5 | 5 | |
6 | 6 | require __DIR__ . '/../vendor/autoload.php'; |
7 | 7 | |
8 | -Amp\Loop::run(function () { |
|
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 |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | -Amp\Loop::run(function () { |
|
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 | }); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | */ |
86 | 86 | function future(...$arguments): \Amp\Promise |
87 | 87 | { |
88 | - return new \Amp\LazyPromise(function () use ($arguments) { |
|
88 | + return new \Amp\LazyPromise(function() use ($arguments) { |
|
89 | 89 | return \promise(...$arguments); |
90 | 90 | }); |
91 | 91 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | continue; |
94 | 94 | } |
95 | 95 | |
96 | - $handler = function (string $watcherId, int $sigNo, $sigInfo = null) use ($dispatcher, $signal) { |
|
96 | + $handler = function(string $watcherId, int $sigNo, $sigInfo = null) use ($dispatcher, $signal) { |
|
97 | 97 | yield $dispatcher->dispatch($signal, $sigNo, $sigInfo, $watcherId); |
98 | 98 | }; |
99 | 99 |