@@ -114,7 +114,7 @@ |
||
114 | 114 | $topicSelector, |
115 | 115 | fn(string $topic, Message $message) => $this->sendIfAllowed($topic, $message, $request, $stream) |
116 | 116 | ) |
117 | - ->then(function (string $topic) use ($request) { |
|
117 | + ->then(function(string $topic) use ($request) { |
|
118 | 118 | $clientId = $request->getAttribute('clientId'); |
119 | 119 | $this->logger()->debug("Client {$clientId} subscribed to {$topic}"); |
120 | 120 | }); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $this->transport |
53 | 53 | ->publish($input['topic'], $message) |
54 | - ->then(fn () => $this->storage->storeMessage($input['topic'], $message)); |
|
54 | + ->then(fn() => $this->storage->storeMessage($input['topic'], $message)); |
|
55 | 55 | |
56 | 56 | $this->logger()->debug( |
57 | 57 | \sprintf( |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** @phpstan-ignore-next-line */ |
14 | 14 | $client->get('foo')->then( |
15 | 15 | null, |
16 | - function (\Exception $e) use ($loop, $logger) { |
|
16 | + function(\Exception $e) use ($loop, $logger) { |
|
17 | 17 | $logger->error(\sprintf('Redis error: %s', $e->getMessage())); |
18 | 18 | $loop->stop(); |
19 | 19 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | $promises = [ |
36 | 36 | 'async' => $factory->createClient($dsn) |
37 | 37 | ->then( |
38 | - function (AsynchronousClient $client) use ($loop) { |
|
38 | + function(AsynchronousClient $client) use ($loop) { |
|
39 | 39 | $client->on( |
40 | 40 | 'close', |
41 | - function () use ($loop) { |
|
41 | + function() use ($loop) { |
|
42 | 42 | $this->logger()->error('Connection closed.'); |
43 | 43 | $loop->stop(); |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | return $client; |
48 | 48 | }, |
49 | - function (\Exception $exception) use ($loop) { |
|
49 | + function(\Exception $exception) use ($loop) { |
|
50 | 50 | $loop->stop(); |
51 | 51 | $this->logger()->error($exception->getMessage()); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | return all($promises) |
58 | 58 | ->then( |
59 | - function (iterable $results) use ($loop): array { |
|
59 | + function(iterable $results) use ($loop): array { |
|
60 | 60 | $clients = []; |
61 | 61 | foreach ($results as $key => $client) { |
62 | 62 | $clients[$key] = $client; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | ) |
71 | 71 | ->then( |
72 | - fn (array $clients): RedisStorage => new RedisStorage( |
|
72 | + fn(array $clients): RedisStorage => new RedisStorage( |
|
73 | 73 | $clients['async'], |
74 | 74 | $clients['sync'], |
75 | 75 | ) |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | private function export(): array |
46 | 46 | { |
47 | - $config = \array_map(fn ($value) => \is_string($value) && '' === \trim($value) ? null : $value, $this->config); |
|
47 | + $config = \array_map(fn($value) => \is_string($value) && '' === \trim($value) ? null : $value, $this->config); |
|
48 | 48 | if (null === $config[self::JWT_KEY] && null === $config[self::PUBLISHER_JWT_KEY]) { |
49 | 49 | throw new \InvalidArgumentException( |
50 | 50 | "One of \"jwt_key\" or \"publisher_jwt_key\" configuration parameter must be defined." |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->loop->addPeriodicTimer( |
54 | 54 | 15, |
55 | 55 | fn() => $this->metricsHandler->getNbUsers()->then( |
56 | - function (int $nbUsers) { |
|
56 | + function(int $nbUsers) { |
|
57 | 57 | $memory = \memory_get_usage(true) / 1024 / 1024; |
58 | 58 | $this->logger()->debug("Users: {$nbUsers} - Memory: {$memory}MB"); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | $socket->on( |
63 | 63 | 'connection', |
64 | - function (Socket\ConnectionInterface $connection) use ($localAddress) { |
|
64 | + function(Socket\ConnectionInterface $connection) use ($localAddress) { |
|
65 | 65 | $this->metricsHandler->incrementUsers($localAddress); |
66 | 66 | $connection->on('close', fn() => $this->metricsHandler->decrementUsers($localAddress)); |
67 | 67 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $promises = [ |
34 | 34 | 'subscriber' => $factory->createClient($dsn) |
35 | 35 | ->then( |
36 | - function (AsynchronousClient $client) use ($loop) { |
|
36 | + function(AsynchronousClient $client) use ($loop) { |
|
37 | 37 | $client->on( |
38 | 38 | 'close', |
39 | - function () use ($loop) { |
|
39 | + function() use ($loop) { |
|
40 | 40 | $this->logger()->error('Connection closed.'); |
41 | 41 | $loop->stop(); |
42 | 42 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | |
45 | 45 | return $client; |
46 | 46 | }, |
47 | - function (\Exception $exception) use ($loop) { |
|
47 | + function(\Exception $exception) use ($loop) { |
|
48 | 48 | $loop->stop(); |
49 | 49 | $this->logger->error($exception->getMessage()); |
50 | 50 | } |
51 | 51 | ), |
52 | 52 | 'publisher' => $factory->createClient($dsn) |
53 | 53 | ->then( |
54 | - function (AsynchronousClient $client) use ($loop) { |
|
54 | + function(AsynchronousClient $client) use ($loop) { |
|
55 | 55 | $client->on( |
56 | 56 | 'close', |
57 | - function () use ($loop) { |
|
57 | + function() use ($loop) { |
|
58 | 58 | $this->logger()->error('Connection closed.'); |
59 | 59 | $loop->stop(); |
60 | 60 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | return $client; |
64 | 64 | }, |
65 | - function (\Exception $exception) use ($loop) { |
|
65 | + function(\Exception $exception) use ($loop) { |
|
66 | 66 | $loop->stop(); |
67 | 67 | $this->logger()->error($exception->getMessage()); |
68 | 68 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | return all($promises) |
73 | 73 | ->then( |
74 | - function (iterable $results) use ($loop): array { |
|
74 | + function(iterable $results) use ($loop): array { |
|
75 | 75 | $clients = []; |
76 | 76 | foreach ($results as $key => $client) { |
77 | 77 | $clients[$key] = $client; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | ) |
87 | 87 | ->then( |
88 | - fn (array $clients): RedisTransport => new RedisTransport( |
|
88 | + fn(array $clients): RedisTransport => new RedisTransport( |
|
89 | 89 | $clients['subscriber'], |
90 | 90 | $clients['publisher'], |
91 | 91 | ) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->subscriber->subscribe($topicSelector); |
47 | 47 | $this->subscriber->on( |
48 | 48 | 'message', |
49 | - function (string $topic, string $payload) use ($topicSelector, $callback) { |
|
49 | + function(string $topic, string $payload) use ($topicSelector, $callback) { |
|
50 | 50 | $this->dispatch($topic, $payload, $topicSelector, $callback); |
51 | 51 | } |
52 | 52 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->subscriber->psubscribe($channel); |
75 | 75 | $this->subscriber->on( |
76 | 76 | 'pmessage', |
77 | - function (string $pattern, string $topic, string $payload) use ($topicSelector, $callback) { |
|
77 | + function(string $pattern, string $topic, string $payload) use ($topicSelector, $callback) { |
|
78 | 78 | $this->dispatch($topic, $payload, $topicSelector, $callback); |
79 | 79 | } |
80 | 80 | ); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function subscribe(string $subscribedTopic, callable $callback): PromiseInterface |
30 | 30 | { |
31 | - $this->emitter->on('message', function (string $topic, Message $message) use ($callback, $subscribedTopic) { |
|
31 | + $this->emitter->on('message', function(string $topic, Message $message) use ($callback, $subscribedTopic) { |
|
32 | 32 | if (!TopicMatcher::matchesTopicSelectors($topic, [$subscribedTopic])) { |
33 | 33 | return; |
34 | 34 | } |