Passed
Push — master ( c81bf2...c3afe7 )
by Aleksei
09:08 queued 01:17
created
src/Framework/Snapshots/StorageSnapshooter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly StorageSnapshot $storageSnapshot,
11
-    ) {}
11
+    ){}
12 12
 
13 13
     public function register(\Throwable $e): SnapshotInterface
14 14
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly StorageSnapshot $storageSnapshot,
11
-    ) {}
11
+    ) {
12
+}
12 13
 
13 14
     public function register(\Throwable $e): SnapshotInterface
14 15
     {
Please login to merge, or discard this patch.
src/Framework/Snapshots/FileSnapshooter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly FileSnapshot $fileSnapshot,
11
-    ) {}
11
+    ){}
12 12
 
13 13
     public function register(\Throwable $e): SnapshotInterface
14 14
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private readonly FileSnapshot $fileSnapshot,
11
-    ) {}
11
+    ) {
12
+}
12 13
 
13 14
     public function register(\Throwable $e): SnapshotInterface
14 15
     {
Please login to merge, or discard this patch.
src/Framework/Cookies/CookieManager.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
 {
23 23
     public function __construct(
24 24
         #[Proxy] private readonly ContainerInterface $container,
25
-    ) {}
25
+    ){}
26 26
 
27 27
     /**
28 28
      * @throws ScopeException
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
      */
150 150
     private function getRequest(): ServerRequestInterface
151 151
     {
152
-        try {
152
+        try{
153 153
             return $this->container->get(ServerRequestInterface::class);
154
-        } catch (NotFoundExceptionInterface $e) {
154
+        }catch (NotFoundExceptionInterface $e){
155 155
             throw new ScopeException('Unable to receive active request', $e->getCode(), $e);
156 156
         }
157 157
     }
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function getCookieQueue(): CookieQueue
163 163
     {
164
-        try {
164
+        try{
165 165
             return $this->container->get(CookieQueue::class);
166
-        } catch (NotFoundExceptionInterface $e) {
166
+        }catch (NotFoundExceptionInterface $e){
167 167
             throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e);
168 168
         }
169 169
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public function __construct(
24 24
         #[Proxy] private readonly ContainerInterface $container,
25
-    ) {}
25
+    ) {
26
+}
26 27
 
27 28
     /**
28 29
      * @throws ScopeException
@@ -149,9 +150,12 @@  discard block
 block discarded – undo
149 150
      */
150 151
     private function getRequest(): ServerRequestInterface
151 152
     {
152
-        try {
153
+        try
154
+        {
153 155
             return $this->container->get(ServerRequestInterface::class);
154
-        } catch (NotFoundExceptionInterface $e) {
156
+        }
157
+        catch (NotFoundExceptionInterface $e)
158
+        {
155 159
             throw new ScopeException('Unable to receive active request', $e->getCode(), $e);
156 160
         }
157 161
     }
@@ -161,9 +165,12 @@  discard block
 block discarded – undo
161 165
      */
162 166
     private function getCookieQueue(): CookieQueue
163 167
     {
164
-        try {
168
+        try
169
+        {
165 170
             return $this->container->get(CookieQueue::class);
166
-        } catch (NotFoundExceptionInterface $e) {
171
+        }
172
+        catch (NotFoundExceptionInterface $e)
173
+        {
167 174
             throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e);
168 175
         }
169 176
     }
Please login to merge, or discard this patch.
src/Framework/Auth/TokenStorageScope.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public function __construct(
21 21
         #[Proxy] private readonly ContainerInterface $container,
22
-    ) {}
22
+    ){}
23 23
 
24 24
     /**
25 25
      * Load token by id, must return null if token not found.
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      */
57 57
     private function getTokenStorage(): TokenStorageInterface
58 58
     {
59
-        try {
59
+        try{
60 60
             return $this->container->get(TokenStorageInterface::class);
61
-        } catch (NotFoundExceptionInterface $e) {
61
+        }catch (NotFoundExceptionInterface $e){
62 62
             throw new ScopeException('Unable to resolve token storage, invalid scope', $e->getCode(), $e);
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public function __construct(
21 21
         #[Proxy] private readonly ContainerInterface $container,
22
-    ) {}
22
+    ) {
23
+}
23 24
 
24 25
     /**
25 26
      * Load token by id, must return null if token not found.
@@ -56,9 +57,12 @@  discard block
 block discarded – undo
56 57
      */
57 58
     private function getTokenStorage(): TokenStorageInterface
58 59
     {
59
-        try {
60
+        try
61
+        {
60 62
             return $this->container->get(TokenStorageInterface::class);
61
-        } catch (NotFoundExceptionInterface $e) {
63
+        }
64
+        catch (NotFoundExceptionInterface $e)
65
+        {
62 66
             throw new ScopeException('Unable to resolve token storage, invalid scope', $e->getCode(), $e);
63 67
         }
64 68
     }
Please login to merge, or discard this patch.
src/Framework/Auth/Session/TokenStorage.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,27 +19,27 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function __construct(
21 21
         private readonly SessionScope $session,
22
-    ) {}
22
+    ){}
23 23
 
24 24
     public function load(string $id): ?TokenInterface
25 25
     {
26
-        try {
26
+        try{
27 27
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
28
-            if ($tokenData === null) {
28
+            if ($tokenData === null){
29 29
                 return null;
30 30
             }
31 31
 
32 32
             $token = Token::unpack($tokenData);
33
-        } catch (\Throwable $e) {
34
-            throw new TokenStorageException('Unable to load session token', (int) $e->getCode(), $e);
33
+        }catch (\Throwable $e){
34
+            throw new TokenStorageException('Unable to load session token', (int)$e->getCode(), $e);
35 35
         }
36 36
 
37
-        if (!\hash_equals($token->getID(), $id)) {
37
+        if (!\hash_equals($token->getID(), $id)){
38 38
             return null;
39 39
         }
40 40
 
41 41
         $expiresAt = $token->getExpiresAt();
42
-        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()) {
42
+        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()){
43 43
             $this->delete($token);
44 44
             return null;
45 45
         }
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function create(array $payload, ?\DateTimeInterface $expiresAt = null): TokenInterface
51 51
     {
52
-        try {
52
+        try{
53 53
             $token = new Token($this->randomHash(128), $payload, $expiresAt);
54 54
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
55 55
 
56 56
             return $token;
57
-        } catch (\Throwable $e) {
58
-            throw new TokenStorageException('Unable to create session token', (int) $e->getCode(), $e);
57
+        }catch (\Throwable $e){
58
+            throw new TokenStorageException('Unable to create session token', (int)$e->getCode(), $e);
59 59
         }
60 60
     }
61 61
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,27 +19,34 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function __construct(
21 21
         private readonly SessionScope $session,
22
-    ) {}
22
+    ) {
23
+}
23 24
 
24 25
     public function load(string $id): ?TokenInterface
25 26
     {
26
-        try {
27
+        try
28
+        {
27 29
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
28
-            if ($tokenData === null) {
30
+            if ($tokenData === null)
31
+            {
29 32
                 return null;
30 33
             }
31 34
 
32 35
             $token = Token::unpack($tokenData);
33
-        } catch (\Throwable $e) {
36
+        }
37
+        catch (\Throwable $e)
38
+        {
34 39
             throw new TokenStorageException('Unable to load session token', (int) $e->getCode(), $e);
35 40
         }
36 41
 
37
-        if (!\hash_equals($token->getID(), $id)) {
42
+        if (!\hash_equals($token->getID(), $id))
43
+        {
38 44
             return null;
39 45
         }
40 46
 
41 47
         $expiresAt = $token->getExpiresAt();
42
-        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()) {
48
+        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable())
49
+        {
43 50
             $this->delete($token);
44 51
             return null;
45 52
         }
@@ -49,12 +56,15 @@  discard block
 block discarded – undo
49 56
 
50 57
     public function create(array $payload, ?\DateTimeInterface $expiresAt = null): TokenInterface
51 58
     {
52
-        try {
59
+        try
60
+        {
53 61
             $token = new Token($this->randomHash(128), $payload, $expiresAt);
54 62
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
55 63
 
56 64
             return $token;
57
-        } catch (\Throwable $e) {
65
+        }
66
+        catch (\Throwable $e)
67
+        {
58 68
             throw new TokenStorageException('Unable to create session token', (int) $e->getCode(), $e);
59 69
         }
60 70
     }
Please login to merge, or discard this patch.
src/Framework/Auth/Session/Token.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     public function __construct(
12 12
         private readonly string $id,
13 13
         private readonly array $payload,
14
-        private readonly ?\DateTimeInterface $expiresAt = null,
15
-    ) {}
14
+        private readonly ? \DateTimeInterface $expiresAt = null,
15
+    ){}
16 16
 
17 17
     /**
18 18
      * Unpack token from serialized data.
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public static function unpack(array $data): Token
23 23
     {
24 24
         $expiresAt = null;
25
-        if ($data['expiresAt'] !== null) {
25
+        if ($data['expiresAt'] !== null){
26 26
             $expiresAt = (new \DateTimeImmutable())->setTimestamp($data['expiresAt']);
27 27
         }
28 28
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
         private readonly string $id,
13 13
         private readonly array $payload,
14 14
         private readonly ?\DateTimeInterface $expiresAt = null,
15
-    ) {}
15
+    ) {
16
+}
16 17
 
17 18
     /**
18 19
      * Unpack token from serialized data.
@@ -22,7 +23,8 @@  discard block
 block discarded – undo
22 23
     public static function unpack(array $data): Token
23 24
     {
24 25
         $expiresAt = null;
25
-        if ($data['expiresAt'] !== null) {
26
+        if ($data['expiresAt'] !== null)
27
+        {
26 28
             $expiresAt = (new \DateTimeImmutable())->setTimestamp($data['expiresAt']);
27 29
         }
28 30
 
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
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
      * @return TokenStorageInterface|class-string<TokenStorageInterface>|Autowire
42 42
      * @throws InvalidArgumentException
43 43
      */
44
-    public function getStorage(string $name): TokenStorageInterface|string|Autowire
44
+    public function getStorage(string $name): TokenStorageInterface | string | Autowire
45 45
     {
46
-        if (!isset($this->config['storages'][$name])) {
46
+        if (!isset($this->config['storages'][$name])){
47 47
             throw new InvalidArgumentException(
48 48
                 \sprintf('Token storage `%s` is not defined.', $name),
49 49
             );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
      */
44 44
     public function getStorage(string $name): TokenStorageInterface|string|Autowire
45 45
     {
46
-        if (!isset($this->config['storages'][$name])) {
46
+        if (!isset($this->config['storages'][$name]))
47
+        {
47 48
             throw new InvalidArgumentException(
48 49
                 \sprintf('Token storage `%s` is not defined.', $name),
49 50
             );
Please login to merge, or discard this patch.
src/Framework/Auth/Exception/InvalidArgumentException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Auth\Exception;
6 6
 
7
-class InvalidArgumentException extends AuthException {}
7
+class InvalidArgumentException extends AuthException{}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,6 @@
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Auth\Exception;
6 6
 
7
-class InvalidArgumentException extends AuthException {}
7
+class InvalidArgumentException extends AuthException
8
+{
9
+}
Please login to merge, or discard this patch.
src/Framework/Auth/AuthScope.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function __construct(
19 19
         #[Proxy] private readonly ContainerInterface $container,
20
-    ) {}
20
+    ){}
21 21
 
22 22
     /**
23 23
      * @throws ScopeException
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
     private function getAuthContext(): AuthContextInterface
71 71
     {
72
-        try {
72
+        try{
73 73
             return $this->container->get(AuthContextInterface::class);
74
-        } catch (NotFoundExceptionInterface $e) {
74
+        }catch (NotFoundExceptionInterface $e){
75 75
             throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e);
76 76
         }
77 77
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function __construct(
19 19
         #[Proxy] private readonly ContainerInterface $container,
20
-    ) {}
20
+    ) {
21
+}
21 22
 
22 23
     /**
23 24
      * @throws ScopeException
@@ -69,9 +70,12 @@  discard block
 block discarded – undo
69 70
 
70 71
     private function getAuthContext(): AuthContextInterface
71 72
     {
72
-        try {
73
+        try
74
+        {
73 75
             return $this->container->get(AuthContextInterface::class);
74
-        } catch (NotFoundExceptionInterface $e) {
76
+        }
77
+        catch (NotFoundExceptionInterface $e)
78
+        {
75 79
             throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e);
76 80
         }
77 81
     }
Please login to merge, or discard this patch.