Test Failed
Pull Request — master (#39)
by Aleksandr
06:37
created
DependencyInjection/Compiler/ConsumersListCompilerPass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function process(ContainerBuilder $container)
14 14
     {
15 15
         $taggedConsumers = $container->findTaggedServiceIds('old_sound_rabbit_mq.consumer');
16
-        $consumerNames = array_map(fn ($tags) => $tags[0]['consumer'], $taggedConsumers);
16
+        $consumerNames = array_map(fn($tags) => $tags[0]['consumer'], $taggedConsumers);
17 17
         $container->setParameter('old_sound_rabbit_mq.allowed_consumer_names', $consumerNames);
18 18
     }
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
DependencyInjection/Compiler/ExtraContextLoggerCompilerPass.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
         foreach ($taggedProducers as $id => $tags) {
24 24
             $producerName = $tags[0]['producer'];
25
-            $originLogger = $id . '.logger';
25
+            $originLogger = $id.'.logger';
26 26
 
27 27
             if ($container->hasDefinition($originLogger)) {
28 28
                 $consumerDef = $container->getDefinition($id);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
         foreach ($taggedConsumers as $id => $tags) {
36 36
             $consumerName = $tags[0]['consumer'];
37
-            $originLogger = $id . '.logger';
37
+            $originLogger = $id.'.logger';
38 38
 
39 39
             if ($container->hasDefinition($originLogger)) {
40 40
                 $consumerDef = $container->getDefinition($id);
Please login to merge, or discard this patch.
DependencyInjection/OldSoundRabbitMqExtension.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $this->container = $container;
53 53
 
54
-        $loader = new XmlFileLoader($this->container, new FileLocator(array(__DIR__ . '/../Resources/config')));
54
+        $loader = new XmlFileLoader($this->container, new FileLocator(array(__DIR__.'/../Resources/config')));
55 55
         $loader->load('rabbitmq.xml');
56 56
 
57 57
         $configuration = $this->getConfiguration($configs, $container);
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function loadExchanges($exchanges): array
105 105
     {
106
-        return array_map(function ($exchange) {
106
+        return array_map(function($exchange) {
107 107
             $exchangeDeclaration = new Definition(ExchangeDeclaration::class);
108 108
             $exchangeDeclaration->setProperties($exchange);
109 109
 
110
-            foreach($this->loadBindings($exchange['bindings'], $exchange['name'], null) as $binding) {
110
+            foreach ($this->loadBindings($exchange['bindings'], $exchange['name'], null) as $binding) {
111 111
                 $this->container->getDefinition('old_sound_rabbit_mq.declaration_registry')->addMethodCall('addBinding', [$binding]);
112 112
             }
113 113
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     protected function loadQueues($queues): array
123 123
     {
124
-        return array_map(function ($queue, $key) use ($queues) {
124
+        return array_map(function($queue, $key) use ($queues) {
125 125
             $queue['name'] = $queue['name'] ?? $key;
126 126
             $queueDeclaration = new Definition(QueueDeclaration::class);
127 127
             $queueDeclaration->setProperties($queue);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         foreach ($this->config['consumers'] as $consumerName => $consumer) {
257 257
             $alias = sprintf('old_sound_rabbit_mq.consumer.%s', $consumerName);
258
-            $serializerAlias = sprintf('old_sound_rabbit_mq.consumer.%s.serializer', $consumerName);// TODO
258
+            $serializerAlias = sprintf('old_sound_rabbit_mq.consumer.%s.serializer', $consumerName); // TODO
259 259
 
260 260
             $connectionName = $consumer['connection'] ?? 'default';
261 261
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $definition->addTag('old_sound_rabbit_mq.consumer', ['consumer' => $consumerName]);
267 267
             // TODO $this->container->setAlias($serializerAlias, SerializerInterface::class);
268 268
             // $definition->addMethodCall('setSerializer', [new Reference($serializerAlias)]);}
269
-            foreach($consumer['consumeQueues'] as $index => $consumeQueue) {
269
+            foreach ($consumer['consumeQueues'] as $index => $consumeQueue) {
270 270
                 $queueConsumingDef = new Definition(QueueConsuming::class);
271 271
                 $queueConsumingDef->setProperties([
272 272
                     'queueName' => $consumeQueue['queue'],
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         $definition->addTag('monolog.logger', [
432 432
             'channel' => 'phpamqplib'
433 433
         ]);
434
-        $loggerAlias = $definitionAlias . '.loggeer';
434
+        $loggerAlias = $definitionAlias.'.loggeer';
435 435
         $this->container->setAlias($loggerAlias, 'logger');
436 436
         $definition->addMethodCall('setLogger', [new Reference($loggerAlias, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
437 437
     }
Please login to merge, or discard this patch.
RabbitMq/Consumer.php 1 patch
Spacing   +13 added lines, -15 removed lines patch added patch discarded remove patch
@@ -97,19 +97,18 @@  discard block
 block discarded – undo
97 97
 
98 98
     protected function setup(): Consumer
99 99
     {
100
-        foreach($this->queueConsumings as $index => $queueConsuming) {
100
+        foreach ($this->queueConsumings as $index => $queueConsuming) {
101 101
             $this->channel->basic_qos($queueConsuming->qosPrefetchSize, $queueConsuming->qosPrefetchCount, false);
102 102
 
103 103
             $consumerTag = $this->channel->basic_consume(
104 104
                 $queueConsuming->queueName,
105 105
                 $queueConsuming->consumerTag ?
106
-                    $queueConsuming->consumerTag :
107
-                    sprintf("PHPPROCESS_%s_%s_%s", gethostname(), getmypid(), $index),
106
+                    $queueConsuming->consumerTag : sprintf("PHPPROCESS_%s_%s_%s", gethostname(), getmypid(), $index),
108 107
                 $queueConsuming->noLocal,
109 108
                 $queueConsuming->noAck,
110 109
                 $queueConsuming->exclusive,
111 110
                 $queueConsuming->nowait,
112
-                function (AMQPMessage $message) use ($queueConsuming) {
111
+                function(AMQPMessage $message) use ($queueConsuming) {
113 112
                     $this->getExecuteCallbackStrategy($queueConsuming)->consumeCallback($message);
114 113
                 });
115 114
 
@@ -135,12 +134,11 @@  discard block
 block discarded – undo
135 134
         $this->queueConsumings[] = $queueConsuming;
136 135
         if (null === $executeCallbackStrategy) {
137 136
             $executeCallbackStrategy = null === $queueConsuming->batchCount ?
138
-                new SimpleExecuteCallbackStrategy() :
139
-                new BatchExecuteCallbackStrategy($queueConsuming->batchCount);
137
+                new SimpleExecuteCallbackStrategy() : new BatchExecuteCallbackStrategy($queueConsuming->batchCount);
140 138
         }
141 139
 
142 140
         $executeCallbackStrategy->setMessagesProccessor(new FnMessagesProcessor(
143
-            (function (array $messages) use ($queueConsuming) {
141
+            (function(array $messages) use ($queueConsuming) {
144 142
                 $logAmqpContext = ['queue' => $queueConsuming->queueName];
145 143
                 if ($this->getExecuteCallbackStrategy($queueConsuming)->canPrecessMultiMessages()) {
146 144
                     $logAmqpContext['messages'] = $messages;
@@ -183,11 +181,11 @@  discard block
 block discarded – undo
183 181
         $canPrecessMultiMessages = $executeCallbackStrategy->canPrecessMultiMessages();
184 182
         if ($canPrecessMultiMessages) {
185 183
             if (!$queueConsuming->callback instanceof BatchConsumerInterface) {
186
-                throw new \InvalidArgumentException('TODO '. $queueConsuming->queueName);
184
+                throw new \InvalidArgumentException('TODO '.$queueConsuming->queueName);
187 185
             }
188 186
         } else {
189 187
             if (!$queueConsuming->callback instanceof ConsumerInterface) {
190
-                throw new \InvalidArgumentException('TODO '. $queueConsuming->queueName);
188
+                throw new \InvalidArgumentException('TODO '.$queueConsuming->queueName);
191 189
             }
192 190
         }
193 191
 
@@ -247,7 +245,7 @@  discard block
 block discarded – undo
247 245
                     break;
248 246
                 }
249 247
             } catch (AMQPTimeoutException $e) {
250
-                foreach($this->executeCallbackStrategies as $executeCallbackStrategy) {
248
+                foreach ($this->executeCallbackStrategies as $executeCallbackStrategy) {
251 249
                     $executeCallbackStrategy->onCatchTimeout($e);
252 250
                 }
253 251
                 $now = new \DateTime();
@@ -313,7 +311,7 @@  discard block
 block discarded – undo
313 311
 
314 312
         if (!$queueConsuming->noAck) {
315 313
             $messages = array_combine(
316
-                array_map(fn ($message) => $message->getDeliveryTag(), $messages),
314
+                array_map(fn($message) => $message->getDeliveryTag(), $messages),
317 315
                 $messages
318 316
             );
319 317
 
@@ -332,9 +330,9 @@  discard block
 block discarded – undo
332 330
     {
333 331
         $executeCallbackStrategy = $this->getExecuteCallbackStrategy($queueConsuming);
334 332
 
335
-        $ack = !array_search(fn ($reply) => $reply !== null && $reply !== ConsumerInterface::MSG_ACK, $replies, true);
333
+        $ack = !array_search(fn($reply) => $reply !== null && $reply !== ConsumerInterface::MSG_ACK, $replies, true);
336 334
         if ($this->multiAck && count($messages) > 1 && $ack) {
337
-            $channels = array_map(fn ($message) => $message->getChannel(), $messages);
335
+            $channels = array_map(fn($message) => $message->getChannel(), $messages);
338 336
             if (count($channels) !== array_unique($channels)) { // all messages have same channel
339 337
                 throw new InvalidArgumentException('Messages can not be processed as multi ack with different channels');
340 338
             }
@@ -344,7 +342,7 @@  discard block
 block discarded – undo
344 342
             $executeCallbackStrategy->onMessageProcessed($message);
345 343
 
346 344
             return array_combine(
347
-                array_map(fn ($message) => $message->getDeliveryTag(), $messages),
345
+                array_map(fn($message) => $message->getDeliveryTag(), $messages),
348 346
                 array_fill(0, count($messages), ConsumerInterface::MSG_ACK)
349 347
             );
350 348
         } else {
@@ -386,7 +384,7 @@  discard block
 block discarded – undo
386 384
                 'content_type' => 'text/plain',
387 385
                 'correlation_id' => $message->get('correlation_id'),
388 386
             ]);
389
-            $message->getChannel()->basic_publish($replayMessage , '', $message->get('reply_to'));
387
+            $message->getChannel()->basic_publish($replayMessage, '', $message->get('reply_to'));
390 388
         } else {
391 389
             $this->logger->error('Rpc call send msg to queue which have not rpc reponse', [
392 390
                 'amqp' => ['message' => $message]
Please login to merge, or discard this patch.