@@ -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 | ); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $stream = new ThroughStream(); |
| 61 | 61 | $this->hub->hook( |
| 62 | - function () use ($stream, $path, $subscriber, $topic, $allowedTopics, $deniedTopics) { |
|
| 62 | + function() use ($stream, $path, $subscriber, $topic, $allowedTopics, $deniedTopics) { |
|
| 63 | 63 | $this->hub->getLastEventID()->then( |
| 64 | - function (?string $lastEventId) use ( |
|
| 64 | + function(?string $lastEventId) use ( |
|
| 65 | 65 | $topic, |
| 66 | 66 | $subscriber, |
| 67 | 67 | $stream, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ) { |
| 72 | 72 | $this->hub->getActiveSubscriptions($topic, $subscriber) |
| 73 | 73 | ->then( |
| 74 | - function (iterable $subscriptions) use ( |
|
| 74 | + function(iterable $subscriptions) use ( |
|
| 75 | 75 | $stream, |
| 76 | 76 | $path, |
| 77 | 77 | $allowedTopics, |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $subscriptions = \iterable_to_array($subscriptions); |
| 109 | 109 | $subscriptions = \array_filter( |
| 110 | 110 | $subscriptions, |
| 111 | - function (Subscription $subscription) use ($allowedTopics, $deniedTopics) { |
|
| 111 | + function(Subscription $subscription) use ($allowedTopics, $deniedTopics) { |
|
| 112 | 112 | $matchAllowedTopics = TopicMatcher::matchesTopicSelectors( |
| 113 | 113 | $subscription->getId(), |
| 114 | 114 | $allowedTopics |