@@ -57,13 +57,13 @@ |
||
57 | 57 | |
58 | 58 | $this->mailer->expects('send')->with($email)->andThrow(new TransportException('failed')); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | $this->getHandler()->handle( |
62 | 62 | MailQueue::JOB_NAME, |
63 | 63 | 'id', |
64 | 64 | json_encode(MessageSerializer::pack($this->getMail())) |
65 | 65 | ); |
66 | - } catch (TransportException) { |
|
66 | + }catch (TransportException){ |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $core = $this->getCore(); |
91 | 91 | |
92 | - $core->setHandler(function ($req, $resp) { |
|
92 | + $core->setHandler(function ($req, $resp){ |
|
93 | 93 | echo 'hello!'; |
94 | 94 | |
95 | 95 | return $resp->withAddedHeader('hello', 'value'); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $core = $this->getCore(); |
107 | 107 | |
108 | - $core->setHandler(function ($req, $resp) { |
|
108 | + $core->setHandler(function ($req, $resp){ |
|
109 | 109 | echo 'hello!'; |
110 | 110 | $resp->getBody()->write('world '); |
111 | 111 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $dispatcher |
233 | 233 | ->expects(self::exactly(2)) |
234 | 234 | ->method('dispatch') |
235 | - ->with($this->callback(static fn(RequestReceived|RequestHandled $event): bool => true)); |
|
235 | + ->with($this->callback(static fn(RequestReceived | RequestHandled $event): bool => true)); |
|
236 | 236 | $this->container->bind(EventDispatcherInterface::class, $dispatcher); |
237 | 237 | |
238 | 238 | $core = $this->getCore(); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | TraceKind::SERVER, |
290 | 290 | ) |
291 | 291 | ->willReturnCallback( |
292 | - function ($name, $callback, $attributes, $scoped, $traceKind) { |
|
292 | + function ($name, $callback, $attributes, $scoped, $traceKind){ |
|
293 | 293 | self::assertSame($attributes, [ |
294 | 294 | 'http.method' => 'GET', |
295 | 295 | 'http.url' => 'http://example.org/path', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $core = $this->httpCore([CookiesMiddleware::class]); |
131 | 131 | $core->setHandler(fn(ServerRequestInterface $r) => $r->getCookieParams()['name']); |
132 | 132 | |
133 | - $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN'; |
|
133 | + $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN'; |
|
134 | 134 | |
135 | 135 | $response = $this->get($core, '/', [], [], ['name' => $value]); |
136 | 136 | $this->assertSame(200, $response->getStatusCode()); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $result = []; |
275 | 275 | |
276 | - foreach ($response->getHeaders() as $line) { |
|
276 | + foreach ($response->getHeaders() as $line){ |
|
277 | 277 | $cookie = explode('=', implode('', $line)); |
278 | 278 | $result[$cookie[0]] = rawurldecode(substr( |
279 | 279 | $cookie[1], |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | $this->assertNull(ContainerScope::getContainer()); |
34 | 34 | |
35 | - try { |
|
35 | + try{ |
|
36 | 36 | $this->assertTrue(ContainerScope::runScope($container, static function (): never { |
37 | 37 | throw new RuntimeException('exception'); |
38 | 38 | })); |
39 | - } catch (\Throwable $e) { |
|
39 | + }catch (\Throwable $e){ |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
84 | 84 | })); |
85 | 85 | |
86 | - try { |
|
86 | + try{ |
|
87 | 87 | $this->assertTrue($c->runScope([ |
88 | 88 | 'bucket' => new Bucket('b'), |
89 | 89 | 'other' => new SampleClass() |
90 | 90 | ], function () use ($c): void { |
91 | 91 | throw new RuntimeException('exception'); |
92 | 92 | })); |
93 | - } catch (\Throwable) { |
|
93 | + }catch (\Throwable){ |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -48,7 +48,7 @@ |
||
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 |
@@ -52,9 +52,9 @@ discard block |
||
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,13 +68,13 @@ discard block |
||
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 | } |
@@ -109,7 +109,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct( |
32 | 32 | private readonly ConfiguratorInterface $config |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function init(BinderInterface $binder, EnvironmentInterface $env): void |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | $manager = new Storage($config->getDefaultBucket()); |
50 | 50 | $distributions = $config->getDistributions(); |
51 | 51 | |
52 | - foreach ($config->getAdapters() as $name => $adapter) { |
|
52 | + foreach ($config->getAdapters() as $name => $adapter){ |
|
53 | 53 | $resolver = null; |
54 | 54 | |
55 | - if (isset($distributions[$name])) { |
|
56 | - try { |
|
55 | + if (isset($distributions[$name])){ |
|
56 | + try{ |
|
57 | 57 | $cdn = $factory->make(CdnInterface::class); |
58 | - } catch (NotFoundException $e) { |
|
58 | + }catch (NotFoundException $e){ |
|
59 | 59 | $message = 'Unable to create distribution for bucket "%s". ' |
60 | 60 | . 'Please make sure that bootloader %s is added in your application'; |
61 | 61 | $message = \sprintf($message, $name, DistributionBootloader::class); |