Passed
Pull Request — master (#1221)
by Aleksei
12:41
created
src/Validation/src/ValidationProvider.php 2 patches
Spacing   +2 added lines, -2 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 InvokerInterface $invoker,
19
-    ) {}
19
+    ){}
20 20
 
21 21
     /**
22 22
      * @param non-empty-string $name
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getValidation(string $name, array $params = []): ValidationInterface
33 33
     {
34
-        if (!isset($this->resolvers[$name])) {
34
+        if (!isset($this->resolvers[$name])){
35 35
             throw new ValidationException(\sprintf('Validation with name `%s` is not registered.', $name));
36 36
         }
37 37
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function __construct(
18 18
         private readonly InvokerInterface $invoker,
19
-    ) {}
19
+    ) {
20
+}
20 21
 
21 22
     /**
22 23
      * @param non-empty-string $name
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
      */
32 33
     public function getValidation(string $name, array $params = []): ValidationInterface
33 34
     {
34
-        if (!isset($this->resolvers[$name])) {
35
+        if (!isset($this->resolvers[$name]))
36
+        {
35 37
             throw new ValidationException(\sprintf('Validation with name `%s` is not registered.', $name));
36 38
         }
37 39
 
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
@@ -33,6 +33,6 @@
 block discarded – undo
33 33
             new ServerRequest('GET', new Uri('/admin'), ['X-Auth-Token' => $token], 'php://input'),
34 34
         );
35 35
 
36
-        self::assertSame($token === 'ok' ? '/admin' : '/login', (string) $response->getBody());
36
+        self::assertSame($token === 'ok' ? '/admin' : '/login', (string)$response->getBody());
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
src/AuthHttp/tests/Middleware/Firewall/RedirectFirewallTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         );
35 35
 
36 36
         self::assertSame(200, $response->getStatusCode());
37
-        self::assertSame('success login', (string) $response->getBody());
37
+        self::assertSame('success login', (string)$response->getBody());
38 38
     }
39 39
 
40 40
     #[DataProvider('failTokensDataProvider')]
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         self::assertSame(302, $response->getStatusCode());
59 59
         self::assertSame(['Location' => ['/login']], $response->getHeaders());
60
-        self::assertSame('', (string) $response->getBody());
60
+        self::assertSame('', (string)$response->getBody());
61 61
     }
62 62
 
63 63
     #[DataProvider('failTokensDataProvider')]
@@ -80,6 +80,6 @@  discard block
 block discarded – undo
80 80
 
81 81
         self::assertSame(301, $response->getStatusCode());
82 82
         self::assertSame(['Location' => ['/login']], $response->getHeaders());
83
-        self::assertSame('', (string) $response->getBody());
83
+        self::assertSame('', (string)$response->getBody());
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $response = $http->handle(new ServerRequest('GET', ''));
44 44
 
45 45
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
46
-        self::assertSame(AuthContext::class, (string) $response->getBody());
46
+        self::assertSame(AuthContext::class, (string)$response->getBody());
47 47
     }
48 48
 
49 49
     public function testNoToken(): void
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         $http->setHandler(
62 62
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
63
-                if ($request->getAttribute('authContext')->getToken() === null) {
63
+                if ($request->getAttribute('authContext')->getToken() === null){
64 64
                     echo 'no token';
65 65
                 }
66 66
             },
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $response = $http->handle(new ServerRequest('GET', ''));
70 70
 
71 71
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
72
-        self::assertSame('no token', (string) $response->getBody());
72
+        self::assertSame('no token', (string)$response->getBody());
73 73
     }
74 74
 
75 75
     protected function getCore(array $middleware = []): Http
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,8 @@
 block discarded – undo
60 60
 
61 61
         $http->setHandler(
62 62
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
63
-                if ($request->getAttribute('authContext')->getToken() === null) {
63
+                if ($request->getAttribute('authContext')->getToken() === null)
64
+                {
64 65
                     echo 'no token';
65 66
                 }
66 67
             },
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/UploadedFileFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         ?string $clientFilename = null,
19 19
         ?string $clientMediaType = null,
20 20
     ): UploadedFileInterface {
21
-        if ($size === null) {
21
+        if ($size === null){
22 22
             $size = $stream->getSize();
23 23
         }
24 24
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
         ?string $clientFilename = null,
19 19
         ?string $clientMediaType = null,
20 20
     ): UploadedFileInterface {
21
-        if ($size === null) {
21
+        if ($size === null)
22
+        {
22 23
             $size = $stream->getSize();
23 24
         }
24 25
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/ResponseFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
 
12 12
 final class ResponseFactory implements ResponseFactoryInterface
13 13
 {
14
-    public function __construct(protected HttpConfig $config) {}
14
+    public function __construct(protected HttpConfig $config){}
15 15
 
16 16
     public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
17 17
     {
18 18
         $response = new Response($code);
19 19
         $response = $response->withStatus($code, $reasonPhrase);
20 20
 
21
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
21
+        foreach ($this->config->getBaseHeaders() as $header => $value){
22 22
             $response = $response->withAddedHeader($header, $value);
23 23
         }
24 24
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,14 +11,17 @@
 block discarded – undo
11 11
 
12 12
 final class ResponseFactory implements ResponseFactoryInterface
13 13
 {
14
-    public function __construct(protected HttpConfig $config) {}
14
+    public function __construct(protected HttpConfig $config)
15
+    {
16
+}
15 17
 
16 18
     public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
17 19
     {
18 20
         $response = new Response($code);
19 21
         $response = $response->withStatus($code, $reasonPhrase);
20 22
 
21
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
23
+        foreach ($this->config->getBaseHeaders() as $header => $value)
24
+        {
22 25
             $response = $response->withAddedHeader($header, $value);
23 26
         }
24 27
 
Please login to merge, or discard this patch.
src/AuthHttp/src/Transport/CookieTransport.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         private readonly bool $secure = false,
23 23
         private readonly bool $httpOnly = true,
24 24
         private readonly ?string $sameSite = null,
25
-    ) {}
25
+    ){}
26 26
 
27 27
     public function fetchToken(Request $request): ?string
28 28
     {
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     ): Response {
39 39
         /** @var CookieQueue $cookieQueue */
40 40
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
41
-        if ($cookieQueue === null) {
41
+        if ($cookieQueue === null){
42 42
             return $response->withAddedHeader(
43 43
                 'Set-Cookie',
44 44
                 Cookie::create(
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
             );
55 55
         }
56 56
 
57
-        if ($tokenID === null) {
57
+        if ($tokenID === null){
58 58
             $cookieQueue->delete($this->cookie);
59
-        } else {
59
+        }else{
60 60
             $cookieQueue->set(
61 61
                 $this->cookie,
62 62
                 $tokenID,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     private function getLifetime(?\DateTimeInterface $expiresAt = null): ?int
85 85
     {
86
-        if ($expiresAt === null) {
86
+        if ($expiresAt === null){
87 87
             return null;
88 88
         }
89 89
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
         private readonly bool $secure = false,
23 23
         private readonly bool $httpOnly = true,
24 24
         private readonly ?string $sameSite = null,
25
-    ) {}
25
+    ) {
26
+}
26 27
 
27 28
     public function fetchToken(Request $request): ?string
28 29
     {
@@ -38,7 +39,8 @@  discard block
 block discarded – undo
38 39
     ): Response {
39 40
         /** @var CookieQueue $cookieQueue */
40 41
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
41
-        if ($cookieQueue === null) {
42
+        if ($cookieQueue === null)
43
+        {
42 44
             return $response->withAddedHeader(
43 45
                 'Set-Cookie',
44 46
                 Cookie::create(
@@ -54,9 +56,12 @@  discard block
 block discarded – undo
54 56
             );
55 57
         }
56 58
 
57
-        if ($tokenID === null) {
59
+        if ($tokenID === null)
60
+        {
58 61
             $cookieQueue->delete($this->cookie);
59
-        } else {
62
+        }
63
+        else
64
+        {
60 65
             $cookieQueue->set(
61 66
                 $this->cookie,
62 67
                 $tokenID,
@@ -83,7 +88,8 @@  discard block
 block discarded – undo
83 88
      */
84 89
     private function getLifetime(?\DateTimeInterface $expiresAt = null): ?int
85 90
     {
86
-        if ($expiresAt === null) {
91
+        if ($expiresAt === null)
92
+        {
87 93
             return null;
88 94
         }
89 95
 
Please login to merge, or discard this patch.
src/AuthHttp/src/Middleware/Firewall/RedirectFirewall.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 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
     protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response
22 22
     {
23
-        return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string) $this->uri);
23
+        return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string)$this->uri);
24 24
     }
25 25
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@
 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
     protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response
22 23
     {
Please login to merge, or discard this patch.
src/AuthHttp/src/Middleware/Firewall/OverwriteFirewall.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public function __construct(
18 18
         private readonly UriInterface $uri,
19 19
         private readonly int $status = 401,
20
-    ) {}
20
+    ){}
21 21
 
22 22
     protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response
23 23
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
     public function __construct(
18 18
         private readonly UriInterface $uri,
19 19
         private readonly int $status = 401,
20
-    ) {}
20
+    ) {
21
+}
21 22
 
22 23
     protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response
23 24
     {
Please login to merge, or discard this patch.