@@ -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 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $objects = \array_filter($objects, 'is_object'); |
| 28 | 28 | |
| 29 | - $this->objects = \array_combine(\array_map(function ($object) { |
|
| 29 | + $this->objects = \array_combine(\array_map(function($object) { |
|
| 30 | 30 | return \get_class($object); |
| 31 | 31 | }, $objects), $objects); |
| 32 | 32 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $handler = function (int $signo, $sigInfo) use ($dispatcher, $signal) { |
|
| 86 | + $handler = function(int $signo, $sigInfo) use ($dispatcher, $signal) { |
|
| 87 | 87 | $dispatcher->dispatch($signal, $signo, $sigInfo); |
| 88 | 88 | }; |
| 89 | 89 | |
@@ -2,9 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | require __DIR__ . '/../vendor/autoload.php'; |
| 4 | 4 | |
| 5 | -loop(function () { |
|
| 5 | +loop(function() { |
|
| 6 | 6 | foreach (pcntl_signal_list() as $signal) { |
| 7 | - ensign_signal($signal, function ($signo) { |
|
| 7 | + ensign_signal($signal, function($signo) { |
|
| 8 | 8 | echo sprintf('System signal "%d" received.' . \PHP_EOL, $signo); |
| 9 | 9 | }); |
| 10 | 10 | } |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -loop(function () { |
|
| 18 | +loop(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 | }); |
@@ -5,9 +5,9 @@ |
||
| 5 | 5 | |
| 6 | 6 | require __DIR__ . '/../vendor/autoload.php'; |
| 7 | 7 | |
| 8 | -loop(function () { |
|
| 8 | +loop(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 | |