@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $localAddress = $this->config[Configuration::ADDR]; |
86 | 86 | $this->shutdownSignal = null; |
87 | 87 | $this->metricsHandler->resetUsers($localAddress); |
88 | - $this->loop->addSignal(SIGINT, function ($signal) { |
|
88 | + $this->loop->addSignal(SIGINT, function($signal) { |
|
89 | 89 | $this->stop($signal, $this->loop); |
90 | 90 | }); |
91 | 91 | $this->loop->addPeriodicTimer( |
92 | 92 | 15, |
93 | 93 | fn() => $this->metricsHandler->getNbUsers()->then( |
94 | - function (int $nbUsers) { |
|
94 | + function(int $nbUsers) { |
|
95 | 95 | $memory = \memory_get_usage(true) / 1024 / 1024; |
96 | 96 | $this->logger()->debug("Users: {$nbUsers} - Memory: {$memory}MB"); |
97 | 97 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $this->transport->publish($topic, $message) |
144 | 144 | ->then(fn() => $this->storage->storeMessage($topic, $message)) |
145 | 145 | ->then( |
146 | - function () use ($topic, $message) { |
|
146 | + function() use ($topic, $message) { |
|
147 | 147 | $this->logger()->debug(\sprintf('Created message %s on topic %s', $message->getId(), $topic)); |
148 | 148 | } |
149 | 149 | ); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | return $this->storage->storeSubscriptions($subscriptions) |
155 | 155 | ->then( |
156 | - function () use ($subscriptions) { |
|
156 | + function() use ($subscriptions) { |
|
157 | 157 | $promises = []; |
158 | 158 | foreach ($subscriptions as $subscription) { |
159 | 159 | $promises[] = $this->transport->publish( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | private function createSocketConnection(string $localAddress, LoopInterface $loop): Socket\Server |
184 | 184 | { |
185 | 185 | $socket = new Socket\Server($localAddress, $loop); |
186 | - $socket->on('connection', function (ConnectionInterface $connection) use ($localAddress) { |
|
186 | + $socket->on('connection', function(ConnectionInterface $connection) use ($localAddress) { |
|
187 | 187 | $this->metricsHandler->incrementUsers($localAddress); |
188 | 188 | $connection->on('close', fn() => $this->handleClosingConnection($connection, $localAddress)); |
189 | 189 | }); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | private function stop(int $signal, LoopInterface $loop): void |
240 | 240 | { |
241 | 241 | $this->shutdownSignal = $signal; |
242 | - $loop->futureTick(function () use ($loop) { |
|
242 | + $loop->futureTick(function() use ($loop) { |
|
243 | 243 | $loop->stop(); |
244 | 244 | }); |
245 | 245 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** @phpstan-ignore-next-line */ |
75 | 75 | return $this->async->keys($keyPattern) |
76 | 76 | ->then( |
77 | - function (array $keys) use ($topic) { |
|
77 | + function(array $keys) use ($topic) { |
|
78 | 78 | $promises = []; |
79 | 79 | foreach ($keys as $key) { |
80 | 80 | $promises[] = $this->async->get($key); /** @phpstan-ignore-line */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | return all($promises)->then( |
84 | 84 | fn(array $subscriptions) => \array_map( |
85 | - function (string $serialized) { |
|
85 | + function(string $serialized) { |
|
86 | 86 | $data = \json_decode($serialized, true); |
87 | 87 | |
88 | 88 | return new Subscription( |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | $subscriptions |
96 | 96 | ) |
97 | 97 | ) |
98 | - ->then(function (array $subscriptions) use ($topic): iterable { |
|
98 | + ->then(function(array $subscriptions) use ($topic): iterable { |
|
99 | 99 | foreach ($subscriptions as $subscription) { |
100 | - $matchtopic = null === $topic || TopicMatcher::matchesTopicSelectors( |
|
100 | + $matchtopic = null === $topic || TopicMatcher::matchesTopicSelectors( |
|
101 | 101 | $subscription->getTopic(), |
102 | 102 | [$topic] |
103 | 103 | ); |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | array $deniedTopics |
107 | 107 | ): void { |
108 | 108 | $this->hub->hook( |
109 | - function () use ($stream, $path, $subscriber, $topic, $allowedTopics, $deniedTopics) { |
|
109 | + function() use ($stream, $path, $subscriber, $topic, $allowedTopics, $deniedTopics) { |
|
110 | 110 | $this->hub->getLastEventID()->then( |
111 | - function (?string $lastEventId) use ( |
|
111 | + function(?string $lastEventId) use ( |
|
112 | 112 | $topic, |
113 | 113 | $subscriber, |
114 | 114 | $stream, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | ) { |
119 | 119 | $this->hub->getActiveSubscriptions($topic, $subscriber) |
120 | 120 | ->then( |
121 | - function (iterable $subscriptions) use ( |
|
121 | + function(iterable $subscriptions) use ( |
|
122 | 122 | $stream, |
123 | 123 | $path, |
124 | 124 | $allowedTopics, |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $subscriptions = \iterable_to_array($subscriptions); |
159 | 159 | $subscriptions = \array_filter( |
160 | 160 | $subscriptions, |
161 | - function (Subscription $subscription) use ($allowedTopics, $deniedTopics) { |
|
161 | + function(Subscription $subscription) use ($allowedTopics, $deniedTopics) { |
|
162 | 162 | $matchAllowedTopics = TopicMatcher::matchesTopicSelectors( |
163 | 163 | $subscription->getId(), |
164 | 164 | $allowedTopics |