Passed
Pull Request — master (#1087)
by Maxim
22:51
created
src/Queue/src/QueueManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         private readonly ContainerInterface $container,
25 25
         private readonly FactoryInterface $factory,
26 26
         private readonly ?EventDispatcherInterface $dispatcher = null
27
-    ) {
27
+    ){
28 28
     }
29 29
 
30 30
     public function getConnection(?string $name = null): QueueInterface
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         // Replaces alias with real pipeline name
34 34
         $name = $this->config->getAliases()[$name] ?? $name;
35 35
 
36
-        if (!isset($this->pipelines[$name])) {
36
+        if (!isset($this->pipelines[$name])){
37 37
             $this->pipelines[$name] = $this->resolveConnection($name);
38 38
         }
39 39
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $config = $this->config->getConnection($name);
50 50
 
51
-        try {
51
+        try{
52 52
             $driver = $this->factory->make($config['driver'], $config);
53 53
 
54 54
             $core = new InterceptableCore(
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
                 $this->dispatcher
57 57
             );
58 58
 
59
-            foreach ($this->config->getPushInterceptors() as $interceptor) {
60
-                if (\is_string($interceptor) || $interceptor instanceof Autowire) {
59
+            foreach ($this->config->getPushInterceptors() as $interceptor){
60
+                if (\is_string($interceptor) || $interceptor instanceof Autowire){
61 61
                     $interceptor = $this->container->get($interceptor);
62 62
                 }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             }
67 67
 
68 68
             return new Queue($core);
69
-        } catch (ContainerException $e) {
69
+        }catch (ContainerException $e){
70 70
             throw new Exception\NotSupportedDriverException(
71 71
                 \sprintf(
72 72
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
         // Replaces alias with real pipeline name
34 34
         $name = $this->config->getAliases()[$name] ?? $name;
35 35
 
36
-        if (!isset($this->pipelines[$name])) {
36
+        if (!isset($this->pipelines[$name]))
37
+        {
37 38
             $this->pipelines[$name] = $this->resolveConnection($name);
38 39
         }
39 40
 
@@ -48,7 +49,8 @@  discard block
 block discarded – undo
48 49
     {
49 50
         $config = $this->config->getConnection($name);
50 51
 
51
-        try {
52
+        try
53
+        {
52 54
             $driver = $this->factory->make($config['driver'], $config);
53 55
 
54 56
             $core = new InterceptableCore(
@@ -56,8 +58,10 @@  discard block
 block discarded – undo
56 58
                 $this->dispatcher
57 59
             );
58 60
 
59
-            foreach ($this->config->getPushInterceptors() as $interceptor) {
60
-                if (\is_string($interceptor) || $interceptor instanceof Autowire) {
61
+            foreach ($this->config->getPushInterceptors() as $interceptor)
62
+            {
63
+                if (\is_string($interceptor) || $interceptor instanceof Autowire)
64
+                {
61 65
                     $interceptor = $this->container->get($interceptor);
62 66
                 }
63 67
 
@@ -66,7 +70,9 @@  discard block
 block discarded – undo
66 70
             }
67 71
 
68 72
             return new Queue($core);
69
-        } catch (ContainerException $e) {
73
+        }
74
+        catch (ContainerException $e)
75
+        {
70 76
             throw new Exception\NotSupportedDriverException(
71 77
                 \sprintf(
72 78
                     'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`',
Please login to merge, or discard this patch.
src/Queue/src/Bootloader/QueueBootloader.php 2 patches
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,11 +66,13 @@  discard block
 block discarded – undo
66 66
             $registry = $container->get(QueueRegistry::class);
67 67
             $config = $container->get(QueueConfig::class);
68 68
 
69
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
69
+            foreach ($config->getRegistryHandlers() as $jobType => $handler)
70
+            {
70 71
                 $registry->setHandler($jobType, $handler);
71 72
             }
72 73
 
73
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
74
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer)
75
+            {
74 76
                 $registry->setSerializer($jobType, $serializer);
75 77
             }
76 78
         });
@@ -128,10 +130,14 @@  discard block
 block discarded – undo
128 130
     ): Handler {
129 131
         $core = new InterceptableCore($core, $dispatcher);
130 132
 
131
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
132
-            if (\is_string($interceptor)) {
133
+        foreach ($config->getConsumeInterceptors() as $interceptor)
134
+        {
135
+            if (\is_string($interceptor))
136
+            {
133 137
                 $interceptor = $container->get($interceptor);
134
-            } elseif ($interceptor instanceof Autowire) {
138
+            }
139
+            elseif ($interceptor instanceof Autowire)
140
+            {
135 141
                 $interceptor = $interceptor->resolve($factory);
136 142
             }
137 143
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function __construct(
49 49
         private readonly ConfiguratorInterface $config,
50
-    ) {
50
+    ){
51 51
     }
52 52
 
53 53
     public function init(
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
             $registry = $container->get(QueueRegistry::class);
66 66
             $config = $container->get(QueueConfig::class);
67 67
 
68
-            foreach ($config->getRegistryHandlers() as $jobType => $handler) {
68
+            foreach ($config->getRegistryHandlers() as $jobType => $handler){
69 69
                 $registry->setHandler($jobType, $handler);
70 70
             }
71 71
 
72
-            foreach ($config->getRegistrySerializers() as $jobType => $serializer) {
72
+            foreach ($config->getRegistrySerializers() as $jobType => $serializer){
73 73
                 $registry->setSerializer($jobType, $serializer);
74 74
             }
75 75
         });
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
80 80
      */
81
-    public function addConsumeInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
81
+    public function addConsumeInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
82 82
     {
83 83
         $this->config->modify(
84 84
             QueueConfig::CONFIG,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor
91 91
      */
92
-    public function addPushInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void
92
+    public function addPushInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void
93 93
     {
94 94
         $this->config->modify(
95 95
             QueueConfig::CONFIG,
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         ContainerInterface $container,
115 115
         FactoryInterface $factory,
116 116
         ContainerRegistry $registry,
117
-    ) {
117
+    ){
118 118
         return new QueueRegistry($container, $factory, $registry);
119 119
     }
120 120
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
     ): Handler {
129 129
         $core = new InterceptableCore($core, $dispatcher);
130 130
 
131
-        foreach ($config->getConsumeInterceptors() as $interceptor) {
132
-            if (\is_string($interceptor)) {
131
+        foreach ($config->getConsumeInterceptors() as $interceptor){
132
+            if (\is_string($interceptor)){
133 133
                 $interceptor = $container->get($interceptor);
134
-            } elseif ($interceptor instanceof Autowire) {
134
+            } elseif ($interceptor instanceof Autowire){
135 135
                 $interceptor = $interceptor->resolve($factory);
136 136
             }
137 137
 
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
@@ -18,24 +18,24 @@
 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
-        } catch (\Throwable $e) {
38
+        }catch (\Throwable $e){
39 39
             throw new ContainerException(\sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
40 40
         }
41 41
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,19 +23,28 @@
 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
-        } catch (\Throwable $e) {
45
+        }
46
+        catch (\Throwable $e)
47
+        {
39 48
             throw new ContainerException(\sprintf("Can't inject the required queue. %s", $e->getMessage()), 0, $e);
40 49
         }
41 50
 
Please login to merge, or discard this patch.
src/Queue/tests/Core/QueueInjectorTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
         $factory->shouldReceive('make')->andReturnUsing(function (string $name): QueueInterface {
88 88
             $result = ['sync' => $this->defaultQueue, 'test' => $this->testQueue][$name] ?? null;
89 89
 
90
-            if ($result === null) {
90
+            if ($result === null){
91 91
                 throw new NotFoundException();
92 92
             }
93 93
             return $result;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,8 @@
 block discarded – undo
87 87
         $factory->shouldReceive('make')->andReturnUsing(function (string $name): QueueInterface {
88 88
             $result = ['sync' => $this->defaultQueue, 'test' => $this->testQueue][$name] ?? null;
89 89
 
90
-            if ($result === null) {
90
+            if ($result === null)
91
+            {
91 92
                 throw new NotFoundException();
92 93
             }
93 94
             return $result;
Please login to merge, or discard this patch.
src/Framework/Bootloader/Auth/HttpAuthBootloader.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function __construct(
44 44
         private readonly ConfiguratorInterface $config
45
-    ) {
45
+    ){
46 46
     }
47 47
 
48 48
     public function init(AbstractKernel $kernel, EnvironmentInterface $env): void
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             ]
58 58
         );
59 59
 
60
-        $kernel->booting(function () {
60
+        $kernel->booting(function (){
61 61
             $this->addTransport('cookie', $this->createDefaultCookieTransport());
62 62
             $this->addTransport('header', new HeaderTransport('X-Auth-Token'));
63 63
             $this->addTokenStorage('session', SessionTokenStorage::class);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param non-empty-string $name
71 71
      * @param Autowire|HttpTransportInterface|class-string<HttpTransportInterface> $transport
72 72
      */
73
-    public function addTransport(string $name, Autowire|HttpTransportInterface|string $transport): void
73
+    public function addTransport(string $name, Autowire | HttpTransportInterface | string $transport): void
74 74
     {
75 75
         $this->config->modify(AuthConfig::CONFIG, new Append('transports', $name, $transport));
76 76
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param non-empty-string $name
82 82
      * @param Autowire|TokenStorageInterface|class-string<TokenStorageInterface> $storage
83 83
      */
84
-    public function addTokenStorage(string $name, Autowire|TokenStorageInterface|string $storage): void
84
+    public function addTokenStorage(string $name, Autowire | TokenStorageInterface | string $storage): void
85 85
     {
86 86
         $this->config->modify(AuthConfig::CONFIG, new Append('storages', $name, $storage));
87 87
     }
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
         $registry = new TransportRegistry();
105 105
         $registry->setDefaultTransport($config->getDefaultTransport());
106 106
 
107
-        foreach ($config->getTransports() as $name => $transport) {
108
-            if ($transport instanceof Autowire) {
107
+        foreach ($config->getTransports() as $name => $transport){
108
+            if ($transport instanceof Autowire){
109 109
                 $transport = $transport->resolve($factory);
110 110
             }
111 111
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@  discard block
 block discarded – undo
57 57
             ]
58 58
         );
59 59
 
60
-        $kernel->booting(function () {
60
+        $kernel->booting(function ()
61
+        {
61 62
             $this->addTransport('cookie', $this->createDefaultCookieTransport());
62 63
             $this->addTransport('header', new HeaderTransport('X-Auth-Token'));
63 64
             $this->addTokenStorage('session', SessionTokenStorage::class);
@@ -104,8 +105,10 @@  discard block
 block discarded – undo
104 105
         $registry = new TransportRegistry();
105 106
         $registry->setDefaultTransport($config->getDefaultTransport());
106 107
 
107
-        foreach ($config->getTransports() as $name => $transport) {
108
-            if ($transport instanceof Autowire) {
108
+        foreach ($config->getTransports() as $name => $transport)
109
+        {
110
+            if ($transport instanceof Autowire)
111
+            {
109 112
                 $transport = $transport->resolve($factory);
110 113
             }
111 114
 
Please login to merge, or discard this patch.
src/Framework/Auth/Config/AuthConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
      * @return TokenStorageInterface|class-string<TokenStorageInterface>|Autowire
40 40
      * @throws InvalidArgumentException
41 41
      */
42
-    public function getStorage(string $name): TokenStorageInterface|string|Autowire
42
+    public function getStorage(string $name): TokenStorageInterface | string | Autowire
43 43
     {
44
-        if (!isset($this->config['storages'][$name])) {
44
+        if (!isset($this->config['storages'][$name])){
45 45
             throw new InvalidArgumentException(
46 46
                 \sprintf('Token storage `%s` is not defined.', $name)
47 47
             );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
41 41
      */
42 42
     public function getStorage(string $name): TokenStorageInterface|string|Autowire
43 43
     {
44
-        if (!isset($this->config['storages'][$name])) {
44
+        if (!isset($this->config['storages'][$name]))
45
+        {
45 46
             throw new InvalidArgumentException(
46 47
                 \sprintf('Token storage `%s` is not defined.', $name)
47 48
             );
Please login to merge, or discard this patch.
src/AuthHttp/src/Middleware/AuthTransportWithStorageMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         TransportRegistry $transportRegistry,
30 30
         ?EventDispatcherInterface $eventDispatcher = null,
31 31
         ?string $storage = null
32
-    ) {
32
+    ){
33 33
         $this->authMiddleware = new AuthTransportMiddleware(
34 34
             $transportName,
35 35
             $scope,
Please login to merge, or discard this patch.
src/Auth/src/TokenStorageProvider.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly AuthConfig $config,
18 18
         private readonly FactoryInterface $factory
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     public function getStorage(?string $name = null): TokenStorageInterface
23 23
     {
24 24
         $name ??= $this->config->getDefaultStorage();
25 25
 
26
-        if (isset($this->storages[$name])) {
26
+        if (isset($this->storages[$name])){
27 27
             return $this->storages[$name];
28 28
         }
29 29
 
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $storage = $this->config->getStorage($name);
36 36
 
37
-        if ($storage instanceof TokenStorageInterface) {
37
+        if ($storage instanceof TokenStorageInterface){
38 38
             return $storage;
39 39
         }
40 40
 
41
-        if ($storage instanceof Autowire) {
41
+        if ($storage instanceof Autowire){
42 42
             return $storage->resolve($this->factory);
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
     {
24 24
         $name ??= $this->config->getDefaultStorage();
25 25
 
26
-        if (isset($this->storages[$name])) {
26
+        if (isset($this->storages[$name]))
27
+        {
27 28
             return $this->storages[$name];
28 29
         }
29 30
 
@@ -34,11 +35,13 @@  discard block
 block discarded – undo
34 35
     {
35 36
         $storage = $this->config->getStorage($name);
36 37
 
37
-        if ($storage instanceof TokenStorageInterface) {
38
+        if ($storage instanceof TokenStorageInterface)
39
+        {
38 40
             return $storage;
39 41
         }
40 42
 
41
-        if ($storage instanceof Autowire) {
43
+        if ($storage instanceof Autowire)
44
+        {
42 45
             return $storage->resolve($this->factory);
43 46
         }
44 47
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/Middleware/Firewall/OverwriteFirewallTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,6 +34,6 @@
 block discarded – undo
34 34
             new ServerRequest('GET', new Uri('/admin'), ['X-Auth-Token' => $token], 'php://input')
35 35
         );
36 36
 
37
-        $this->assertSame($token === 'ok' ? '/admin' : '/login', (string) $response->getBody());
37
+        $this->assertSame($token === 'ok' ? '/admin' : '/login', (string)$response->getBody());
38 38
     }
39 39
 }
Please login to merge, or discard this patch.