@@ -44,7 +44,7 @@ |
||
44 | 44 | if ($handler instanceof MiddlewareInterface) { |
45 | 45 | return $handler( |
46 | 46 | $request, |
47 | - function ( |
|
47 | + function( |
|
48 | 48 | Request $req |
49 | 49 | ) use ($queue): Response { |
50 | 50 | return $this->handle( |
@@ -120,7 +120,7 @@ |
||
120 | 120 | $registry->addAnyway(ResponseFactoryInterface::class, \Nyholm\Psr7\Factory\Psr17Factory::class); |
121 | 121 | $registry->addAnyway(StreamFactoryInterface::class, \Nyholm\Psr7\Factory\Psr17Factory::class); |
122 | 122 | $registry->addAnyway(ResponseFactory::class, new ResponseFactory($this->registry)); |
123 | - $registry->addAnyway(ServerRequestInterface::class, function (): ServerRequestInterface { |
|
123 | + $registry->addAnyway(ServerRequestInterface::class, function(): ServerRequestInterface { |
|
124 | 124 | try { |
125 | 125 | $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory(); |
126 | 126 | $creator = new \Nyholm\Psr7Server\ServerRequestCreator( |
@@ -180,8 +180,7 @@ |
||
180 | 180 | // If $paramName is emtpy an existing unbound entry should |
181 | 181 | // be found on first try. |
182 | 182 | return isset($this->entries[$id . $paramName]) ? |
183 | - $this->resolveEntry($this->entries[$id . $paramName]) : |
|
184 | - $this->get($id); |
|
183 | + $this->resolveEntry($this->entries[$id . $paramName]) : $this->get($id); |
|
185 | 184 | } |
186 | 185 | |
187 | 186 | public function resolveParam(ReflectionParameter $param): mixed |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public static function encode( |
12 | 12 | mixed $data, |
13 | - int $flags = JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR |
|
13 | + int $flags = JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR |
|
14 | 14 | ): string { |
15 | 15 | if ($data instanceof Traversable) { |
16 | 16 | return json_encode(iterator_to_array($data), $flags); |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | $reflector = new ReflectionFunction($this->closure); |
130 | 130 | |
131 | 131 | if (!isset($this->attributes)) { |
132 | - $this->attributes = array_map(function ($attribute) { |
|
132 | + $this->attributes = array_map(function($attribute) { |
|
133 | 133 | return $attribute->newInstance(); |
134 | 134 | }, $reflector->getAttributes()); |
135 | 135 | } |
136 | 136 | |
137 | 137 | if ($filter) { |
138 | - return array_filter($this->attributes, function ($attribute) use ($filter) { |
|
138 | + return array_filter($this->attributes, function($attribute) use ($filter) { |
|
139 | 139 | return $attribute instanceof $filter; |
140 | 140 | }); |
141 | 141 | } |
@@ -200,11 +200,9 @@ discard block |
||
200 | 200 | try { |
201 | 201 | $args[$name] = match ((string)$param->getType()) { |
202 | 202 | 'int' => is_numeric($this->routeArgs[$name]) ? |
203 | - (int)$this->routeArgs[$name] : |
|
204 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
203 | + (int)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
205 | 204 | 'float' => is_numeric($this->routeArgs[$name]) ? |
206 | - (float)$this->routeArgs[$name] : |
|
207 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
205 | + (float)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
208 | 206 | 'string' => $this->routeArgs[$name], |
209 | 207 | default => $this->registry->resolveParam($param), |
210 | 208 | }; |