Passed
Pull Request — master (#817)
by Aleksei
10:25 queued 04:19
created
src/Queue/src/Failed/LogFailedJobHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 {
11 11
     public function __construct(
12 12
         private readonly ExceptionReporterInterface $reporter
13
-    ) {
13
+    ){
14 14
     }
15 15
 
16 16
     public function handle(string $driver, string $queue, string $job, array $payload, \Throwable $e): void
Please login to merge, or discard this patch.
src/Queue/src/ContainerRegistry.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@
 block discarded – undo
16 16
 
17 17
     public function __construct(
18 18
         private readonly ContainerInterface $container
19
-    ) {
19
+    ){
20 20
         $this->inflector = (new InflectorFactory())->build();
21 21
     }
22 22
 
23 23
     public function getHandler(string $jobType): HandlerInterface
24 24
     {
25
-        try {
25
+        try{
26 26
             $handler = $this->container->get($this->className($jobType));
27
-        } catch (ContainerException $e) {
27
+        }catch (ContainerException $e){
28 28
             throw new JobException($e->getMessage(), $e->getCode(), $e);
29 29
         }
30 30
 
31
-        if (!$handler instanceof HandlerInterface) {
31
+        if (!$handler instanceof HandlerInterface){
32 32
             throw new JobException(\sprintf('Unable to resolve job handler for `%s`', $jobType));
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,17 @@
 block discarded – undo
22 22
 
23 23
     public function getHandler(string $jobType): HandlerInterface
24 24
     {
25
-        try {
25
+        try
26
+        {
26 27
             $handler = $this->container->get($this->className($jobType));
27
-        } catch (ContainerException $e) {
28
+        }
29
+        catch (ContainerException $e)
30
+        {
28 31
             throw new JobException($e->getMessage(), $e->getCode(), $e);
29 32
         }
30 33
 
31
-        if (!$handler instanceof HandlerInterface) {
34
+        if (!$handler instanceof HandlerInterface)
35
+        {
32 36
             throw new JobException(\sprintf('Unable to resolve job handler for `%s`', $jobType));
33 37
         }
34 38
 
Please login to merge, or discard this patch.
src/Queue/src/Core/QueueInjector.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,26 +18,26 @@  discard block
 block discarded – undo
18 18
 {
19 19
     public function __construct(
20 20
         private readonly QueueConnectionProviderInterface $queueManager
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     public function createInjection(ReflectionClass $class, string $context = null): QueueInterface
25 25
     {
26
-        try {
27
-            if ($context === null) {
26
+        try{
27
+            if ($context === null){
28 28
                 $connection = $this->queueManager->getConnection();
29
-            } else {
29
+            }else{
30 30
                 // Get Queue by context
31
-                try {
31
+                try{
32 32
                     $connection = $this->queueManager->getConnection($context);
33
-                } catch (InvalidArgumentException) {
33
+                }catch (InvalidArgumentException){
34 34
                     // Case when context doesn't match to configured connections
35 35
                     return $this->queueManager->getConnection();
36 36
                 }
37 37
             }
38 38
 
39 39
             $this->matchType($class, $context, $connection);
40
-        } catch (\Throwable $e) {
40
+        }catch (\Throwable $e){
41 41
             throw new ContainerException(\sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
42 42
         }
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     private function matchType(ReflectionClass $class, ?string $context, QueueInterface $connection): void
53 53
     {
54 54
         $className = $class->getName();
55
-        if ($className !== QueueInterface::class && !$connection instanceof $className) {
55
+        if ($className !== QueueInterface::class && !$connection instanceof $className){
56 56
             throw new \RuntimeException(
57 57
                 \sprintf(
58 58
                     "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
@@ -23,21 +23,30 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function createInjection(ReflectionClass $class, string $context = null): QueueInterface
25 25
     {
26
-        try {
27
-            if ($context === null) {
26
+        try
27
+        {
28
+            if ($context === null)
29
+            {
28 30
                 $connection = $this->queueManager->getConnection();
29
-            } else {
31
+            }
32
+            else
33
+            {
30 34
                 // Get Queue by context
31
-                try {
35
+                try
36
+                {
32 37
                     $connection = $this->queueManager->getConnection($context);
33
-                } catch (InvalidArgumentException) {
38
+                }
39
+                catch (InvalidArgumentException)
40
+                {
34 41
                     // Case when context doesn't match to configured connections
35 42
                     return $this->queueManager->getConnection();
36 43
                 }
37 44
             }
38 45
 
39 46
             $this->matchType($class, $context, $connection);
40
-        } catch (\Throwable $e) {
47
+        }
48
+        catch (\Throwable $e)
49
+        {
41 50
             throw new ContainerException(\sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
42 51
         }
43 52
 
@@ -52,7 +61,8 @@  discard block
 block discarded – undo
52 61
     private function matchType(ReflectionClass $class, ?string $context, QueueInterface $connection): void
53 62
     {
54 63
         $className = $class->getName();
55
-        if ($className !== QueueInterface::class && !$connection instanceof $className) {
64
+        if ($className !== QueueInterface::class && !$connection instanceof $className)
65
+        {
56 66
             throw new \RuntimeException(
57 67
                 \sprintf(
58 68
                     "The queue obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.
src/Queue/src/Driver/SyncDriver.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
 
20 20
     public function __construct(
21 21
         private readonly Handler $coreHandler
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     /** @inheritdoc */
26 26
     public function push(string $name, array $payload = [], OptionsInterface $options = null): string
27 27
     {
28
-        if ($options !== null && $options->getDelay()) {
28
+        if ($options !== null && $options->getDelay()){
29 29
             \sleep($options->getDelay());
30 30
         }
31 31
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
     /** @inheritdoc */
26 26
     public function push(string $name, array $payload = [], OptionsInterface $options = null): string
27 27
     {
28
-        if ($options !== null && $options->getDelay()) {
28
+        if ($options !== null && $options->getDelay())
29
+        {
29 30
             \sleep($options->getDelay());
30 31
         }
31 32
 
Please login to merge, or discard this patch.
src/Queue/src/Bootloader/QueueBootloader.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function __construct(
52 52
         private readonly ConfiguratorInterface $config
53
-    ) {
53
+    ){
54 54
     }
55 55
 
56 56
     public function init(
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
             $registry = $container->get(QueueRegistry::class);
69 69
             $config = $container->get(QueueConfig::class);
70 70
 
71
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
71
+            foreach ($config->getRegistryHandlers() as $jobType => $handler){
72 72
                 $registry->setHandler($jobType, $handler);
73 73
             }
74 74
 
75
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
75
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer){
76 76
                 $registry->setSerializer($jobType, $serializer);
77 77
             }
78 78
         });
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
83 83
      */
84
-    public function addConsumeInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
84
+    public function addConsumeInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
85 85
     {
86 86
         $this->config->modify(
87 87
             QueueConfig::CONFIG,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     /**
93 93
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
94 94
      */
95
-    public function addPushInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
95
+    public function addPushInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
96 96
     {
97 97
         $this->config->modify(
98 98
             QueueConfig::CONFIG,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         ContainerInterface $container,
118 118
         FactoryInterface $factory,
119 119
         ContainerRegistry $registry
120
-    ) {
120
+    ){
121 121
         return new QueueRegistry($container, $factory, $registry);
122 122
     }
123 123
 
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
     ): Handler {
131 131
         $core = new InterceptableCore($core, $dispatcher);
132 132
 
133
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
134
-            if (\is_string($interceptor)) {
133
+        foreach ($config->getConsumeInterceptors() as $interceptor){
134
+            if (\is_string($interceptor)){
135 135
                 $interceptor = $container->get($interceptor);
136
-            } elseif ($interceptor instanceof Autowire) {
136
+            } elseif ($interceptor instanceof Autowire){
137 137
                 $interceptor = $interceptor->resolve($factory);
138 138
             }
139 139
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
     ): Queue {
153 153
         $core = new InterceptableCore(new PushCore($manager->getConnection()), $dispatcher);
154 154
 
155
-        foreach ($config->getPushInterceptors() as $interceptor) {
156
-            if (\is_string($interceptor) || $interceptor instanceof Autowire) {
155
+        foreach ($config->getPushInterceptors() as $interceptor){
156
+            if (\is_string($interceptor) || $interceptor instanceof Autowire){
157 157
                 $interceptor = $container->get($interceptor);
158 158
             }
159 159
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,11 +68,13 @@  discard block
 block discarded – undo
68 68
             $registry = $container->get(QueueRegistry::class);
69 69
             $config = $container->get(QueueConfig::class);
70 70
 
71
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
71
+            foreach ($config->getRegistryHandlers() as $jobType => $handler)
72
+            {
72 73
                 $registry->setHandler($jobType, $handler);
73 74
             }
74 75
 
75
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
76
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer)
77
+            {
76 78
                 $registry->setSerializer($jobType, $serializer);
77 79
             }
78 80
         });
@@ -130,10 +132,14 @@  discard block
 block discarded – undo
130 132
     ): Handler {
131 133
         $core = new InterceptableCore($core, $dispatcher);
132 134
 
133
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
134
-            if (\is_string($interceptor)) {
135
+        foreach ($config->getConsumeInterceptors() as $interceptor)
136
+        {
137
+            if (\is_string($interceptor))
138
+            {
135 139
                 $interceptor = $container->get($interceptor);
136
-            } elseif ($interceptor instanceof Autowire) {
140
+            }
141
+            elseif ($interceptor instanceof Autowire)
142
+            {
137 143
                 $interceptor = $interceptor->resolve($factory);
138 144
             }
139 145
 
@@ -152,8 +158,10 @@  discard block
 block discarded – undo
152 158
     ): Queue {
153 159
         $core = new InterceptableCore(new PushCore($manager->getConnection()), $dispatcher);
154 160
 
155
-        foreach ($config->getPushInterceptors() as $interceptor) {
156
-            if (\is_string($interceptor) || $interceptor instanceof Autowire) {
161
+        foreach ($config->getPushInterceptors() as $interceptor)
162
+        {
163
+            if (\is_string($interceptor) || $interceptor instanceof Autowire)
164
+            {
157 165
                 $interceptor = $container->get($interceptor);
158 166
             }
159 167
 
Please login to merge, or discard this patch.
src/Queue/src/Interceptor/Consume/Core.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function __construct(
24 24
         private readonly HandlerRegistryInterface $registry,
25 25
         private readonly ?EventDispatcherInterface $dispatcher = null
26
-    ) {
26
+    ){
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
src/Queue/src/Interceptor/Consume/ErrorHandlerInterceptor.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@
 block discarded – undo
13 13
 {
14 14
     public function __construct(
15 15
         private readonly FailedJobHandlerInterface $handler
16
-    ) {
16
+    ){
17 17
     }
18 18
 
19 19
     /** @psalm-suppress ParamNameMismatch */
20 20
     public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed
21 21
     {
22
-        try {
22
+        try{
23 23
             return $core->callAction($name, $action, $parameters);
24
-        } catch (\Throwable $e) {
25
-            if (!$e instanceof StateException) {
24
+        }catch (\Throwable $e){
25
+            if (!$e instanceof StateException){
26 26
                 $this->handler->handle(
27 27
                     $parameters['driver'],
28 28
                     $parameters['queue'],
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,14 @@
 block discarded – undo
19 19
     /** @psalm-suppress ParamNameMismatch */
20 20
     public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed
21 21
     {
22
-        try {
22
+        try
23
+        {
23 24
             return $core->callAction($name, $action, $parameters);
24
-        } catch (\Throwable $e) {
25
-            if (!$e instanceof StateException) {
25
+        }
26
+        catch (\Throwable $e)
27
+        {
28
+            if (!$e instanceof StateException)
29
+            {
26 30
                 $this->handler->handle(
27 31
                     $parameters['driver'],
28 32
                     $parameters['queue'],
Please login to merge, or discard this patch.
src/Queue/src/Interceptor/Push/Core.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 {
16 16
     public function __construct(
17 17
         private readonly QueueInterface $connection
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     /**
Please login to merge, or discard this patch.
src/Queue/src/Queue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 {
11 11
     public function __construct(
12 12
         private readonly CoreInterface $core
13
-    ) {
13
+    ){
14 14
     }
15 15
 
16 16
     /**
Please login to merge, or discard this patch.