Passed
Pull Request — master (#592)
by Aleksei
06:09
created
src/Queue/src/Config/QueueConfig.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getDefaultDriver(): string
34 34
     {
35
-        if (!isset($this->config['default']) || empty($this->config['default'])) {
35
+        if (!isset($this->config['default']) || empty($this->config['default'])){
36 36
             throw new InvalidArgumentException('Default queue connection is not defined.');
37 37
         }
38 38
 
39
-        if (!\is_string($this->config['default'])) {
39
+        if (!\is_string($this->config['default'])){
40 40
             throw new InvalidArgumentException('Default queue connection config value must be a string');
41 41
         }
42 42
 
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $connections = $this->config['connections'] ?? [];
60 60
 
61
-        if ($driver === null) {
61
+        if ($driver === null){
62 62
             return $connections;
63 63
         }
64 64
 
65 65
         $driverAliases = $this->getDriverAliases();
66 66
 
67
-        if (isset($driverAliases[$driver])) {
68
-            if (!\is_string($this->config['driverAliases'][$driver])) {
67
+        if (isset($driverAliases[$driver])){
68
+            if (!\is_string($this->config['driverAliases'][$driver])){
69 69
                 throw new InvalidArgumentException(
70 70
                     sprintf('Driver alias for `%s` value must be a string', $driver)
71 71
                 );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         }
76 76
 
77 77
         return array_filter($connections, static function (array $connection) use ($driverAliases, $driver): bool {
78
-            if (empty($connection['driver'])) {
78
+            if (empty($connection['driver'])){
79 79
                 return false;
80 80
             }
81 81
 
@@ -93,28 +93,28 @@  discard block
 block discarded – undo
93 93
     {
94 94
         $connections = $this->getConnections();
95 95
 
96
-        if (!isset($connections[$name])) {
96
+        if (!isset($connections[$name])){
97 97
             throw new InvalidArgumentException(sprintf('Queue connection with given name `%s` is not defined.', $name));
98 98
         }
99 99
 
100
-        if (!isset($connections[$name]['driver'])) {
100
+        if (!isset($connections[$name]['driver'])){
101 101
             throw new InvalidArgumentException(sprintf('Driver for queue connection `%s` is not defined.', $name));
102 102
         }
103 103
 
104 104
         $connection = $connections[$name];
105 105
         $driver = $connection['driver'];
106 106
 
107
-        if (!\is_string($driver)) {
107
+        if (!\is_string($driver)){
108 108
             throw new InvalidArgumentException(
109 109
                 sprintf('Driver for queue connection `%s` value must be a string', $name)
110 110
             );
111 111
         }
112 112
 
113
-        if (isset($this->config['driverAliases'][$driver])) {
113
+        if (isset($this->config['driverAliases'][$driver])){
114 114
             $connection['driver'] = $this->config['driverAliases'][$driver];
115 115
         }
116 116
 
117
-        if (!\is_string($connection['driver'])) {
117
+        if (!\is_string($connection['driver'])){
118 118
             throw new InvalidArgumentException(
119 119
                 sprintf('Driver alias for queue connection `%s` value must be a string', $name)
120 120
             );
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,11 +32,13 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getDefaultDriver(): string
34 34
     {
35
-        if (!isset($this->config['default']) || empty($this->config['default'])) {
35
+        if (!isset($this->config['default']) || empty($this->config['default']))
36
+        {
36 37
             throw new InvalidArgumentException('Default queue connection is not defined.');
37 38
         }
38 39
 
39
-        if (!\is_string($this->config['default'])) {
40
+        if (!\is_string($this->config['default']))
41
+        {
40 42
             throw new InvalidArgumentException('Default queue connection config value must be a string');
41 43
         }
42 44
 
@@ -58,14 +60,17 @@  discard block
 block discarded – undo
58 60
     {
59 61
         $connections = $this->config['connections'] ?? [];
60 62
 
61
-        if ($driver === null) {
63
+        if ($driver === null)
64
+        {
62 65
             return $connections;
63 66
         }
64 67
 
65 68
         $driverAliases = $this->getDriverAliases();
66 69
 
67
-        if (isset($driverAliases[$driver])) {
68
-            if (!\is_string($this->config['driverAliases'][$driver])) {
70
+        if (isset($driverAliases[$driver]))
71
+        {
72
+            if (!\is_string($this->config['driverAliases'][$driver]))
73
+            {
69 74
                 throw new InvalidArgumentException(
70 75
                     sprintf('Driver alias for `%s` value must be a string', $driver)
71 76
                 );
@@ -75,7 +80,8 @@  discard block
 block discarded – undo
75 80
         }
76 81
 
77 82
         return array_filter($connections, static function (array $connection) use ($driverAliases, $driver): bool {
78
-            if (empty($connection['driver'])) {
83
+            if (empty($connection['driver']))
84
+            {
79 85
                 return false;
80 86
             }
81 87
 
@@ -93,28 +99,33 @@  discard block
 block discarded – undo
93 99
     {
94 100
         $connections = $this->getConnections();
95 101
 
96
-        if (!isset($connections[$name])) {
102
+        if (!isset($connections[$name]))
103
+        {
97 104
             throw new InvalidArgumentException(sprintf('Queue connection with given name `%s` is not defined.', $name));
98 105
         }
99 106
 
100
-        if (!isset($connections[$name]['driver'])) {
107
+        if (!isset($connections[$name]['driver']))
108
+        {
101 109
             throw new InvalidArgumentException(sprintf('Driver for queue connection `%s` is not defined.', $name));
102 110
         }
103 111
 
104 112
         $connection = $connections[$name];
105 113
         $driver = $connection['driver'];
106 114
 
107
-        if (!\is_string($driver)) {
115
+        if (!\is_string($driver))
116
+        {
108 117
             throw new InvalidArgumentException(
109 118
                 sprintf('Driver for queue connection `%s` value must be a string', $name)
110 119
             );
111 120
         }
112 121
 
113
-        if (isset($this->config['driverAliases'][$driver])) {
122
+        if (isset($this->config['driverAliases'][$driver]))
123
+        {
114 124
             $connection['driver'] = $this->config['driverAliases'][$driver];
115 125
         }
116 126
 
117
-        if (!\is_string($connection['driver'])) {
127
+        if (!\is_string($connection['driver']))
128
+        {
118 129
             throw new InvalidArgumentException(
119 130
                 sprintf('Driver alias for queue connection `%s` value must be a string', $name)
120 131
             );
Please login to merge, or discard this patch.
src/Queue/src/Bootloader/QueueBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $registry = $container->get(HandlerRegistryInterface::class);
58 58
             $config = $container->get(QueueConfig::class);
59 59
 
60
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
60
+            foreach ($config->getRegistryHandlers() as $jobType => $handler){
61 61
                 $registry->setHandler($jobType, $handler);
62 62
             }
63 63
         });
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     private function registerJobsSerializer(Container $container): void
85 85
     {
86
-        $container->bindSingleton(SerializerInterface::class, static function () {
86
+        $container->bindSingleton(SerializerInterface::class, static function (){
87 87
             return new DefaultSerializer();
88 88
         });
89 89
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@  discard block
 block discarded – undo
57 57
             $registry = $container->get(HandlerRegistryInterface::class);
58 58
             $config = $container->get(QueueConfig::class);
59 59
 
60
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
60
+            foreach ($config->getRegistryHandlers() as $jobType => $handler)
61
+            {
61 62
                 $registry->setHandler($jobType, $handler);
62 63
             }
63 64
         });
@@ -83,7 +84,8 @@  discard block
 block discarded – undo
83 84
 
84 85
     private function registerJobsSerializer(Container $container): void
85 86
     {
86
-        $container->bindSingleton(SerializerInterface::class, static function () {
87
+        $container->bindSingleton(SerializerInterface::class, static function ()
88
+        {
87 89
             return new DefaultSerializer();
88 90
         });
89 91
     }
Please login to merge, or discard this patch.
src/Queue/src/DefaultSerializer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function serialize(array $payload): string
18 18
     {
19
-        try {
19
+        try{
20 20
             return \Opis\Closure\serialize($payload);
21
-        } catch (\Throwable $e) {
21
+        }catch (\Throwable $e){
22 22
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
23 23
         }
24 24
     }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function deserialize(string $payload): array
30 30
     {
31
-        try {
31
+        try{
32 32
             return (array)\Opis\Closure\unserialize($payload);
33
-        } catch (\Throwable $e) {
33
+        }catch (\Throwable $e){
34 34
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
35 35
         }
36 36
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,9 +16,12 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function serialize(array $payload): string
18 18
     {
19
-        try {
19
+        try
20
+        {
20 21
             return \Opis\Closure\serialize($payload);
21
-        } catch (\Throwable $e) {
22
+        }
23
+        catch (\Throwable $e)
24
+        {
22 25
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
23 26
         }
24 27
     }
@@ -28,9 +31,12 @@  discard block
 block discarded – undo
28 31
      */
29 32
     public function deserialize(string $payload): array
30 33
     {
31
-        try {
34
+        try
35
+        {
32 36
             return (array)\Opis\Closure\unserialize($payload);
33
-        } catch (\Throwable $e) {
37
+        }
38
+        catch (\Throwable $e)
39
+        {
34 40
             throw new SerializationException($e->getMessage(), (int)$e->getCode(), $e);
35 41
         }
36 42
     }
Please login to merge, or discard this patch.
src/Queue/src/QueueRegistry.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     public function __construct(
19 19
         ContainerInterface $container,
20 20
         HandlerRegistryInterface $handlers
21
-    ) {
21
+    ){
22 22
         $this->container = $container;
23 23
         $this->fallbackHandlers = $handlers;
24 24
     }
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function getHandler(string $jobType): HandlerInterface
39 39
     {
40
-        if (isset($this->handlers[$jobType])) {
41
-            if ($this->handlers[$jobType] instanceof HandlerInterface) {
40
+        if (isset($this->handlers[$jobType])){
41
+            if ($this->handlers[$jobType] instanceof HandlerInterface){
42 42
                 return $this->handlers[$jobType];
43 43
             }
44 44
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,10 @@
 block discarded – undo
37 37
      */
38 38
     public function getHandler(string $jobType): HandlerInterface
39 39
     {
40
-        if (isset($this->handlers[$jobType])) {
41
-            if ($this->handlers[$jobType] instanceof HandlerInterface) {
40
+        if (isset($this->handlers[$jobType]))
41
+        {
42
+            if ($this->handlers[$jobType] instanceof HandlerInterface)
43
+            {
42 44
                 return $this->handlers[$jobType];
43 45
             }
44 46
 
Please login to merge, or discard this patch.
src/Queue/tests/Driver/SyncDriverTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
             $handler = m::mock(HandlerInterface::class)
68 68
         );
69 69
 
70
-        $callback = function () {
70
+        $callback = function (){
71 71
             return 'bar';
72 72
         };
73 73
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
             $handler = m::mock(HandlerInterface::class)
68 68
         );
69 69
 
70
-        $callback = function () {
70
+        $callback = function ()
71
+        {
71 72
             return 'bar';
72 73
         };
73 74
 
Please login to merge, or discard this patch.
src/Queue/tests/DefaultSerializerTest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
             'string' => 'foo',
32 32
             'array' => ['foo'],
33 33
             'object' => $object,
34
-            'closure' => function () use ($object) {
34
+            'closure' => function () use ($object)
35
+            {
35 36
                 return $object;
36 37
             },
37 38
         ]);
Please login to merge, or discard this patch.
src/Queue/tests/Job/ObjectJobTest.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function testHandleWithHandleMethod(): void
43 43
     {
44
-        $object = new class($this) {
44
+        $object = new class($this)
45
+        {
45 46
             private $testCase;
46 47
 
47 48
             public function __construct($testCase)
@@ -64,7 +65,8 @@  discard block
 block discarded – undo
64 65
 
65 66
     public function testHandleWithInvokeMethod(): void
66 67
     {
67
-        $object = new class($this) {
68
+        $object = new class($this)
69
+        {
68 70
             private $testCase;
69 71
 
70 72
             public function __construct($testCase)
Please login to merge, or discard this patch.
src/Boot/src/Directories.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function __construct(array $directories)
25 25
     {
26
-        foreach ($directories as $name => $directory) {
26
+        foreach ($directories as $name => $directory){
27 27
             $this->set($name, $directory);
28 28
         }
29 29
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function set(string $name, string $path): DirectoriesInterface
43 43
     {
44 44
         $path = str_replace(['\\', '//'], '/', $path);
45
-        $this->directories[$name] = rtrim($path, '/') . '/';
45
+        $this->directories[$name] = rtrim($path, '/').'/';
46 46
 
47 47
         return $this;
48 48
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function get(string $name): string
54 54
     {
55
-        if (!$this->has($name)) {
55
+        if (!$this->has($name)){
56 56
             throw new DirectoryException("Undefined directory '{$name}'");
57 57
         }
58 58
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function __construct(array $directories)
25 25
     {
26
-        foreach ($directories as $name => $directory) {
26
+        foreach ($directories as $name => $directory)
27
+        {
27 28
             $this->set($name, $directory);
28 29
         }
29 30
     }
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
      */
53 54
     public function get(string $name): string
54 55
     {
55
-        if (!$this->has($name)) {
56
+        if (!$this->has($name))
57
+        {
56 58
             throw new DirectoryException("Undefined directory '{$name}'");
57 59
         }
58 60
 
Please login to merge, or discard this patch.
src/Boot/tests/Fixtures/ConfigBootloader.php 1 patch
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,22 +18,27 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function boot(Container $container, AbstractKernel $kernel): void
20 20
     {
21
-        $kernel->starting(static function (AbstractKernel $kernel) use ($container) {
21
+        $kernel->starting(static function (AbstractKernel $kernel) use ($container)
22
+        {
22 23
             $container->bind('hij', 'foo');
23 24
 
24
-            $kernel->starting(static function () use ($container) {
25
+            $kernel->starting(static function () use ($container)
26
+            {
25 27
                 $container->bind('ijk', 'foo');
26 28
             });
27 29
         });
28 30
 
29
-        $kernel->started(function (AbstractKernel $kernel) use ($container) {
31
+        $kernel->started(function (AbstractKernel $kernel) use ($container)
32
+        {
30 33
             $container->bind('jkl', 'foo');
31 34
 
32
-            $kernel->starting(function () use ($container) {
35
+            $kernel->starting(function () use ($container)
36
+            {
33 37
                 $container->bind('klm', 'foo');
34 38
             });
35 39
 
36
-            $kernel->started(function () use ($container) {
40
+            $kernel->started(function () use ($container)
41
+            {
37 42
                 $container->bind('lmn', 'foo');
38 43
             });
39 44
         });
@@ -44,11 +49,13 @@  discard block
 block discarded – undo
44 49
     public function start(ConfigurationBootloader $configuration, AbstractKernel $kernel, Container $container): void
45 50
     {
46 51
         // won't be executed
47
-        $kernel->starting(function (AbstractKernel $kernel) use ($container) {
52
+        $kernel->starting(function (AbstractKernel $kernel) use ($container)
53
+        {
48 54
             $container->bind('ghi', 'foo');
49 55
         });
50 56
 
51
-        $kernel->started(function (AbstractKernel $kernel) use ($container) {
57
+        $kernel->started(function (AbstractKernel $kernel) use ($container)
58
+        {
52 59
             $container->bind('mno', 'foo');
53 60
         });
54 61
 
Please login to merge, or discard this patch.