chore: fix various qodana issues

This commit is contained in:
James Cole
2023-06-04 06:30:22 +02:00
parent 160c364d2a
commit 688ca8e374
20 changed files with 56 additions and 106 deletions

View File

@@ -42,7 +42,7 @@ class AcceptHeaders
* @return Response
* @throws BadHttpHeaderException
*/
public function handle($request, $next): mixed
public function handle(Request $request, callable $next): mixed
{
$method = $request->getMethod();
$accepts = ['application/x-www-form-urlencoded', 'application/json', 'application/vnd.api+json', 'application/octet-stream', '*/*'];
@@ -67,7 +67,7 @@ class AcceptHeaders
}
// throw bad request if trace id is not a UUID
$uuid = $request->header('X-Trace-Id', null);
$uuid = $request->header('X-Trace-Id');
if (is_string($uuid) && '' !== trim($uuid) && (preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)) !== 1)) {
throw new BadRequestHttpException('Bad X-Trace-Id header.');
}