Passed
Push — 8.x-2.x ( fa02d2...12a886 )
by Zach
13:19
created
src/Controller/ServerPropertiesController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
     try {
28 28
       /** @var \Drupal\rabbitmq\Queue\Queue $backend */
29 29
       $backend = \Drupal::queue('queue.rabbitmq');
30
-    }
31
-    catch (\ErrorException $e) {
30
+    } catch (\ErrorException $e) {
32 31
       $build = [
33 32
         '#markup' => $this->t('<h2>Error</h2><p>Could not access the queue. Check the <a href=":url">status page</a>.</p>', [
34 33
           ':url' => Url::fromRoute('system.status')->toString(),
Please login to merge, or discard this patch.
src/Consumer.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
   public function decode($data) {
145 145
     if (isset($this->decoder)) {
146 146
       return $this->decoder($data);
147
-    }
148
-    else {
147
+    } else {
149 148
       return json_decode($data, TRUE);
150 149
     }
151 150
   }
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
     if ($maxIterations > 0) {
178 177
       $readyMessage = "RabbitMQ worker ready to receive up to @count messages.";
179 178
       $readyArgs = ['@count' => $maxIterations];
180
-    }
181
-    else {
179
+    } else {
182 180
       $readyMessage = "RabbitMQ worker ready to receive an unlimited number of messages.";
183 181
       $readyArgs = [];
184 182
     }
@@ -261,15 +259,12 @@  discard block
 block discarded – undo
261 259
           }
262 260
         }
263 261
         $this->stopListening();
264
-      }
265
-      catch (AMQPIOWaitException $e) {
262
+      } catch (AMQPIOWaitException $e) {
266 263
         $this->stopListening();
267 264
         $channel->close();
268
-      }
269
-      catch (AMQPTimeoutException $e) {
265
+      } catch (AMQPTimeoutException $e) {
270 266
         $this->startListening();
271
-      }
272
-      catch (Exception $e) {
267
+      } catch (Exception $e) {
273 268
         throw new Exception('Could not obtain channel for queue.', 0, $e);
274 269
       }
275 270
     }
@@ -304,8 +299,7 @@  discard block
 block discarded – undo
304 299
     $timeout = $this->getOption(self::OPTION_TIMEOUT);
305 300
     if (!empty($timeout)) {
306 301
       pcntl_signal(SIGALRM, [$this, 'onTimeout']);
307
-    }
308
-    else {
302
+    } else {
309 303
       $timeout = 0;
310 304
     }
311 305
 
@@ -317,8 +311,7 @@  discard block
 block discarded – undo
317 311
         pcntl_alarm($timeout);
318 312
         $item = $queue->claimItem();
319 313
         pcntl_alarm(0);
320
-      }
321
-      else {
314
+      } else {
322 315
         $item = $queue->claimItem();
323 316
       }
324 317
 
@@ -335,8 +328,7 @@  discard block
 block discarded – undo
335 328
         // Only loop if the current continuous wait did not exceed timeout.
336 329
         if ($currentTime > $startTime + $timeout) {
337 330
           break;
338
-        }
339
-        else {
331
+        } else {
340 332
           continue;
341 333
         }
342 334
       }
@@ -427,8 +419,7 @@  discard block
 block discarded – undo
427 419
           '@id' => $item->id,
428 420
           '@queue' => $queueName,
429 421
         ]);
430
-      }
431
-      catch (Exception $e) {
422
+      } catch (Exception $e) {
432 423
         watchdog_exception('rabbitmq', $e);
433 424
         $msg->delivery_info['channel']->basic_reject($msg->delivery_info['delivery_tag'],
434 425
           TRUE);
@@ -563,8 +554,7 @@  discard block
 block discarded – undo
563 554
     if (!extension_loaded(static::EXTENSION_PCNTL)) {
564 555
       $req[$key]['description'] = t('Extension <a href=":ext">PCNTL</a> not present in PHP. Option  %option is not available in the RabbitMQ consumer.', $options);
565 556
       $req[$key]['severity'] = REQUIREMENT_WARNING;
566
-    }
567
-    else {
557
+    } else {
568 558
       $req[$key]['description'] = t('Extension <a href=":ext">PCNTL</a> is present in PHP. Option   %option is available in the RabbitMQ consumer.', $options);
569 559
       $req[$key]['severity'] = REQUIREMENT_OK;
570 560
     }
Please login to merge, or discard this patch.
rabbitmq.drush.inc 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -116,14 +116,11 @@
 block discarded – undo
116 116
   try {
117 117
     $consumer->logStart();
118 118
     $consumer->consumeQueueApi($queueName);
119
-  }
120
-  catch (InvalidWorkerException $e) {
119
+  } catch (InvalidWorkerException $e) {
121 120
     return drush_set_error(dt("Worker for queue @name does not implement the worker interface.", $queueArgs));
122
-  }
123
-  catch (RabbitMqInvalidArgumentException $e) {
121
+  } catch (RabbitMqInvalidArgumentException $e) {
124 122
     return drush_set_error($e->getMessage());
125
-  }
126
-  catch (RabbitMqException $e) {
123
+  } catch (RabbitMqException $e) {
127 124
     return drush_set_error(dt("Could not obtain channel for queue.", $queueArgs));
128 125
   }
129 126
 
Please login to merge, or discard this patch.
src/ConnectionFactory.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@
 block discarded – undo
74 74
           $credentials['ssl'],
75 75
           $credentials['options']
76 76
         );
77
-      }
78
-      else {
77
+      } else {
79 78
         $defaultOptions = [
80 79
           'insist' => FALSE,
81 80
           'login_method' => 'AMQPLAIN',
Please login to merge, or discard this patch.
src/Queue/QueueBase.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,8 +172,7 @@
 block discarded – undo
172 172
           $options['arguments'] ?? NULL,
173 173
           $options['ticket'] ?? NULL
174 174
         );
175
-      }
176
-      catch (AMQPProtocolChannelException $e) {
175
+      } catch (AMQPProtocolChannelException $e) {
177 176
         return NULL;
178 177
       }
179 178
 
Please login to merge, or discard this patch.
src/Queue/Queue.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
       $channel->basic_publish($item, $exchange, $routingKey);
50 50
       $this->logger->debug('Item sent to queue %queue', $loggerArgs);
51 51
       $result = TRUE;
52
-    }
53
-    catch (\Exception $e) {
52
+    } catch (\Exception $e) {
54 53
       $this->logger->error('Failed to send item to queue %queue: @message', $loggerArgs + [
55 54
         '@message' => $e->getMessage(),
56 55
       ]);
Please login to merge, or discard this patch.