From 7968abd3596b6725d269961e4a2b54be9d0e52a3 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Thu, 19 May 2022 14:10:37 +0200 Subject: [PATCH] Fixed a problem with returned types - middleware --- app/Http/Middleware/Core.php | 4 +--- app/Http/Middleware/RedirectIfAuthenticated.php | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/Http/Middleware/Core.php b/app/Http/Middleware/Core.php index 219e3b7..b101e8e 100644 --- a/app/Http/Middleware/Core.php +++ b/app/Http/Middleware/Core.php @@ -5,14 +5,12 @@ declare(strict_types=1); namespace App\Http\Middleware; use Closure; -use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; class Core { - public function handle(Request $request, Closure $next): Response|RedirectResponse + public function handle(Request $request, Closure $next): mixed { return $next($request) ->header('Access-Control-Allow-Origin', '*') diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index b909a8b..bbc3956 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -6,15 +6,13 @@ namespace App\Http\Middleware; use App\Providers\RouteServiceProvider; use Closure; -use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; use Illuminate\Support\Facades\Auth; class RedirectIfAuthenticated { - public function handle(Request $request, Closure $next, ...$guards): Response|RedirectResponse + public function handle(Request $request, Closure $next, ...$guards): mixed { $guards = empty($guards) ? [null] : $guards;