Test Failed
Pull Request — master (#1170)
by Aleksei
19:12 queued 08:18
created
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.
src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null){
79 79
                     echo 'no token';
80 80
                 }
81 81
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null)
79
+                {
79 80
                     echo 'no token';
80 81
                 }
81 82
             }
Please login to merge, or discard this patch.
src/AuthHttp/src/Middleware/Firewall/RedirectFirewall.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
         protected readonly UriInterface $uri,
17 17
         protected readonly ResponseFactoryInterface $responseFactory,
18 18
         protected readonly int $status = 302
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response
23 23
     {
24
-        return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string) $this->uri);
24
+        return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string)$this->uri);
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/Annotation/Route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
41 41
     public function __construct(
42 42
         public readonly string $route,
43 43
         public readonly ?string $name = null,
44
-        public readonly array|string $methods = \Spiral\Router\Route::VERBS,
44
+        public readonly array | string $methods = \Spiral\Router\Route::VERBS,
45 45
         public readonly array $defaults = [],
46 46
         public readonly ?string $group = null,
47 47
         public readonly array $middleware = [],
48 48
         public readonly int $priority = 0
49
-    ) {
49
+    ){
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/RouteLocatorListener.php 2 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function listen(ReflectionClass $class): void
26 26
     {
27
-        foreach ($class->getMethods() as $method) {
27
+        foreach ($class->getMethods() as $method)
28
+        {
28 29
             $route = $this->reader->firstFunctionMetadata($method, Route::class);
29 30
 
30
-            if ($route === null) {
31
+            if ($route === null)
32
+            {
31 33
                 continue;
32 34
             }
33 35
 
@@ -40,7 +42,8 @@  discard block
 block discarded – undo
40 42
         $defaultGroup = $this->groups->getDefaultGroup();
41 43
 
42 44
         $routes = [];
43
-        foreach ($this->attributes as $classes) {
45
+        foreach ($this->attributes as $classes)
46
+        {
44 47
             [$method, $route] = $classes;
45 48
             $class = $method->getDeclaringClass();
46 49
 
@@ -64,7 +67,8 @@  discard block
 block discarded – undo
64 67
 
65 68
     private function configureRoutes(array $routes): void
66 69
     {
67
-        foreach ($routes as $name => $schema) {
70
+        foreach ($routes as $name => $schema)
71
+        {
68 72
             $route = new \Spiral\Router\Route(
69 73
                 $schema['pattern'],
70 74
                 new Action($schema['controller'], $schema['action']),
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
     public function __construct(
22 22
         private readonly ReaderInterface $reader,
23 23
         private readonly GroupRegistry $groups,
24
-    ) {
24
+    ){
25 25
     }
26 26
 
27 27
     public function listen(ReflectionClass $class): void
28 28
     {
29
-        foreach ($class->getMethods() as $method) {
29
+        foreach ($class->getMethods() as $method){
30 30
             $route = $this->reader->firstFunctionMetadata($method, Route::class);
31 31
 
32
-            if ($route === null) {
32
+            if ($route === null){
33 33
                 continue;
34 34
             }
35 35
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $defaultGroup = $this->groups->getDefaultGroup();
43 43
 
44 44
         $routes = [];
45
-        foreach ($this->attributes as $classes) {
45
+        foreach ($this->attributes as $classes){
46 46
             [$method, $route] = $classes;
47 47
             $class = $method->getDeclaringClass();
48 48
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     private function configureRoutes(array $routes): void
68 68
     {
69
-        foreach ($routes as $name => $schema) {
69
+        foreach ($routes as $name => $schema){
70 70
             $route = new \Spiral\Router\Route(
71 71
                 $schema['pattern'],
72 72
                 new Action($schema['controller'], $schema['action']),
Please login to merge, or discard this patch.
src/Http/src/ErrorHandler/PlainRenderer.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 {
17 17
     public function __construct(
18 18
         private readonly ResponseFactoryInterface $responseFactory
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     public function renderException(Request $request, int $code, \Throwable $exception): Response
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
         $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll();
26 26
 
27 27
         $response = $this->responseFactory->createResponse($code);
28
-        if ($acceptItems && $acceptItems[0]->getValue() === 'application/json') {
28
+        if ($acceptItems && $acceptItems[0]->getValue() === 'application/json'){
29 29
             $response = $response->withHeader('Content-Type', 'application/json; charset=UTF-8');
30 30
             $response->getBody()->write(\json_encode(['status' => $code]));
31
-        } else {
31
+        }else{
32 32
             $response->getBody()->write("Error code: {$code}");
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,10 +25,13 @@
 block discarded – undo
25 25
         $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll();
26 26
 
27 27
         $response = $this->responseFactory->createResponse($code);
28
-        if ($acceptItems && $acceptItems[0]->getValue() === 'application/json') {
28
+        if ($acceptItems && $acceptItems[0]->getValue() === 'application/json')
29
+        {
29 30
             $response = $response->withHeader('Content-Type', 'application/json; charset=UTF-8');
30 31
             $response->getBody()->write(\json_encode(['status' => $code]));
31
-        } else {
32
+        }
33
+        else
34
+        {
32 35
             $response->getBody()->write("Error code: {$code}");
33 36
         }
34 37
 
Please login to merge, or discard this patch.
src/Http/src/Middleware/ErrorHandlerMiddleware.php 2 patches
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,17 +39,23 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function process(Request $request, Handler $handler): Response
41 41
     {
42
-        try {
42
+        try
43
+        {
43 44
             return $handler->handle($request);
44
-        } catch (ClientException|RouterException $e) {
45
+        }
46
+        catch (ClientException|RouterException $e)
47
+        {
45 48
             $code = $e instanceof ClientException ? $e->getCode() : 404;
46
-        } catch (\Throwable $e) {
49
+        }
50
+        catch (\Throwable $e)
51
+        {
47 52
             $code = 500;
48 53
         }
49 54
 
50 55
         $this->errorHandler->report($e);
51 56
 
52
-        if (!$this->suppressErrors->suppressed()) {
57
+        if (!$this->suppressErrors->suppressed())
58
+        {
53 59
             return $this->renderError($request, $e, $code);
54 60
         }
55 61
 
@@ -67,7 +73,8 @@  discard block
 block discarded – undo
67 73
 
68 74
         [$format, $renderer] = $this->getRenderer($this->errorHandler, $request);
69 75
 
70
-        if ($format !== null) {
76
+        if ($format !== null)
77
+        {
71 78
             $response = $response->withHeader('Content-Type', $format . '; charset=UTF-8');
72 79
         }
73 80
 
@@ -87,12 +94,15 @@  discard block
 block discarded – undo
87 94
      */
88 95
     private function getRenderer(ExceptionHandlerInterface $handler, Request $request): array
89 96
     {
90
-        if ($request->hasHeader('Accept')) {
97
+        if ($request->hasHeader('Accept'))
98
+        {
91 99
             $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll();
92
-            foreach ($acceptItems as $item) {
100
+            foreach ($acceptItems as $item)
101
+            {
93 102
                 $format = $item->getValue();
94 103
                 $renderer = $handler->getRenderer($format);
95
-                if ($renderer !== null) {
104
+                if ($renderer !== null)
105
+                {
96 106
                     return [$format, $renderer];
97 107
                 }
98 108
             }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         private readonly ResponseFactoryInterface $responseFactory,
33 33
         private readonly ExceptionHandlerInterface $errorHandler,
34 34
         private readonly Verbosity $verbosity = Verbosity::VERBOSE,
35
-    ) {
35
+    ){
36 36
     }
37 37
 
38 38
     /**
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function process(Request $request, Handler $handler): Response
43 43
     {
44
-        try {
44
+        try{
45 45
             return $handler->handle($request);
46
-        } catch (ClientException|RouterException $e) {
46
+        }catch (ClientException | RouterException $e){
47 47
             $code = $e instanceof ClientException ? $e->getCode() : 404;
48
-        } catch (\Throwable $e) {
48
+        }catch (\Throwable $e){
49 49
             $code = 500;
50 50
         }
51 51
 
52 52
         $this->errorHandler->report($e);
53 53
 
54
-        if (!$this->suppressErrors->suppressed()) {
54
+        if (!$this->suppressErrors->suppressed()){
55 55
             return $this->renderError($request, $e, $code);
56 56
         }
57 57
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 
70 70
         [$format, $renderer] = $this->getRenderer($this->errorHandler, $request);
71 71
 
72
-        if ($format !== null) {
73
-            $response = $response->withHeader('Content-Type', $format . '; charset=UTF-8');
72
+        if ($format !== null){
73
+            $response = $response->withHeader('Content-Type', $format.'; charset=UTF-8');
74 74
         }
75 75
 
76 76
         $response->getBody()->write(
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      */
90 90
     private function getRenderer(ExceptionHandlerInterface $handler, Request $request): array
91 91
     {
92
-        if ($request->hasHeader('Accept')) {
92
+        if ($request->hasHeader('Accept')){
93 93
             $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll();
94
-            foreach ($acceptItems as $item) {
94
+            foreach ($acceptItems as $item){
95 95
                 $format = $item->getValue();
96 96
                 $renderer = $handler->getRenderer($format);
97
-                if ($renderer !== null) {
97
+                if ($renderer !== null){
98 98
                     return [$format, $renderer];
99 99
                 }
100 100
             }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Http/RouterBootloader.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,10 +62,13 @@  discard block
 block discarded – undo
62 62
             $groups->registerRoutes($router);
63 63
         };
64 64
 
65
-        if ($kernel instanceof Kernel) {
65
+        if ($kernel instanceof Kernel)
66
+        {
66 67
             $kernel->appBooted($configuratorCallback);
67 68
             $kernel->appBooted($groupsCallback);
68
-        } else {
69
+        }
70
+        else
71
+        {
69 72
             $kernel->booted($configuratorCallback);
70 73
             $kernel->booted($groupsCallback);
71 74
         }
@@ -95,7 +98,8 @@  discard block
 block discarded – undo
95 98
     private function route(ServerRequestInterface $request): RouteInterface
96 99
     {
97 100
         $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null);
98
-        if ($route === null) {
101
+        if ($route === null)
102
+        {
99 103
             throw new ScopeException('Unable to resolve Route, invalid request scope');
100 104
         }
101 105
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function __construct(
42 42
         private readonly ConfiguratorInterface $config,
43 43
         private readonly BinderInterface $binder,
44
-    ) {
44
+    ){
45 45
     }
46 46
 
47 47
     public function defineDependencies(): array
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
             $groups->registerRoutes($router);
81 81
         };
82 82
 
83
-        if ($kernel instanceof Kernel) {
83
+        if ($kernel instanceof Kernel){
84 84
             $kernel->appBooted($configuratorCallback);
85 85
             $kernel->appBooted($groupsCallback);
86
-        } else {
86
+        }else{
87 87
             $kernel->booted($configuratorCallback);
88 88
             $kernel->booted($groupsCallback);
89 89
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     private function route(ServerRequestInterface $request): RouteInterface
114 114
     {
115 115
         $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null);
116
-        if ($route === null) {
116
+        if ($route === null){
117 117
             throw new ScopeException('Unable to resolve Route, invalid request scope');
118 118
         }
119 119
 
Please login to merge, or discard this patch.
src/Session/tests/CacheHandlerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 final class CacheHandlerTest extends TestCase
14 14
 {
15 15
     private CacheHandler $handler;
16
-    private m\MockInterface|CacheInterface $cache;
16
+    private m\MockInterface | CacheInterface $cache;
17 17
 
18 18
     protected function setUp(): void
19 19
     {
Please login to merge, or discard this patch.