@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function testRpc(): void |
| 18 | 18 | { |
| 19 | - $message = MessageFactory::rpc(static function ($v) { |
|
| 19 | + $message = MessageFactory::rpc(static function($v) { |
|
| 20 | 20 | return $v; |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $result = $this->await($messenger->callRpc( |
| 30 | 30 | MessageFactory::CLOSURE_EXECUTE, |
| 31 | 31 | /** @phpstan-ignore-next-line */ |
| 32 | - MessageFactory::rpc(static function () use ($data) { |
|
| 32 | + MessageFactory::rpc(static function() use ($data) { |
|
| 33 | 33 | return $data; |
| 34 | 34 | })->getPayload() |
| 35 | 35 | )); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $this->messenger->registerRpc( |
| 27 | 27 | MessageFactory::CLOSURE_EXECUTE, |
| 28 | - function (Payload $payload): PromiseInterface { |
|
| 28 | + function(Payload $payload): PromiseInterface { |
|
| 29 | 29 | return $this->executeClosure($payload->getPayload()['closure']); |
| 30 | 30 | } |
| 31 | 31 | ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | -require \dirname(__DIR__) . '/vendor/autoload.php'; |
|
| 2 | +require \dirname(__DIR__).'/vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | use React\EventLoop\Factory as EventLoopFactory; |
| 5 | 5 | use React\EventLoop\Timer\Timer; |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $loop = EventLoopFactory::create(); |
| 13 | 13 | |
| 14 | -MessengerFactory::parentFromClass(ClosureChild::class, $loop)->then(function (Messenger $messenger) use ($loop): void { |
|
| 15 | - $messenger->on('error', function ($e): void { |
|
| 14 | +MessengerFactory::parentFromClass(ClosureChild::class, $loop)->then(function(Messenger $messenger) use ($loop): void { |
|
| 15 | + $messenger->on('error', function($e): void { |
|
| 16 | 16 | echo 'Error: ', \var_export($e, true), \PHP_EOL; |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | 19 | $i = 0; |
| 20 | - $loop->addPeriodicTimer(1, function (Timer $timer) use (&$i, $messenger): void { |
|
| 20 | + $loop->addPeriodicTimer(1, function(Timer $timer) use (&$i, $messenger): void { |
|
| 21 | 21 | if ($i >= 13) { |
| 22 | 22 | $timer->cancel(); |
| 23 | 23 | $messenger->softTerminate(); |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $messenger->rpc(MessageFactory::rpc(function () { |
|
| 28 | + $messenger->rpc(MessageFactory::rpc(function() { |
|
| 29 | 29 | return ['time' => \time()]; // Note that you ALWAYS MUST return an array |
| 30 | - }))->done(function (Payload $payload): void { |
|
| 30 | + }))->done(function(Payload $payload): void { |
|
| 31 | 31 | echo $payload['time'], \PHP_EOL; |
| 32 | 32 | }); |
| 33 | 33 | |