Passed
Pull Request — master (#1207)
by Aleksei
10:55
created
src/Interceptors/src/Context/TargetInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,5 +58,5 @@
 block discarded – undo
58 58
      *
59 59
      * @return callable|array{class-string, non-empty-string}|null
60 60
      */
61
-    public function getCallable(): callable|array|null;
61
+    public function getCallable(): callable | array | null;
62 62
 }
Please login to merge, or discard this patch.
src/Hmvc/src/CompatiblePipelineBuilder.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
     public function withInterceptors(CoreInterceptorInterface|InterceptorInterface ...$interceptors): static
32 32
     {
33 33
         $clone = clone $this;
34
-        foreach ($interceptors as $interceptor) {
34
+        foreach ($interceptors as $interceptor)
35
+        {
35 36
             $clone->pipeline->addInterceptor($interceptor);
36 37
         }
37 38
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@
 block discarded – undo
23 23
         $this->pipeline = new InterceptorPipeline($dispatcher);
24 24
     }
25 25
 
26
-    public function withInterceptors(CoreInterceptorInterface|InterceptorInterface ...$interceptors): static
26
+    public function withInterceptors(CoreInterceptorInterface | InterceptorInterface ...$interceptors): static
27 27
     {
28 28
         $clone = clone $this;
29
-        foreach ($interceptors as $interceptor) {
29
+        foreach ($interceptors as $interceptor){
30 30
             $clone->pipeline->addInterceptor($interceptor);
31 31
         }
32 32
 
33 33
         return $clone;
34 34
     }
35 35
 
36
-    public function build(HandlerInterface|CoreInterface $handler): InterceptorPipeline
36
+    public function build(HandlerInterface | CoreInterface $handler): InterceptorPipeline
37 37
     {
38 38
         /** @psalm-suppress InvalidArgument */
39 39
         return $handler instanceof HandlerInterface
Please login to merge, or discard this patch.
src/Hmvc/src/Exception/ControllerException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 // Load the original class to make an alias
8 8
 use Spiral\Interceptors\Exception\TargetCallException;
9 9
 
10
-if (!\class_exists(TargetCallException::class)) {
10
+if (!\class_exists(TargetCallException::class)){
11 11
     /**
12 12
      * Unable to perform user action or find controller.
13 13
      *
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,8 @@
 block discarded – undo
7 7
 // Load the original class to make an alias
8 8
 use Spiral\Interceptors\Exception\TargetCallException;
9 9
 
10
-if (!\class_exists(TargetCallException::class)) {
10
+if (!\class_exists(TargetCallException::class))
11
+{
11 12
     /**
12 13
      * Unable to perform user action or find controller.
13 14
      *
Please login to merge, or discard this patch.
src/Hmvc/src/Exception/InterceptorException.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
 namespace Spiral\Core\Exception;
6 6
 
7 7
 // Load the original class to make an alias
8
-if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)) {
8
+if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class))
9
+{
9 10
     /**
10 11
      * @deprecated will be removed in Spiral v4.0
11 12
      * Use {@see \Spiral\Interceptors\Exception\InterceptorException} instead.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 namespace Spiral\Core\Exception;
6 6
 
7 7
 // Load the original class to make an alias
8
-if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)) {
8
+if (!\class_exists(\Spiral\Interceptors\Exception\InterceptorException::class)){
9 9
     /**
10 10
      * @deprecated will be removed in Spiral v4.0
11 11
      * Use {@see \Spiral\Interceptors\Exception\InterceptorException} instead.
12 12
      */
13
-    class InterceptorException extends \RuntimeException {}
13
+    class InterceptorException extends \RuntimeException{}
14 14
 }
Please login to merge, or discard this patch.
src/Hmvc/src/AbstractCore.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
67 67
     {
68
-        foreach ($method->getParameters() as $parameter) {
68
+        foreach ($method->getParameters() as $parameter)
69
+        {
69 70
             $name = $parameter->getName();
70 71
             if (
71 72
                 \array_key_exists($name, $parameters) &&
@@ -86,9 +87,12 @@  discard block
 block discarded – undo
86 87
      */
87 88
     private function invoke(?object $object, string $class, \ReflectionMethod $method, array $arguments): mixed
88 89
     {
89
-        try {
90
+        try
91
+        {
90 92
             $args = $this->resolveArguments($method, $arguments);
91
-        } catch (ArgumentResolvingException | InvalidArgumentException $e) {
93
+        }
94
+        catch (ArgumentResolvingException | InvalidArgumentException $e)
95
+        {
92 96
             throw new ControllerException(
93 97
                 \sprintf(
94 98
                     'Missing/invalid parameter %s of `%s`->`%s`',
@@ -99,7 +103,9 @@  discard block
 block discarded – undo
99 103
                 ControllerException::BAD_ARGUMENT,
100 104
                 $e,
101 105
             );
102
-        } catch (ContainerExceptionInterface $e) {
106
+        }
107
+        catch (ContainerExceptionInterface $e)
108
+        {
103 109
             throw new ControllerException(
104 110
                 $e->getMessage(),
105 111
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function __construct(
30 30
         /** @internal */
31 31
         #[Proxy] protected ContainerInterface $container,
32
-    ) {
32
+    ){
33 33
         // TODO: can we simplify this?
34 34
         // resolver is usually the container itself
35 35
         /** @psalm-suppress MixedAssignment */
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             ? $container
38 38
             : $container
39 39
                 ->get(InvokerInterface::class)
40
-                ->invoke(static fn(#[Proxy] ResolverInterface $resolver): ResolverInterface => $resolver);
40
+                ->invoke(static fn(#[Proxy] ResolverInterface $resolver) : ResolverInterface => $resolver);
41 41
     }
42 42
 
43 43
     /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function resolveArguments(\ReflectionMethod $method, array $parameters): array
67 67
     {
68
-        foreach ($method->getParameters() as $parameter) {
68
+        foreach ($method->getParameters() as $parameter){
69 69
             $name = $parameter->getName();
70 70
             if (
71 71
                 \array_key_exists($name, $parameters) &&
72 72
                 $parameters[$name] === null &&
73 73
                 $parameter->isDefaultValueAvailable()
74
-            ) {
74
+            ){
75 75
                 /** @psalm-suppress MixedAssignment */
76 76
                 $parameters[$name] = $parameter->getDefaultValue();
77 77
             }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function invoke(?object $object, string $class, \ReflectionMethod $method, array $arguments): mixed
88 88
     {
89
-        try {
89
+        try{
90 90
             $args = $this->resolveArguments($method, $arguments);
91
-        } catch (ArgumentResolvingException | InvalidArgumentException $e) {
91
+        }catch (ArgumentResolvingException | InvalidArgumentException $e){
92 92
             throw new ControllerException(
93 93
                 \sprintf(
94 94
                     'Missing/invalid parameter %s of `%s`->`%s`',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 ControllerException::BAD_ARGUMENT,
100 100
                 $e,
101 101
             );
102
-        } catch (ContainerExceptionInterface $e) {
102
+        }catch (ContainerExceptionInterface $e){
103 103
             throw new ControllerException(
104 104
                 $e->getMessage(),
105 105
                 ControllerException::ERROR,
Please login to merge, or discard this patch.
src/Interceptors/tests/Unit/Handler/AutowireHandlerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
     public function createHandler(array $definitions = []): AutowireHandler
109 109
     {
110 110
         $container = new Container();
111
-        foreach ($definitions as $id => $definition) {
111
+        foreach ($definitions as $id => $definition){
112 112
             $container->bind($id, $definition);
113 113
         }
114 114
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@
 block discarded – undo
108 108
     public function createHandler(array $definitions = []): AutowireHandler
109 109
     {
110 110
         $container = new Container();
111
-        foreach ($definitions as $id => $definition) {
111
+        foreach ($definitions as $id => $definition)
112
+        {
112 113
             $container->bind($id, $definition);
113 114
         }
114 115
 
Please login to merge, or discard this patch.
src/Views/src/ViewManager.php 2 patches
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,15 +28,18 @@  discard block
 block discarded – undo
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency)
32
+        {
32 33
             $this->addDependency($dependency->resolve($factory));
33 34
         }
34 35
 
35
-        foreach ($this->config->getEngines() as $engine) {
36
+        foreach ($this->config->getEngines() as $engine)
37
+        {
36 38
             $this->addEngine($engine->resolve($factory));
37 39
         }
38 40
 
39
-        if ($this->config->isCacheEnabled()) {
41
+        if ($this->config->isCacheEnabled())
42
+        {
40 43
             $this->cache = new ViewCache();
41 44
         }
42 45
     }
@@ -93,7 +96,8 @@  discard block
 block discarded – undo
93 96
 
94 97
         // Rotate all possible context variants and warm up cache
95 98
         $generator = new ContextGenerator($this->context);
96
-        foreach ($generator->generate() as $context) {
99
+        foreach ($generator->generate() as $context)
100
+        {
97 101
             $engine->reset($path, $context);
98 102
             $engine->compile($path, $context);
99 103
         }
@@ -110,7 +114,8 @@  discard block
 block discarded – undo
110 114
 
111 115
         // Rotate all possible context variants and warm up cache
112 116
         $generator = new ContextGenerator($this->context);
113
-        foreach ($generator->generate() as $context) {
117
+        foreach ($generator->generate() as $context)
118
+        {
114 119
             $engine->reset($path, $context);
115 120
         }
116 121
     }
@@ -122,7 +127,8 @@  discard block
 block discarded – undo
122 127
      */
123 128
     public function get(string $path): ViewInterface
124 129
     {
125
-        if ($this->cache?->has($this->context, $path)) {
130
+        if ($this->cache?->has($this->context, $path))
131
+        {
126 132
             return $this->cache->get($this->context, $path);
127 133
         }
128 134
 
@@ -150,8 +156,10 @@  discard block
 block discarded – undo
150 156
      */
151 157
     private function findEngine(string $path): EngineInterface
152 158
     {
153
-        foreach ($this->engines as $engine) {
154
-            if ($engine->getLoader()->exists($path)) {
159
+        foreach ($this->engines as $engine)
160
+        {
161
+            if ($engine->getLoader()->exists($path))
162
+            {
155 163
                 return $engine;
156 164
             }
157 165
         }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
         private readonly GlobalVariablesInterface $globalVariables,
23 23
         FactoryInterface $factory,
24 24
         ?ContextInterface $context = null,
25
-    ) {
25
+    ){
26 26
         $this->context = $context ?? new ViewContext();
27 27
         $this->loader = $factory->make(LoaderInterface::class, [
28 28
             'namespaces' => $config->getNamespaces(),
29 29
         ]);
30 30
 
31
-        foreach ($this->config->getDependencies() as $dependency) {
31
+        foreach ($this->config->getDependencies() as $dependency){
32 32
             $this->addDependency($dependency->resolve($factory));
33 33
         }
34 34
 
35
-        foreach ($this->config->getEngines() as $engine) {
35
+        foreach ($this->config->getEngines() as $engine){
36 36
             $this->addEngine($engine->resolve($factory));
37 37
         }
38 38
 
39
-        if ($this->config->isCacheEnabled()) {
39
+        if ($this->config->isCacheEnabled()){
40 40
             $this->cache = new ViewCache();
41 41
         }
42 42
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         // Rotate all possible context variants and warm up cache
94 94
         $generator = new ContextGenerator($this->context);
95
-        foreach ($generator->generate() as $context) {
95
+        foreach ($generator->generate() as $context){
96 96
             $engine->reset($path, $context);
97 97
             $engine->compile($path, $context);
98 98
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         // Rotate all possible context variants and warm up cache
111 111
         $generator = new ContextGenerator($this->context);
112
-        foreach ($generator->generate() as $context) {
112
+        foreach ($generator->generate() as $context){
113 113
             $engine->reset($path, $context);
114 114
         }
115 115
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function get(string $path): ViewInterface
123 123
     {
124
-        if ($this->cache?->has($this->context, $path)) {
124
+        if ($this->cache?->has($this->context, $path)){
125 125
             return $this->cache->get($this->context, $path);
126 126
         }
127 127
 
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function findEngine(string $path): EngineInterface
150 150
     {
151
-        foreach ($this->engines as $engine) {
152
-            if ($engine->getLoader()->exists($path)) {
151
+        foreach ($this->engines as $engine){
152
+            if ($engine->getLoader()->exists($path)){
153 153
                 return $engine;
154 154
             }
155 155
         }
Please login to merge, or discard this patch.
src/Broadcasting/src/Bootloader/WebsocketsBootloader.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
             ResponseFactoryInterface $responseFactory,
30 30
             BroadcastConfig $config,
31 31
             ?EventDispatcherInterface $dispatcher = null,
32
-        ): AuthorizationMiddleware => new AuthorizationMiddleware(
32
+        ) : AuthorizationMiddleware => new AuthorizationMiddleware(
33 33
             $broadcast,
34 34
             $responseFactory,
35 35
             $config->getAuthorizationPath(),
Please login to merge, or discard this patch.
src/Csrf/tests/CsrfTest.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -257,10 +257,13 @@
 block discarded – undo
257 257
     {
258 258
         $result = [];
259 259
 
260
-        foreach ($response->getHeaders() as $header) {
261
-            foreach ($header as $headerLine) {
260
+        foreach ($response->getHeaders() as $header)
261
+        {
262
+            foreach ($header as $headerLine)
263
+            {
262 264
                 $chunk = explode(';', $headerLine);
263
-                if (mb_strpos($chunk[0], '=') === false) {
265
+                if (mb_strpos($chunk[0], '=') === false)
266
+                {
264 267
                     continue;
265 268
                 }
266 269
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $cookies = $this->fetchCookies($response);
38 38
 
39 39
         self::assertArrayHasKey('csrf-token', $cookies);
40
-        self::assertSame($cookies['csrf-token'], (string) $response->getBody());
40
+        self::assertSame($cookies['csrf-token'], (string)$response->getBody());
41 41
     }
42 42
 
43 43
     public function testLengthException(): void
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         $response = $this->get($core, '/');
95 95
         self::assertSame(200, $response->getStatusCode());
96
-        self::assertSame('all good', (string) $response->getBody());
96
+        self::assertSame('all good', (string)$response->getBody());
97 97
 
98 98
         $cookies = $this->fetchCookies($response);
99 99
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         );
113 113
 
114 114
         self::assertSame(200, $response->getStatusCode());
115
-        self::assertSame('all good', (string) $response->getBody());
115
+        self::assertSame('all good', (string)$response->getBody());
116 116
     }
117 117
 
118 118
     public function testHeaderOK(): void
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         $response = $this->get($core, '/');
126 126
         self::assertSame(200, $response->getStatusCode());
127
-        self::assertSame('all good', (string) $response->getBody());
127
+        self::assertSame('all good', (string)$response->getBody());
128 128
 
129 129
         $cookies = $this->fetchCookies($response);
130 130
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         );
144 144
 
145 145
         self::assertSame(200, $response->getStatusCode());
146
-        self::assertSame('all good', (string) $response->getBody());
146
+        self::assertSame('all good', (string)$response->getBody());
147 147
     }
148 148
 
149 149
     public function testHeaderOKStrict(): void
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         );
174 174
 
175 175
         self::assertSame(200, $response->getStatusCode());
176
-        self::assertSame('all good', (string) $response->getBody());
176
+        self::assertSame('all good', (string)$response->getBody());
177 177
     }
178 178
 
179 179
     protected function setUp(): void
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
     {
258 258
         $result = [];
259 259
 
260
-        foreach ($response->getHeaders() as $header) {
261
-            foreach ($header as $headerLine) {
260
+        foreach ($response->getHeaders() as $header){
261
+            foreach ($header as $headerLine){
262 262
                 $chunk = explode(';', $headerLine);
263
-                if (mb_strpos($chunk[0], '=') === false) {
263
+                if (mb_strpos($chunk[0], '=') === false){
264 264
                     continue;
265 265
                 }
266 266
 
Please login to merge, or discard this patch.