@@ -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); |
@@ -153,7 +153,7 @@ |
||
153 | 153 | $registry->add(ResponseFactoryInterface::class, \Nyholm\Psr7\Factory\Psr17Factory::class); |
154 | 154 | $registry->add(StreamFactoryInterface::class, \Nyholm\Psr7\Factory\Psr17Factory::class); |
155 | 155 | $registry->add(ResponseFactory::class, new ResponseFactory($this->registry)); |
156 | - $registry->add(ServerRequestInterface::class, function (): ServerRequestInterface { |
|
156 | + $registry->add(ServerRequestInterface::class, function(): ServerRequestInterface { |
|
157 | 157 | try { |
158 | 158 | $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory(); |
159 | 159 | $creator = new \Nyholm\Psr7Server\ServerRequestCreator( |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | $message = empty($this->tag) ? |
70 | - 'Unresolvable id: ' . $id : |
|
71 | - 'Unresolvable tagged id: ' . $this->tag . '::' . $id; |
|
70 | + 'Unresolvable id: ' . $id : 'Unresolvable tagged id: ' . $this->tag . '::' . $id; |
|
72 | 71 | |
73 | 72 | throw new NotFoundException($message); |
74 | 73 | } |
@@ -135,8 +134,7 @@ discard block |
||
135 | 134 | // If $paramName is emtpy an existing unbound entry should |
136 | 135 | // be found on first try. |
137 | 136 | return isset($this->entries[$id . $paramName]) ? |
138 | - $this->resolveEntry($this->entries[$id . $paramName]) : |
|
139 | - $this->get($id); |
|
137 | + $this->resolveEntry($this->entries[$id . $paramName]) : $this->get($id); |
|
140 | 138 | } |
141 | 139 | |
142 | 140 | protected function reifyAndReturn(Entry $entry, mixed $value): mixed |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if ($handler instanceof MiddlewareInterface) { |
39 | 39 | return $handler( |
40 | 40 | $request, |
41 | - function (Request $req) use ($queue): Response { |
|
41 | + function(Request $req) use ($queue): Response { |
|
42 | 42 | return $this->handle(array_slice($queue, 1), $req); |
43 | 43 | } |
44 | 44 | ); |
@@ -212,7 +212,7 @@ |
||
212 | 212 | $middlewareAttributes = $view->attributes(MiddlewareInterface::class); |
213 | 213 | |
214 | 214 | return array_map( |
215 | - function ( |
|
215 | + function( |
|
216 | 216 | MiddlewareInterface|PsrMiddlewareInterface|callable|string $middleware |
217 | 217 | ) use ($registry): MiddlewareInterface|PsrMiddlewareInterface { |
218 | 218 | if ( |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | $reflector = new ReflectionFunction($this->closure); |
128 | 128 | |
129 | 129 | if (!isset($this->attributes)) { |
130 | - $this->attributes = array_map(function ($attribute) { |
|
130 | + $this->attributes = array_map(function($attribute) { |
|
131 | 131 | return $this->newAttributeInstance($attribute); |
132 | 132 | }, $reflector->getAttributes()); |
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($filter) { |
136 | - return array_filter($this->attributes, function ($attribute) use ($filter) { |
|
136 | + return array_filter($this->attributes, function($attribute) use ($filter) { |
|
137 | 137 | return $attribute instanceof $filter; |
138 | 138 | }); |
139 | 139 | } |
@@ -238,11 +238,9 @@ discard block |
||
238 | 238 | try { |
239 | 239 | $args[$name] = match ((string)$param->getType()) { |
240 | 240 | 'int' => is_numeric($this->routeArgs[$name]) ? |
241 | - (int)$this->routeArgs[$name] : |
|
242 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
241 | + (int)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
243 | 242 | 'float' => is_numeric($this->routeArgs[$name]) ? |
244 | - (float)$this->routeArgs[$name] : |
|
245 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
243 | + (float)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
246 | 244 | 'string' => $this->routeArgs[$name], |
247 | 245 | default => (new Resolver($this->registry))->resolveParam($param), |
248 | 246 | }; |