@@ -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 | } |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | $registry->add($router::class, $router); |
| 182 | 182 | |
| 183 | 183 | $registry->add(Factory::class, \Conia\Chuck\Psr\Nyholm::class); |
| 184 | - $registry->add(Response::class, function (Registry $registry): Response { |
|
| 184 | + $registry->add(Response::class, function(Registry $registry): Response { |
|
| 185 | 185 | $factory = $registry->get(Factory::class); |
| 186 | 186 | assert($factory instanceof Factory); |
| 187 | 187 | |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | $middlewareAttributes = $view->attributes(Middleware::class); |
| 229 | 229 | |
| 230 | 230 | return array_map( |
| 231 | - function ( |
|
| 231 | + function( |
|
| 232 | 232 | Middleware|PsrMiddleware|callable|string $middleware |
| 233 | 233 | ) use ($registry): Middleware|PsrMiddleware { |
| 234 | 234 | if ( |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if ($handler instanceof Middleware) { |
| 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 | ); |
@@ -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 | }; |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | mixed $data, |
| 75 | 75 | int $code = 200, |
| 76 | 76 | string $reasonPhrase = '', |
| 77 | - int $flags = JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR, |
|
| 77 | + int $flags = JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR, |
|
| 78 | 78 | ): Response { |
| 79 | 79 | $psrResponse = $this->createPsrResponse($code, $reasonPhrase)->withAddedHeader( |
| 80 | 80 | 'Content-Type', |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $json['traceback'] = $data->traceback; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - return json_encode($json, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); |
|
| 28 | + return json_encode($json, JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function response(mixed $data, mixed ...$args): Response |