Passed
Pull Request — master (#1207)
by Aleksei
10:55
created
src/Http/tests/HttpTest.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,8 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $core = $this->getCore();
91 91
 
92
-        $core->setHandler(function ($req, $resp) {
92
+        $core->setHandler(function ($req, $resp)
93
+        {
93 94
             echo 'hello!';
94 95
 
95 96
             return $resp->withAddedHeader('hello', 'value');
@@ -105,7 +106,8 @@  discard block
 block discarded – undo
105 106
     {
106 107
         $core = $this->getCore();
107 108
 
108
-        $core->setHandler(function ($req, $resp) {
109
+        $core->setHandler(function ($req, $resp)
110
+        {
109 111
             echo 'hello!';
110 112
             $resp->getBody()->write('world ');
111 113
 
@@ -289,7 +291,8 @@  discard block
 block discarded – undo
289 291
                 TraceKind::SERVER,
290 292
             )
291 293
             ->willReturnCallback(
292
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
294
+                function ($name, $callback, $attributes, $scoped, $traceKind)
295
+                {
293 296
                     self::assertSame($attributes, [
294 297
                         'http.method' => 'GET',
295 298
                         'http.url' => 'http://example.org/path',
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $core->setHandler(fn(): string => 'hello world');
43 43
 
44 44
         $response = $core->handle(new ServerRequest('GET', ''));
45
-        self::assertSame('hello world', (string) $response->getBody());
45
+        self::assertSame('hello world', (string)$response->getBody());
46 46
     }
47 47
 
48 48
     public function testNoHandler(): void
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $core = $this->getCore();
53 53
 
54 54
         $response = $core->handle(new ServerRequest('GET', ''));
55
-        self::assertSame('hello world', (string) $response->getBody());
55
+        self::assertSame('hello world', (string)$response->getBody());
56 56
     }
57 57
 
58 58
     public function testHandlerInterface(): void
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         );
64 64
 
65 65
         $response = $core->handle(new ServerRequest('GET', ''));
66
-        self::assertSame('hello world', (string) $response->getBody());
66
+        self::assertSame('hello world', (string)$response->getBody());
67 67
     }
68 68
 
69 69
     public function testDefaultHeaders(): void
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $core = $this->getCore();
83 83
 
84
-        $core->setHandler(function ($req, $resp) {
84
+        $core->setHandler(function ($req, $resp){
85 85
             echo 'hello!';
86 86
 
87 87
             return $resp->withAddedHeader('hello', 'value');
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
         $response = $core->handle(new ServerRequest('GET', ''));
91 91
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
92 92
         self::assertSame(['value'], $response->getHeader('hello'));
93
-        self::assertSame('hello!', (string) $response->getBody());
93
+        self::assertSame('hello!', (string)$response->getBody());
94 94
     }
95 95
 
96 96
     public function testOutputAndWrite(): void
97 97
     {
98 98
         $core = $this->getCore();
99 99
 
100
-        $core->setHandler(function ($req, $resp) {
100
+        $core->setHandler(function ($req, $resp){
101 101
             echo 'hello!';
102 102
             $resp->getBody()->write('world ');
103 103
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $response = $core->handle(new ServerRequest('GET', ''));
108 108
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
109 109
         self::assertSame(['value'], $response->getHeader('hello'));
110
-        self::assertSame('world hello!', (string) $response->getBody());
110
+        self::assertSame('world hello!', (string)$response->getBody());
111 111
     }
112 112
 
113 113
     public function testNestedOutput(): void
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         self::assertSame(1, ob_get_level());
128 128
         $response = $core->handle(new ServerRequest('GET', ''));
129 129
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
130
-        self::assertSame('world hello!', (string) $response->getBody());
130
+        self::assertSame('world hello!', (string)$response->getBody());
131 131
         self::assertSame(1, ob_get_level());
132 132
     }
133 133
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $response = $core->handle(new ServerRequest('GET', ''));
169 169
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
170 170
         self::assertSame(['Value*'], $response->getHeader('header'));
171
-        self::assertSame('hello?', (string) $response->getBody());
171
+        self::assertSame('hello?', (string)$response->getBody());
172 172
     }
173 173
 
174 174
     public function testMiddlewareTrait(): void
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $response = $core->handle(new ServerRequest('GET', ''));
184 184
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
185 185
         self::assertSame(['Value+', 'Value*'], $response->getHeader('header'));
186
-        self::assertSame('hello?', (string) $response->getBody());
186
+        self::assertSame('hello?', (string)$response->getBody());
187 187
     }
188 188
 
189 189
     public function testMiddlewareTraitReversed(): void
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $response = $core->handle(new ServerRequest('GET', ''));
199 199
         self::assertSame(['text/html; charset=UTF-8'], $response->getHeader('Content-Type'));
200 200
         self::assertSame(['Value*', 'Value+'], $response->getHeader('header'));
201
-        self::assertSame('hello?', (string) $response->getBody());
201
+        self::assertSame('hello?', (string)$response->getBody());
202 202
     }
203 203
 
204 204
     public function testPassException(): void
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $dispatcher
225 225
             ->expects(self::exactly(2))
226 226
             ->method('dispatch')
227
-            ->with($this->callback(static fn(RequestReceived|RequestHandled $event): bool => true));
227
+            ->with($this->callback(static fn(RequestReceived | RequestHandled $event): bool => true));
228 228
         $this->container->bind(EventDispatcherInterface::class, $dispatcher);
229 229
 
230 230
         $core = $this->getCore();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $core->setHandler(fn(): string => 'hello world');
233 233
 
234 234
         $response = $core->handle($request);
235
-        self::assertSame('hello world', (string) $response->getBody());
235
+        self::assertSame('hello world', (string)$response->getBody());
236 236
     }
237 237
 
238 238
     public function testPassingTracerIntoScope(): void
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             ->andReturn(new NullTracer($this->container));
258 258
 
259 259
         $response = $http->handle($request);
260
-        self::assertSame('hello world', (string) $response->getBody());
260
+        self::assertSame('hello world', (string)$response->getBody());
261 261
     }
262 262
 
263 263
     public function testTraceAttributesAreSet(): void
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 TraceKind::SERVER,
282 282
             )
283 283
             ->willReturnCallback(
284
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
284
+                function ($name, $callback, $attributes, $scoped, $traceKind){
285 285
                     self::assertSame($attributes, [
286 286
                         'http.method' => 'GET',
287 287
                         'http.url' => 'http://example.org/path',
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $http->setHandler(fn(): string => 'hello world');
315 315
 
316 316
         $response = $http->handle($request);
317
-        self::assertSame('hello world', (string) $response->getBody());
317
+        self::assertSame('hello world', (string)$response->getBody());
318 318
     }
319 319
 
320 320
     public function testTraceContextIsAppliedToResponse(): void
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             ->andReturn(['baz' => 'quux']);
355 355
 
356 356
         $response = $http->handle($request);
357
-        self::assertSame('hello world', (string) $response->getBody());
357
+        self::assertSame('hello world', (string)$response->getBody());
358 358
         self::assertSame(['quux'], $response->getHeader('baz'));
359 359
     }
360 360
 
Please login to merge, or discard this patch.
src/Cookies/tests/CookiesTest.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,8 @@
 block discarded – undo
273 273
     {
274 274
         $result = [];
275 275
 
276
-        foreach ($response->getHeaders() as $line) {
276
+        foreach ($response->getHeaders() as $line)
277
+        {
277 278
             $cookie = explode('=', implode('', $line));
278 279
             $result[$cookie[0]] = rawurldecode(substr(
279 280
                 $cookie[1],
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         $response = $this->get($core, '/');
39 39
         self::assertSame(200, $response->getStatusCode());
40
-        self::assertSame('all good', (string) $response->getBody());
40
+        self::assertSame('all good', (string)$response->getBody());
41 41
     }
42 42
 
43 43
     public function testSetEncryptedCookie(): void
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         $response = $this->get($core, '/');
53 53
         self::assertSame(200, $response->getStatusCode());
54
-        self::assertSame('all good', (string) $response->getBody());
54
+        self::assertSame('all good', (string)$response->getBody());
55 55
 
56 56
         $cookies = $this->fetchCookies($response);
57 57
         self::assertArrayHasKey('name', $cookies);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         $response = $this->get($core, '/');
71 71
         self::assertSame(200, $response->getStatusCode());
72
-        self::assertSame('all good', (string) $response->getBody());
72
+        self::assertSame('all good', (string)$response->getBody());
73 73
 
74 74
         $cookies = $this->fetchCookies($response);
75 75
         self::assertArrayHasKey('PHPSESSID', $cookies);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         $response = $this->get($core, '/', [], [], ['name' => $value]);
87 87
         self::assertSame(200, $response->getStatusCode());
88
-        self::assertSame('cookie-value', (string) $response->getBody());
88
+        self::assertSame('cookie-value', (string)$response->getBody());
89 89
     }
90 90
 
91 91
     public function testDecryptArray(): void
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $response = $this->get($core, '/', [], [], ['name' => $value]);
99 99
         self::assertSame(200, $response->getStatusCode());
100
-        self::assertSame('cookie-value', (string) $response->getBody());
100
+        self::assertSame('cookie-value', (string)$response->getBody());
101 101
     }
102 102
 
103 103
     public function testDecryptBroken(): void
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
         $core = $this->httpCore([CookiesMiddleware::class]);
106 106
         $core->setHandler(fn(ServerRequestInterface $r) => $r->getCookieParams()['name']);
107 107
 
108
-        $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN';
108
+        $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN';
109 109
 
110 110
         $response = $this->get($core, '/', [], [], ['name' => $value]);
111 111
         self::assertSame(200, $response->getStatusCode());
112
-        self::assertSame('', (string) $response->getBody());
112
+        self::assertSame('', (string)$response->getBody());
113 113
     }
114 114
 
115 115
     public function testDelete(): 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
         self::assertArrayHasKey('name', $cookies);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         $response = $this->get($core, '/');
150 150
         self::assertSame(200, $response->getStatusCode());
151
-        self::assertSame('all good', (string) $response->getBody());
151
+        self::assertSame('all good', (string)$response->getBody());
152 152
 
153 153
         $cookies = $this->fetchCookies($response);
154 154
         self::assertArrayHasKey('name', $cookies);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
         $response = $this->get($core, '/', [], [], ['name' => $value]);
172 172
         self::assertSame(200, $response->getStatusCode());
173
-        self::assertSame('cookie-value', (string) $response->getBody());
173
+        self::assertSame('cookie-value', (string)$response->getBody());
174 174
     }
175 175
 
176 176
     public function testHMAC(): void
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
         $response = $this->get($core, '/');
192 192
         self::assertSame(200, $response->getStatusCode());
193
-        self::assertSame('all good', (string) $response->getBody());
193
+        self::assertSame('all good', (string)$response->getBody());
194 194
 
195 195
         $cookies = $this->fetchCookies($response);
196 196
         self::assertArrayHasKey('name', $cookies);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         $response = $this->get($core, '/', [], [], $cookies);
201 201
         self::assertSame(200, $response->getStatusCode());
202
-        self::assertSame('value', (string) $response->getBody());
202
+        self::assertSame('value', (string)$response->getBody());
203 203
     }
204 204
 
205 205
     protected function setUp(): void
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
     {
271 271
         $result = [];
272 272
 
273
-        foreach ($response->getHeaders() as $line) {
273
+        foreach ($response->getHeaders() as $line){
274 274
             $cookie = explode('=', implode('', $line));
275 275
             $result[$cookie[0]] = rawurldecode(substr(
276 276
                 $cookie[1],
277 277
                 0,
278
-                (int) strpos($cookie[1], ';'),
278
+                (int)strpos($cookie[1], ';'),
279 279
             ));
280 280
         }
281 281
 
Please login to merge, or discard this patch.
src/Distribution/src/Bootloader/DistributionBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             static function (DistributionConfig $config): DistributionInterface {
49 49
                 $manager = new Manager($config->getDefaultDriver());
50 50
 
51
-                foreach ($config->getResolvers() as $name => $resolver) {
51
+                foreach ($config->getResolvers() as $name => $resolver){
52 52
                     $manager->add($name, $resolver);
53 53
                 }
54 54
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@
 block discarded – undo
48 48
             static function (DistributionConfig $config): DistributionInterface {
49 49
                 $manager = new Manager($config->getDefaultDriver());
50 50
 
51
-                foreach ($config->getResolvers() as $name => $resolver) {
51
+                foreach ($config->getResolvers() as $name => $resolver)
52
+                {
52 53
                     $manager->add($name, $resolver);
53 54
                 }
54 55
 
Please login to merge, or discard this patch.
src/Router/src/Router.php 2 patches
Braces   +49 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,13 +68,17 @@  discard block
 block discarded – undo
68 68
         return $this->tracer->trace(
69 69
             name: 'Routing',
70 70
             callback: function (SpanInterface $span) use ($request): ResponseInterface {
71
-                try {
71
+                try
72
+                {
72 73
                     $route = $this->matchRoute($request, $routeName);
73
-                } catch (RouteException $e) {
74
+                }
75
+                catch (RouteException $e)
76
+                {
74 77
                     throw new RouterException('Invalid route definition', $e->getCode(), $e);
75 78
                 }
76 79
 
77
-                if ($route === null) {
80
+                if ($route === null)
81
+                {
78 82
                     $this->eventDispatcher?->dispatch(new RouteNotFound($request));
79 83
                     throw new RouteNotFoundException($request->getUri());
80 84
                 }
@@ -109,7 +113,8 @@  discard block
 block discarded – undo
109 113
 
110 114
     public function getRoute(string $name): RouteInterface
111 115
     {
112
-        if (isset($this->routes[$name])) {
116
+        if (isset($this->routes[$name]))
117
+        {
113 118
             return $this->routes[$name];
114 119
         }
115 120
 
@@ -118,7 +123,8 @@  discard block
 block discarded – undo
118 123
 
119 124
     public function getRoutes(): array
120 125
     {
121
-        if (!empty($this->default)) {
126
+        if (!empty($this->default))
127
+        {
122 128
             return $this->routes + [null => $this->default];
123 129
         }
124 130
 
@@ -127,9 +133,12 @@  discard block
 block discarded – undo
127 133
 
128 134
     public function uri(string $route, iterable $parameters = []): UriInterface
129 135
     {
130
-        try {
136
+        try
137
+        {
131 138
             return $this->getRoute($route)->uri($parameters);
132
-        } catch (UndefinedRouteException) {
139
+        }
140
+        catch (UndefinedRouteException)
141
+        {
133 142
             //In some cases route name can be provided as controller:action pair, we can try to
134 143
             //generate such route automatically based on our default/fallback route
135 144
             return $this->castRoute($route)->uri($parameters);
@@ -141,9 +150,11 @@  discard block
 block discarded – undo
141 150
         /** @var GroupRegistry $groups */
142 151
         $groups = $this->container->get(GroupRegistry::class);
143 152
 
144
-        foreach ($routes->getCollection() as $name => $configurator) {
153
+        foreach ($routes->getCollection() as $name => $configurator)
154
+        {
145 155
             $target = $configurator->target;
146
-            if ($configurator->core !== null && $target instanceof AbstractTarget) {
156
+            if ($configurator->core !== null && $target instanceof AbstractTarget)
157
+            {
147 158
                 $target = $target->withCore($configurator->core);
148 159
             }
149 160
 
@@ -152,21 +163,25 @@  discard block
 block discarded – undo
152 163
                 : \ltrim($configurator->pattern, '/');
153 164
             $route = new Route($pattern, $target, $configurator->defaults);
154 165
 
155
-            if ($configurator->middleware !== null) {
166
+            if ($configurator->middleware !== null)
167
+            {
156 168
                 $route = $route->withMiddleware(...$configurator->middleware);
157 169
             }
158 170
 
159
-            if ($configurator->methods !== null) {
171
+            if ($configurator->methods !== null)
172
+            {
160 173
                 $route = $route->withVerbs(...$configurator->methods);
161 174
             }
162 175
 
163
-            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) {
176
+            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME)
177
+            {
164 178
                 $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());
165 179
                 $group->setPrefix($configurator->prefix);
166 180
                 $group->addRoute($name, $route);
167 181
             }
168 182
 
169
-            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) {
183
+            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME)
184
+            {
170 185
                 $this->setDefault($route);
171 186
             }
172 187
         }
@@ -177,17 +192,20 @@  discard block
 block discarded – undo
177 192
      */
178 193
     protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface
179 194
     {
180
-        foreach ($this->routes as $name => $route) {
195
+        foreach ($this->routes as $name => $route)
196
+        {
181 197
             // Matched route will return new route instance with matched parameters
182 198
             $matched = $route->match($request);
183 199
 
184
-            if ($matched !== null) {
200
+            if ($matched !== null)
201
+            {
185 202
                 $routeName = $name;
186 203
                 return $matched;
187 204
             }
188 205
         }
189 206
 
190
-        if ($this->default !== null) {
207
+        if ($this->default !== null)
208
+        {
191 209
             return $this->default->match($request);
192 210
         }
193 211
 
@@ -200,14 +218,18 @@  discard block
 block discarded – undo
200 218
      */
201 219
     protected function configure(RouteInterface $route): RouteInterface
202 220
     {
203
-        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) {
221
+        if ($route instanceof ContainerizedInterface && !$route->hasContainer())
222
+        {
204 223
             // isolating route in a given container
205 224
             $route = $route->withContainer($this->container);
206 225
         }
207 226
 
208
-        try {
227
+        try
228
+        {
209 229
             $uriHandler = $route->getUriHandler();
210
-        } catch (\Throwable) {
230
+        }
231
+        catch (\Throwable)
232
+        {
211 233
             $uriHandler = $this->uriHandler;
212 234
         }
213 235
 
@@ -239,11 +261,16 @@  discard block
 block discarded – undo
239 261
         /**
240 262
          * @var Matches $matches
241 263
          */
242
-        if (!empty($matches['name'])) {
264
+        if (!empty($matches['name']))
265
+        {
243 266
             $routeObject = $this->getRoute($matches['name']);
244
-        } elseif ($this->default !== null) {
267
+        }
268
+        elseif ($this->default !== null)
269
+        {
245 270
             $routeObject = $this->default;
246
-        } else {
271
+        }
272
+        else
273
+        {
247 274
             throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route));
248 275
         }
249 276
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         private readonly ContainerInterface $container,
53 53
         private readonly ?EventDispatcherInterface $eventDispatcher = null,
54 54
         ?TracerInterface $tracer = null,
55
-    ) {
55
+    ){
56 56
         $this->tracer = $tracer ?? new NullTracer();
57
-        $this->basePath = '/' . \ltrim($basePath, '/');
57
+        $this->basePath = '/'.\ltrim($basePath, '/');
58 58
     }
59 59
 
60 60
     /**
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
         return $this->tracer->trace(
69 69
             name: 'Routing',
70 70
             callback: function (SpanInterface $span) use ($request): ResponseInterface {
71
-                try {
71
+                try{
72 72
                     $route = $this->matchRoute($request, $routeName);
73
-                } catch (RouteException $e) {
73
+                }catch (RouteException $e){
74 74
                     throw new RouterException('Invalid route definition', $e->getCode(), $e);
75 75
                 }
76 76
 
77
-                if ($route === null) {
77
+                if ($route === null){
78 78
                     $this->eventDispatcher?->dispatch(new RouteNotFound($request));
79 79
                     throw new RouteNotFoundException($request->getUri());
80 80
                 }
81 81
 
82 82
                 $span
83
-                    ->setAttribute('request.uri', (string) $request->getUri())
83
+                    ->setAttribute('request.uri', (string)$request->getUri())
84 84
                     ->setAttribute('route.name', $routeName)
85 85
                     ->setAttribute('route.matches', $route->getMatches() ?? []);
86 86
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function getRoute(string $name): RouteInterface
111 111
     {
112
-        if (isset($this->routes[$name])) {
112
+        if (isset($this->routes[$name])){
113 113
             return $this->routes[$name];
114 114
         }
115 115
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function getRoutes(): array
120 120
     {
121
-        if (!empty($this->default)) {
121
+        if (!empty($this->default)){
122 122
             return $this->routes + [null => $this->default];
123 123
         }
124 124
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function uri(string $route, iterable $parameters = []): UriInterface
129 129
     {
130
-        try {
130
+        try{
131 131
             return $this->getRoute($route)->uri($parameters);
132
-        } catch (UndefinedRouteException) {
132
+        }catch (UndefinedRouteException){
133 133
             //In some cases route name can be provided as controller:action pair, we can try to
134 134
             //generate such route automatically based on our default/fallback route
135 135
             return $this->castRoute($route)->uri($parameters);
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
         /** @var GroupRegistry $groups */
142 142
         $groups = $this->container->get(GroupRegistry::class);
143 143
 
144
-        foreach ($routes->getCollection() as $name => $configurator) {
144
+        foreach ($routes->getCollection() as $name => $configurator){
145 145
             $target = $configurator->target;
146
-            if ($configurator->core !== null && $target instanceof AbstractTarget) {
146
+            if ($configurator->core !== null && $target instanceof AbstractTarget){
147 147
                 $target = $target->withCore($configurator->core);
148 148
             }
149 149
 
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
                 : \ltrim($configurator->pattern, '/');
153 153
             $route = new Route($pattern, $target, $configurator->defaults);
154 154
 
155
-            if ($configurator->middleware !== null) {
155
+            if ($configurator->middleware !== null){
156 156
                 $route = $route->withMiddleware(...$configurator->middleware);
157 157
             }
158 158
 
159
-            if ($configurator->methods !== null) {
159
+            if ($configurator->methods !== null){
160 160
                 $route = $route->withVerbs(...$configurator->methods);
161 161
             }
162 162
 
163
-            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) {
163
+            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME){
164 164
                 $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());
165 165
                 $group->setPrefix($configurator->prefix);
166 166
                 $group->addRoute($name, $route);
167 167
             }
168 168
 
169
-            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) {
169
+            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME){
170 170
                 $this->setDefault($route);
171 171
             }
172 172
         }
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface
179 179
     {
180
-        foreach ($this->routes as $name => $route) {
180
+        foreach ($this->routes as $name => $route){
181 181
             // Matched route will return new route instance with matched parameters
182 182
             $matched = $route->match($request);
183 183
 
184
-            if ($matched !== null) {
184
+            if ($matched !== null){
185 185
                 $routeName = $name;
186 186
                 return $matched;
187 187
             }
188 188
         }
189 189
 
190
-        if ($this->default !== null) {
190
+        if ($this->default !== null){
191 191
             return $this->default->match($request);
192 192
         }
193 193
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function configure(RouteInterface $route): RouteInterface
202 202
     {
203
-        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) {
203
+        if ($route instanceof ContainerizedInterface && !$route->hasContainer()){
204 204
             // isolating route in a given container
205 205
             $route = $route->withContainer($this->container);
206 206
         }
207 207
 
208
-        try {
208
+        try{
209 209
             $uriHandler = $route->getUriHandler();
210
-        } catch (\Throwable) {
210
+        }catch (\Throwable){
211 211
             $uriHandler = $this->uriHandler;
212 212
         }
213 213
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 $route,
231 231
                 $matches,
232 232
             )
233
-        ) {
233
+        ){
234 234
             throw new UndefinedRouteException(
235 235
                 "Unable to locate route or use default route with 'name/controller:action' pattern",
236 236
             );
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
         /**
240 240
          * @var Matches $matches
241 241
          */
242
-        if (!empty($matches['name'])) {
242
+        if (!empty($matches['name'])){
243 243
             $routeObject = $this->getRoute($matches['name']);
244
-        } elseif ($this->default !== null) {
244
+        } elseif ($this->default !== null){
245 245
             $routeObject = $this->default;
246
-        } else {
246
+        }else{
247 247
             throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route));
248 248
         }
249 249
 
Please login to merge, or discard this patch.
src/Core/tests/ExceptionsTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $container = new Container();
137 137
 
138
-        try {
138
+        try{
139 139
             $container->get('invalid');
140
-        } catch (ContainerException $e) {
140
+        }catch (ContainerException $e){
141 141
             self::assertSame(<<<MARKDOWN
142 142
                 Can't resolve `invalid`: undefined class or binding `invalid`.
143 143
                 Container trace list:
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $this->expectException(ContainerException::class);
168 168
 
169
-        try {
169
+        try{
170 170
             $container->get(ClassWithUndefinedDependency::class);
171
-        } catch (ContainerException $e) {
171
+        }catch (ContainerException $e){
172 172
             self::assertSame($message, $e->getMessage());
173 173
 
174 174
             throw $e;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -135,9 +135,12 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $container = new Container();
137 137
 
138
-        try {
138
+        try
139
+        {
139 140
             $container->get('invalid');
140
-        } catch (ContainerException $e) {
141
+        }
142
+        catch (ContainerException $e)
143
+        {
141 144
             self::assertSame(<<<MARKDOWN
142 145
                 Can't resolve `invalid`: undefined class or binding `invalid`.
143 146
                 Container trace list:
@@ -166,9 +169,12 @@  discard block
 block discarded – undo
166 169
     {
167 170
         $this->expectException(ContainerException::class);
168 171
 
169
-        try {
172
+        try
173
+        {
170 174
             $container->get(ClassWithUndefinedDependency::class);
171
-        } catch (ContainerException $e) {
175
+        }
176
+        catch (ContainerException $e)
177
+        {
172 178
             self::assertSame($message, $e->getMessage());
173 179
 
174 180
             throw $e;
Please login to merge, or discard this patch.
src/Core/tests/Scope/SideEffectTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $logger = $root->runScope(
63 63
             new Scope('test'),
64
-            static fn(?ScopeIndicatorLogger $logger): ?ScopeIndicatorLogger => $logger,
64
+            static fn(?ScopeIndicatorLogger $logger) : ?ScopeIndicatorLogger => $logger,
65 65
         );
66 66
 
67 67
         self::assertNotNull($logger);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         $logger = $root->runScope(
79 79
             new Scope('test'),
80
-            static fn(?ScopeIndicatorLogger $logger): ?ScopeIndicatorLogger => $logger,
80
+            static fn(?ScopeIndicatorLogger $logger) : ?ScopeIndicatorLogger => $logger,
81 81
         );
82 82
 
83 83
         self::assertNotNull($logger);
Please login to merge, or discard this patch.
src/Core/tests/SingletonsTest.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,9 @@  discard block
 block discarded – undo
181 181
     public function testHasShouldReturnTrueWhenSingletonIsAlreadyConstructed(): void
182 182
     {
183 183
         $container = new Container();
184
-        $class = new #[Singleton] class {};
184
+        $class = new #[Singleton] class
185
+        {
186
+};
185 187
 
186 188
         self::assertFalse($container->has($class::class));
187 189
 
@@ -194,7 +196,8 @@  discard block
 block discarded – undo
194 196
     {
195 197
         return new
196 198
         #[Singleton]
197
-        class {
199
+        class
200
+        {
198 201
             public string $baz = 'baz';
199 202
         };
200 203
     }
Please login to merge, or discard this patch.
src/Tokenizer/tests/Bootloader/TokenizerListenerBootloaderTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         $kernel = TestCoreWithTokenizer::create(directories: ['root' => __DIR__], container: $container);
58 58
         $kernel->run();
59 59
 
60
-        self::assertContains(\dirname(__DIR__) . '/Fixtures/Bootloader', $container->get(TokenizerConfig::class)->getDirectories());
60
+        self::assertContains(\dirname(__DIR__).'/Fixtures/Bootloader', $container->get(TokenizerConfig::class)->getDirectories());
61 61
     }
62 62
 
63 63
 }
Please login to merge, or discard this patch.
src/Tokenizer/tests/Attribute/TargetAttributeTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@
 block discarded – undo
20 20
     public function testToString(): void
21 21
     {
22 22
         $attribute = new TargetAttribute('foo');
23
-        self::assertSame('3dc18b19eed74479a03c069dec2e8724', (string) $attribute);
23
+        self::assertSame('3dc18b19eed74479a03c069dec2e8724', (string)$attribute);
24 24
 
25 25
         $attribute = new TargetAttribute('foo', 'bar');
26
-        self::assertSame('52ec767c53f3898bf6de6f6e88125dc8', (string) $attribute);
26
+        self::assertSame('52ec767c53f3898bf6de6f6e88125dc8', (string)$attribute);
27 27
     }
28 28
 
29 29
     public function testFilterAttrWithArgs(): void
Please login to merge, or discard this patch.