@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $promises = [ |
37 | 37 | 'async' => $factory->createClient($dsn) |
38 | 38 | ->then( |
39 | - function (AsynchronousClient $client) { |
|
39 | + function(AsynchronousClient $client) { |
|
40 | 40 | $client->on( |
41 | 41 | 'close', |
42 | - function () { |
|
42 | + function() { |
|
43 | 43 | $this->logger->error('Connection closed.'); |
44 | 44 | $this->loop->stop(); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | return $client; |
49 | 49 | }, |
50 | - function (\Exception $exception) { |
|
50 | + function(\Exception $exception) { |
|
51 | 51 | $this->loop->stop(); |
52 | 52 | $this->logger->error($exception->getMessage()); |
53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | return all($promises) |
59 | 59 | ->then( |
60 | - function (iterable $results): array { |
|
60 | + function(iterable $results): array { |
|
61 | 61 | $clients = []; |
62 | 62 | foreach ($results as $key => $client) { |
63 | 63 | $clients[$key] = $client; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | ) |
72 | 72 | ->then( |
73 | - fn (array $clients): RedisStorage => new RedisStorage( |
|
73 | + fn(array $clients): RedisStorage => new RedisStorage( |
|
74 | 74 | $clients['async'], |
75 | 75 | $clients['sync'], |
76 | 76 | ) |
@@ -127,7 +127,7 @@ |
||
127 | 127 | $topicSelector, |
128 | 128 | fn(string $topic, Message $message) => $this->sendIfAllowed($topic, $message, $request, $stream) |
129 | 129 | ) |
130 | - ->then(function (string $topic) use ($request) { |
|
130 | + ->then(function(string $topic) use ($request) { |
|
131 | 131 | $clientId = $request->getAttribute('clientId'); |
132 | 132 | $this->logger->debug("Client {$clientId} subscribed to {$topic}"); |
133 | 133 | }); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | |
55 | 55 | $this->transport |
56 | 56 | ->publish($input['topic'], $message) |
57 | - ->then(fn () => $this->storage->storeMessage($input['topic'], $message)); |
|
57 | + ->then(fn() => $this->storage->storeMessage($input['topic'], $message)); |
|
58 | 58 | |
59 | 59 | $this->logger->debug( |
60 | 60 | \sprintf( |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $localAddress = $this->config[Configuration::ADDR]; |
45 | 45 | $this->shutdownSignal = null; |
46 | 46 | $this->metricsHandler->resetUsers($localAddress); |
47 | - $this->loop->addSignal(SIGINT, function ($signal) { |
|
47 | + $this->loop->addSignal(SIGINT, function($signal) { |
|
48 | 48 | $this->stop($signal, $this->loop); |
49 | 49 | }); |
50 | 50 | $this->loop->addPeriodicTimer( |
51 | 51 | 15, |
52 | 52 | fn() => $this->metricsHandler->getNbUsers()->then( |
53 | - function (int $nbUsers) { |
|
53 | + function(int $nbUsers) { |
|
54 | 54 | $memory = \memory_get_usage(true) / 1024 / 1024; |
55 | 55 | $this->logger->debug("Users: {$nbUsers} - Memory: {$memory}MB"); |
56 | 56 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | private function createSocketConnection(string $localAddress, LoopInterface $loop): Socket\Server |
76 | 76 | { |
77 | 77 | $socket = new Socket\Server($localAddress, $loop); |
78 | - $socket->on('connection', function (ConnectionInterface $connection) use ($localAddress) { |
|
78 | + $socket->on('connection', function(ConnectionInterface $connection) use ($localAddress) { |
|
79 | 79 | $this->metricsHandler->incrementUsers($localAddress); |
80 | 80 | $connection->on('close', fn() => $this->metricsHandler->decrementUsers($localAddress)); |
81 | 81 | }); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | private function stop(int $signal, LoopInterface $loop): void |
96 | 96 | { |
97 | 97 | $this->shutdownSignal = $signal; |
98 | - $loop->futureTick(function () use ($loop) { |
|
98 | + $loop->futureTick(function() use ($loop) { |
|
99 | 99 | $loop->stop(); |
100 | 100 | }); |
101 | 101 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | $promises = [ |
35 | 35 | 'subscriber' => $factory->createClient($dsn) |
36 | 36 | ->then( |
37 | - function (AsynchronousClient $client) { |
|
37 | + function(AsynchronousClient $client) { |
|
38 | 38 | $client->on( |
39 | 39 | 'close', |
40 | - function () { |
|
40 | + function() { |
|
41 | 41 | $this->logger->error('Connection closed.'); |
42 | 42 | $this->loop->stop(); |
43 | 43 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | |
46 | 46 | return $client; |
47 | 47 | }, |
48 | - function (\Exception $exception) { |
|
48 | + function(\Exception $exception) { |
|
49 | 49 | $this->loop->stop(); |
50 | 50 | $this->logger->error($exception->getMessage()); |
51 | 51 | } |
52 | 52 | ), |
53 | 53 | 'publisher' => $factory->createClient($dsn) |
54 | 54 | ->then( |
55 | - function (AsynchronousClient $client) { |
|
55 | + function(AsynchronousClient $client) { |
|
56 | 56 | $client->on( |
57 | 57 | 'close', |
58 | - function () { |
|
58 | + function() { |
|
59 | 59 | $this->logger->error('Connection closed.'); |
60 | 60 | $this->loop->stop(); |
61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | return $client; |
65 | 65 | }, |
66 | - function (\Exception $exception) { |
|
66 | + function(\Exception $exception) { |
|
67 | 67 | $this->loop->stop(); |
68 | 68 | $this->logger->error($exception->getMessage()); |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | return all($promises) |
74 | 74 | ->then( |
75 | - function (iterable $results): array { |
|
75 | + function(iterable $results): array { |
|
76 | 76 | $clients = []; |
77 | 77 | foreach ($results as $key => $client) { |
78 | 78 | $clients[$key] = $client; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | ) |
87 | 87 | ->then( |
88 | - fn (array $clients) => new RedisTransport($clients['subscriber'], $clients['publisher']) |
|
88 | + fn(array $clients) => new RedisTransport($clients['subscriber'], $clients['publisher']) |
|
89 | 89 | ); |
90 | 90 | } |
91 | 91 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $config = $this->configuration->overrideWith(without_nullish_values($input->getOptions()))->asArray(); |
51 | 51 | $factory = $this->factory->withConfig($config); |
52 | 52 | $loop->futureTick( |
53 | - function () use ($config, $output) { |
|
53 | + function() use ($config, $output) { |
|
54 | 54 | $this->displayConfiguration($config, $output); |
55 | 55 | } |
56 | 56 | ); |