From b3d2b7e30456654d1a090f7322390882c16fe73c Mon Sep 17 00:00:00 2001 From: zak39 Date: Thu, 22 Aug 2024 18:42:17 +0200 Subject: [PATCH 1/2] fix(middleware): Return a JSONResponse I replace a void return by JSONResponse. --- lib/Middleware/IsGeneralManagerMiddleware.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Middleware/IsGeneralManagerMiddleware.php b/lib/Middleware/IsGeneralManagerMiddleware.php index b36a66bb3..c3a2d9214 100644 --- a/lib/Middleware/IsGeneralManagerMiddleware.php +++ b/lib/Middleware/IsGeneralManagerMiddleware.php @@ -52,12 +52,14 @@ public function beforeController($controller, $methodName): void { return; } - public function afterException($controller, $methodName, Exception $exception): void { + public function afterException($controller, $methodName, Exception $exception): JSONResponse { if ($exception instanceof AccessDeniedException) { return new JSONResponse([ 'status' => 'forbidden', 'msg' => 'You are not allowed to perform this action' ], Http::STATUS_FORBIDDEN); } + + return new JSONResponse([]); } } From 1de07db64e7dc085664c79323c4cd370b227e73a Mon Sep 17 00:00:00 2001 From: zak39 Date: Thu, 22 Aug 2024 18:45:28 +0200 Subject: [PATCH 2/2] chore(): Run composer run cs:fix --- lib/Middleware/IsGeneralManagerMiddleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Middleware/IsGeneralManagerMiddleware.php b/lib/Middleware/IsGeneralManagerMiddleware.php index c3a2d9214..dedafbe48 100644 --- a/lib/Middleware/IsGeneralManagerMiddleware.php +++ b/lib/Middleware/IsGeneralManagerMiddleware.php @@ -60,6 +60,6 @@ public function afterException($controller, $methodName, Exception $exception): ], Http::STATUS_FORBIDDEN); } - return new JSONResponse([]); + return new JSONResponse([]); } }