Passed
Pull Request — master (#592)
by Aleksei
12:42
created
src/Queue/tests/Core/QueueInjectorTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
                     'sync' => $this->defaultQueue,
87 87
                     'test' => new TestQueueClass(),
88 88
                 ][$name] ?? null;
89
-            if ($result === null) {
89
+            if ($result === null){
90 90
                 throw new NotFoundException();
91 91
             }
92 92
             return $result;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,8 @@
 block discarded – undo
86 86
                     'sync' => $this->defaultQueue,
87 87
                     'test' => new TestQueueClass(),
88 88
                 ][$name] ?? null;
89
-            if ($result === null) {
89
+            if ($result === null)
90
+            {
90 91
                 throw new NotFoundException();
91 92
             }
92 93
             return $result;
Please login to merge, or discard this patch.
src/Queue/src/QueueManager.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         // Replaces alias with real pipeline name
30 30
         $name = $this->config->getAliases()[$name] ?? $name;
31 31
 
32
-        if (!isset($this->pipelines[$name])) {
32
+        if (!isset($this->pipelines[$name])){
33 33
             $this->pipelines[$name] = $this->resolveConnection($name);
34 34
         }
35 35
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $config = $this->config->getConnection($name);
46 46
 
47
-        try {
47
+        try{
48 48
             return $this->factory->make($config['driver'], $config);
49
-        } catch (ContainerException $e) {
49
+        }catch (ContainerException $e){
50 50
             throw new Exception\NotSupportedDriverException(
51 51
                 \sprintf(
52 52
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
         // Replaces alias with real pipeline name
30 30
         $name = $this->config->getAliases()[$name] ?? $name;
31 31
 
32
-        if (!isset($this->pipelines[$name])) {
32
+        if (!isset($this->pipelines[$name]))
33
+        {
33 34
             $this->pipelines[$name] = $this->resolveConnection($name);
34 35
         }
35 36
 
@@ -44,9 +45,12 @@  discard block
 block discarded – undo
44 45
     {
45 46
         $config = $this->config->getConnection($name);
46 47
 
47
-        try {
48
+        try
49
+        {
48 50
             return $this->factory->make($config['driver'], $config);
49
-        } catch (ContainerException $e) {
51
+        }
52
+        catch (ContainerException $e)
53
+        {
50 54
             throw new Exception\NotSupportedDriverException(
51 55
                 \sprintf(
52 56
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this patch.
src/Queue/src/Core/QueueInjector.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function createInjection(ReflectionClass $class, string $context = null): QueueInterface
27 27
     {
28
-        try {
29
-            if ($context === null) {
28
+        try{
29
+            if ($context === null){
30 30
                 $connection = $this->queueManager->getConnection();
31
-            } else {
31
+            }else{
32 32
                 // Get Queue by context
33
-                try {
33
+                try{
34 34
                     $connection = $this->queueManager->getConnection($context);
35
-                } catch (InvalidArgumentException $e) {
35
+                }catch (InvalidArgumentException $e){
36 36
                     // Case when context doesn't match to configured connections
37 37
                     return $this->queueManager->getConnection();
38 38
                 }
39 39
             }
40 40
 
41 41
             $this->matchType($class, $context, $connection);
42
-        } catch (\Throwable $e) {
42
+        }catch (\Throwable $e){
43 43
             throw new ContainerException(sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
44 44
         }
45 45
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     private function matchType(ReflectionClass $class, string $context, QueueInterface $connection): void
55 55
     {
56 56
         $className = $class->getName();
57
-        if ($className !== QueueInterface::class && !$connection instanceof $className) {
57
+        if ($className !== QueueInterface::class && !$connection instanceof $className){
58 58
             throw new \RuntimeException(
59 59
                 \sprintf(
60 60
                     "The queue obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,21 +25,30 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function createInjection(ReflectionClass $class, string $context = null): QueueInterface
27 27
     {
28
-        try {
29
-            if ($context === null) {
28
+        try
29
+        {
30
+            if ($context === null)
31
+            {
30 32
                 $connection = $this->queueManager->getConnection();
31
-            } else {
33
+            }
34
+            else
35
+            {
32 36
                 // Get Queue by context
33
-                try {
37
+                try
38
+                {
34 39
                     $connection = $this->queueManager->getConnection($context);
35
-                } catch (InvalidArgumentException $e) {
40
+                }
41
+                catch (InvalidArgumentException $e)
42
+                {
36 43
                     // Case when context doesn't match to configured connections
37 44
                     return $this->queueManager->getConnection();
38 45
                 }
39 46
             }
40 47
 
41 48
             $this->matchType($class, $context, $connection);
42
-        } catch (\Throwable $e) {
49
+        }
50
+        catch (\Throwable $e)
51
+        {
43 52
             throw new ContainerException(sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
44 53
         }
45 54
 
@@ -54,7 +63,8 @@  discard block
 block discarded – undo
54 63
     private function matchType(ReflectionClass $class, string $context, QueueInterface $connection): void
55 64
     {
56 65
         $className = $class->getName();
57
-        if ($className !== QueueInterface::class && !$connection instanceof $className) {
66
+        if ($className !== QueueInterface::class && !$connection instanceof $className)
67
+        {
58 68
             throw new \RuntimeException(
59 69
                 \sprintf(
60 70
                     "The queue obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.