@@ -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); |
@@ -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 ( |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | $reflector = new ReflectionFunction($this->closure); |
115 | 115 | |
116 | 116 | if (!isset($this->attributes)) { |
117 | - $this->attributes = array_map(function ($attribute) { |
|
117 | + $this->attributes = array_map(function($attribute) { |
|
118 | 118 | return $this->newAttributeInstance($attribute); |
119 | 119 | }, $reflector->getAttributes()); |
120 | 120 | } |
121 | 121 | |
122 | 122 | if ($filter) { |
123 | 123 | return array_values( |
124 | - array_filter($this->attributes, function ($attribute) use ($filter) { |
|
124 | + array_filter($this->attributes, function($attribute) use ($filter) { |
|
125 | 125 | return $attribute instanceof $filter; |
126 | 126 | }) |
127 | 127 | ); |
@@ -230,11 +230,9 @@ discard block |
||
230 | 230 | try { |
231 | 231 | $args[$name] = match ((string)$param->getType()) { |
232 | 232 | 'int' => is_numeric($this->routeArgs[$name]) ? |
233 | - (int)$this->routeArgs[$name] : |
|
234 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
233 | + (int)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to int"), |
|
235 | 234 | 'float' => is_numeric($this->routeArgs[$name]) ? |
236 | - (float)$this->routeArgs[$name] : |
|
237 | - throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
235 | + (float)$this->routeArgs[$name] : throw new RuntimeException($errMsg . "Cannot cast '{$name}' to float"), |
|
238 | 236 | 'string' => $this->routeArgs[$name], |
239 | 237 | default => (new Resolver($this->registry))->resolveParam($param), |
240 | 238 | }; |
@@ -159,7 +159,7 @@ |
||
159 | 159 | $registry->add(App::class, $this); |
160 | 160 | |
161 | 161 | $registry->add(Factory::class, \Conia\Chuck\Http\Nyholm::class); |
162 | - $registry->add(Response::class, function (Registry $registry): Response { |
|
162 | + $registry->add(Response::class, function(Registry $registry): Response { |
|
163 | 163 | $factory = $registry->get(Factory::class); |
164 | 164 | assert($factory instanceof Factory); |
165 | 165 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | use Attribute; |
8 | 8 | use Conia\Chuck\Exception\RuntimeException; |
9 | 9 | |
10 | -#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD)] |
|
10 | +#[Attribute(Attribute::IS_REPEATABLE|Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD)] |
|
11 | 11 | class Inject |
12 | 12 | { |
13 | 13 | public array $args; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | use Attribute; |
8 | 8 | use Conia\Chuck\Exception\RuntimeException; |
9 | 9 | |
10 | -#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)] |
|
10 | +#[Attribute(Attribute::IS_REPEATABLE|Attribute::TARGET_CLASS)] |
|
11 | 11 | class Call |
12 | 12 | { |
13 | 13 | public array $args; |
@@ -65,8 +65,7 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $message = empty($this->tag) ? |
68 | - 'Unresolvable id: ' . $id : |
|
69 | - 'Unresolvable tagged id: ' . $this->tag . '::' . $id; |
|
68 | + 'Unresolvable id: ' . $id : 'Unresolvable tagged id: ' . $this->tag . '::' . $id; |
|
70 | 69 | |
71 | 70 | throw new NotFoundException($message); |
72 | 71 | } |