Passed
Pull Request — master (#825)
by Maxim
16:52 queued 10s
created
src/Router/src/Target/Group.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly array $controllers,
16 16
         int $options = 0,
17 17
         string $defaultAction = 'index'
18
-    ) {
18
+    ){
19 19
         parent::__construct(
20 20
             ['controller' => null, 'action' => null],
21 21
             ['controller' => \array_keys($controllers), 'action' => null],
Please login to merge, or discard this patch.
src/Router/src/Target/Namespaced.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         string $namespace,
24 24
         string $postfix = 'Controller',
25 25
         int $options = 0
26
-    ) {
26
+    ){
27 27
         $this->namespace = \rtrim($namespace, '\\');
28 28
         $this->postfix = \ucfirst($postfix);
29 29
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])){
42 42
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
 
39 39
     protected function resolveController(array $matches): string
40 40
     {
41
-        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) {
41
+        if (\preg_match('/[^a-z_0-9\-]/i', $matches['controller']))
42
+        {
42 43
             throw new TargetException('Invalid namespace target, controller name not allowed.');
43 44
         }
44 45
 
Please login to merge, or discard this patch.
src/Router/src/Target/Action.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(
25 25
         private readonly string $controller,
26
-        private readonly string|array $action,
26
+        private readonly string | array $action,
27 27
         int $options = 0
28
-    ) {
29
-        if (\is_string($action)) {
28
+    ){
29
+        if (\is_string($action)){
30 30
             parent::__construct(
31 31
                 ['action' => $action],
32 32
                 ['action' => new Autofill($action)],
33 33
                 $options
34 34
             );
35
-        } else {
35
+        }else{
36 36
             parent::__construct(
37 37
                 ['action' => null],
38 38
                 ['action' => $action],
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     protected function resolveAction(array $matches): string
50 50
     {
51 51
         $action = $this->action;
52
-        if (\is_string($action)) {
52
+        if (\is_string($action)){
53 53
             return $action;
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,13 +26,16 @@  discard block
 block discarded – undo
26 26
         private readonly string|array $action,
27 27
         int $options = 0
28 28
     ) {
29
-        if (\is_string($action)) {
29
+        if (\is_string($action))
30
+        {
30 31
             parent::__construct(
31 32
                 ['action' => $action],
32 33
                 ['action' => new Autofill($action)],
33 34
                 $options
34 35
             );
35
-        } else {
36
+        }
37
+        else
38
+        {
36 39
             parent::__construct(
37 40
                 ['action' => null],
38 41
                 ['action' => $action],
@@ -49,7 +52,8 @@  discard block
 block discarded – undo
49 52
     protected function resolveAction(array $matches): string
50 53
     {
51 54
         $action = $this->action;
52
-        if (\is_string($action)) {
55
+        if (\is_string($action))
56
+        {
53 57
             return $action;
54 58
         }
55 59
 
Please login to merge, or discard this patch.
src/Router/src/CoreHandler.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         private readonly CoreInterface $core,
34 34
         private readonly ScopeInterface $scope,
35 35
         private readonly ResponseFactoryInterface $responseFactory
36
-    ) {
36
+    ){
37 37
     }
38 38
 
39 39
     public function withContext(string $controller, string $action, array $parameters): CoreHandler
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function handle(Request $request): Response
65 65
     {
66
-        if ($this->controller === null) {
66
+        if ($this->controller === null){
67 67
             throw new HandlerException('Controller and action pair is not set');
68 68
         }
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $output = $result = null;
74 74
 
75 75
         $response = $this->responseFactory->createResponse(200);
76
-        try {
76
+        try{
77 77
             // run the core withing PSR-7 Request/Response scope
78 78
             $result = $this->scope->runScope(
79 79
                 [
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
                     $this->parameters
87 87
                 )
88 88
             );
89
-        } catch (ControllerException $e) {
89
+        }catch (ControllerException $e){
90 90
             \ob_get_clean();
91 91
             throw $this->mapException($e);
92
-        } catch (\Throwable $e) {
92
+        }catch (\Throwable $e){
93 93
             \ob_get_clean();
94 94
             throw $e;
95
-        } finally {
96
-            while (\ob_get_level() > $outputLevel + 1) {
97
-                $output = \ob_get_clean() . $output;
95
+        }finally{
96
+            while (\ob_get_level() > $outputLevel + 1){
97
+                $output = \ob_get_clean().$output;
98 98
             }
99 99
         }
100 100
 
101 101
         return $this->wrapResponse(
102 102
             $response,
103 103
             $result,
104
-            \ob_get_clean() . $output
104
+            \ob_get_clean().$output
105 105
         );
106 106
     }
107 107
 
108 108
     private function getAction(Request $request): string
109 109
     {
110
-        if ($this->verbActions) {
111
-            return \strtolower($request->getMethod()) . \ucfirst($this->action);
110
+        if ($this->verbActions){
111
+            return \strtolower($request->getMethod()).\ucfirst($this->action);
112 112
         }
113 113
 
114 114
         return $this->action;
@@ -123,21 +123,21 @@  discard block
 block discarded – undo
123 123
      */
124 124
     private function wrapResponse(Response $response, mixed $result = null, string $output = ''): Response
125 125
     {
126
-        if ($result instanceof Response) {
127
-            if ($output !== '' && $result->getBody()->isWritable()) {
126
+        if ($result instanceof Response){
127
+            if ($output !== '' && $result->getBody()->isWritable()){
128 128
                 $result->getBody()->write($output);
129 129
             }
130 130
 
131 131
             return $result;
132 132
         }
133 133
 
134
-        if ($result instanceof \Generator) {
134
+        if ($result instanceof \Generator){
135 135
             return $response->withBody(new GeneratorStream($result));
136 136
         }
137 137
 
138
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
138
+        if (\is_array($result) || $result instanceof \JsonSerializable){
139 139
             $response = $this->writeJson($response, $result);
140
-        } else {
140
+        }else{
141 141
             $response->getBody()->write((string)$result);
142 142
         }
143 143
 
Please login to merge, or discard this patch.
Braces   +28 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,8 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function handle(Request $request): Response
65 65
     {
66
-        if ($this->controller === null) {
66
+        if ($this->controller === null)
67
+        {
67 68
             throw new HandlerException('Controller and action pair is not set');
68 69
         }
69 70
 
@@ -73,7 +74,8 @@  discard block
 block discarded – undo
73 74
         $output = $result = null;
74 75
 
75 76
         $response = $this->responseFactory->createResponse(200);
76
-        try {
77
+        try
78
+        {
77 79
             // run the core withing PSR-7 Request/Response scope
78 80
             $result = $this->scope->runScope(
79 81
                 [
@@ -86,14 +88,21 @@  discard block
 block discarded – undo
86 88
                     $this->parameters
87 89
                 )
88 90
             );
89
-        } catch (ControllerException $e) {
91
+        }
92
+        catch (ControllerException $e)
93
+        {
90 94
             \ob_get_clean();
91 95
             throw $this->mapException($e);
92
-        } catch (\Throwable $e) {
96
+        }
97
+        catch (\Throwable $e)
98
+        {
93 99
             \ob_get_clean();
94 100
             throw $e;
95
-        } finally {
96
-            while (\ob_get_level() > $outputLevel + 1) {
101
+        }
102
+        finally
103
+        {
104
+            while (\ob_get_level() > $outputLevel + 1)
105
+            {
97 106
                 $output = \ob_get_clean() . $output;
98 107
             }
99 108
         }
@@ -107,7 +116,8 @@  discard block
 block discarded – undo
107 116
 
108 117
     private function getAction(Request $request): string
109 118
     {
110
-        if ($this->verbActions) {
119
+        if ($this->verbActions)
120
+        {
111 121
             return \strtolower($request->getMethod()) . \ucfirst($this->action);
112 122
         }
113 123
 
@@ -123,21 +133,27 @@  discard block
 block discarded – undo
123 133
      */
124 134
     private function wrapResponse(Response $response, mixed $result = null, string $output = ''): Response
125 135
     {
126
-        if ($result instanceof Response) {
127
-            if ($output !== '' && $result->getBody()->isWritable()) {
136
+        if ($result instanceof Response)
137
+        {
138
+            if ($output !== '' && $result->getBody()->isWritable())
139
+            {
128 140
                 $result->getBody()->write($output);
129 141
             }
130 142
 
131 143
             return $result;
132 144
         }
133 145
 
134
-        if ($result instanceof \Generator) {
146
+        if ($result instanceof \Generator)
147
+        {
135 148
             return $response->withBody(new GeneratorStream($result));
136 149
         }
137 150
 
138
-        if (\is_array($result) || $result instanceof \JsonSerializable) {
151
+        if (\is_array($result) || $result instanceof \JsonSerializable)
152
+        {
139 153
             $response = $this->writeJson($response, $result);
140
-        } else {
154
+        }
155
+        else
156
+        {
141 157
             $response->getBody()->write((string)$result);
142 158
         }
143 159
 
Please login to merge, or discard this patch.
src/Auth/src/Event/Logout.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
     public function __construct(
10 10
         public readonly ?object $actor,
11 11
         public readonly ?string $transport = null
12
-    ) {
12
+    ){
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Auth/src/Event/Authenticated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
     public function __construct(
12 12
         public readonly TokenInterface $token,
13 13
         public readonly ?string $transport = null
14
-    ) {
14
+    ){
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
src/Auth/src/AuthContext.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     public function __construct(
19 19
         private readonly ActorProviderInterface $actorProvider,
20 20
         private readonly ?EventDispatcherInterface $eventDispatcher = null
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     public function start(TokenInterface $token, string $transport = null): void
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function getActor(): ?object
45 45
     {
46
-        if ($this->closed) {
46
+        if ($this->closed){
47 47
             return null;
48 48
         }
49 49
 
50
-        if ($this->actor === null && $this->token !== null) {
50
+        if ($this->actor === null && $this->token !== null){
51 51
             $this->actor = $this->actorProvider->getActor($this->token);
52 52
         }
53 53
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,13 @@
 block discarded – undo
43 43
 
44 44
     public function getActor(): ?object
45 45
     {
46
-        if ($this->closed) {
46
+        if ($this->closed)
47
+        {
47 48
             return null;
48 49
         }
49 50
 
50
-        if ($this->actor === null && $this->token !== null) {
51
+        if ($this->actor === null && $this->token !== null)
52
+        {
51 53
             $this->actor = $this->actorProvider->getActor($this->token);
52 54
         }
53 55
 
Please login to merge, or discard this patch.
src/Cookies/src/Config/CookiesConfig.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@
 block discarded – undo
40 40
     public function resolveDomain(UriInterface $uri): ?string
41 41
     {
42 42
         $host = $uri->getHost();
43
-        if (empty($host)) {
43
+        if (empty($host)){
44 44
             return null;
45 45
         }
46 46
 
47 47
         $pattern = $this->config['domain'];
48
-        if (\preg_match("/^(\d{1,3}){4}:\d+$/", $host, $matches)) {
48
+        if (\preg_match("/^(\d{1,3}){4}:\d+$/", $host, $matches)){
49 49
             // remove port
50 50
             $host = $matches[1];
51 51
         }
52 52
 
53
-        if ($host === 'localhost' || \filter_var($host, FILTER_VALIDATE_IP)) {
53
+        if ($host === 'localhost' || \filter_var($host, FILTER_VALIDATE_IP)){
54 54
             //We can't use sub-domains when website required by IP
55 55
             $pattern = \ltrim($pattern, '.');
56 56
         }
57 57
 
58
-        if (!str_contains((string) $pattern, '%s')) {
58
+        if (!str_contains((string)$pattern, '%s')){
59 59
             //Forced domain
60 60
             return $pattern;
61 61
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,22 +40,26 @@
 block discarded – undo
40 40
     public function resolveDomain(UriInterface $uri): ?string
41 41
     {
42 42
         $host = $uri->getHost();
43
-        if (empty($host)) {
43
+        if (empty($host))
44
+        {
44 45
             return null;
45 46
         }
46 47
 
47 48
         $pattern = $this->config['domain'];
48
-        if (\preg_match("/^(\d{1,3}){4}:\d+$/", $host, $matches)) {
49
+        if (\preg_match("/^(\d{1,3}){4}:\d+$/", $host, $matches))
50
+        {
49 51
             // remove port
50 52
             $host = $matches[1];
51 53
         }
52 54
 
53
-        if ($host === 'localhost' || \filter_var($host, FILTER_VALIDATE_IP)) {
55
+        if ($host === 'localhost' || \filter_var($host, FILTER_VALIDATE_IP))
56
+        {
54 57
             //We can't use sub-domains when website required by IP
55 58
             $pattern = \ltrim($pattern, '.');
56 59
         }
57 60
 
58
-        if (!str_contains((string) $pattern, '%s')) {
61
+        if (!str_contains((string) $pattern, '%s'))
62
+        {
59 63
             //Forced domain
60 64
             return $pattern;
61 65
         }
Please login to merge, or discard this patch.
src/Cookies/src/CookieQueue.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function __construct(
15 15
         private readonly ?string $domain = null,
16 16
         private readonly bool $secure = false
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     /**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
         bool $httpOnly = true,
74 74
         ?string $sameSite = null
75 75
     ): self {
76
-        if (\is_null($domain)) {
76
+        if (\is_null($domain)){
77 77
             //Let's resolve domain via config
78 78
             $domain = $this->domain;
79 79
         }
80 80
 
81
-        if (\is_null($secure)) {
81
+        if (\is_null($secure)){
82 82
             $secure = $this->secure;
83 83
         }
84 84
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function delete(string $name): void
104 104
     {
105
-        foreach ($this->scheduled as $index => $cookie) {
106
-            if ($cookie->getName() === $name) {
105
+        foreach ($this->scheduled as $index => $cookie){
106
+            if ($cookie->getName() === $name){
107 107
                 unset($this->scheduled[$index]);
108 108
             }
109 109
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,12 +73,14 @@  discard block
 block discarded – undo
73 73
         bool $httpOnly = true,
74 74
         ?string $sameSite = null
75 75
     ): self {
76
-        if (\is_null($domain)) {
76
+        if (\is_null($domain))
77
+        {
77 78
             //Let's resolve domain via config
78 79
             $domain = $this->domain;
79 80
         }
80 81
 
81
-        if (\is_null($secure)) {
82
+        if (\is_null($secure))
83
+        {
82 84
             $secure = $this->secure;
83 85
         }
84 86
 
@@ -102,8 +104,10 @@  discard block
 block discarded – undo
102 104
      */
103 105
     public function delete(string $name): void
104 106
     {
105
-        foreach ($this->scheduled as $index => $cookie) {
106
-            if ($cookie->getName() === $name) {
107
+        foreach ($this->scheduled as $index => $cookie)
108
+        {
109
+            if ($cookie->getName() === $name)
110
+            {
107 111
                 unset($this->scheduled[$index]);
108 112
             }
109 113
         }
Please login to merge, or discard this patch.