1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Framework: Upgrade from Laravel 9 to 10

Following Laravel guidance and GitHub diff.
Not yet in tested state with app-specific changes made.
This commit is contained in:
Dan Brown
2024-03-16 15:12:14 +00:00
parent 07761524af
commit 794671ef32
20 changed files with 253 additions and 224 deletions

View File

@ -45,11 +45,11 @@ class Kernel extends HttpKernel
];
/**
* The application's route middleware.
* The application's middleware aliases.
*
* @var array
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \BookStack\Http\Middleware\Authenticate::class,
'can' => \BookStack\Http\Middleware\CheckUserHasPermission::class,
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,

View File

@ -6,19 +6,16 @@ use BookStack\App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
*
* @return mixed
* @param Closure(Request): (Response) $next
*/
public function handle(Request $request, Closure $next, ...$guards)
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;

View File

@ -9,7 +9,7 @@ class ThrottleApiRequests extends Middleware
/**
* Resolve the number of attempts if the user is authenticated or not.
*/
protected function resolveMaxAttempts($request, $maxAttempts)
protected function resolveMaxAttempts($request, $maxAttempts): int
{
return (int) config('api.requests_per_minute');
}

View File

@ -9,9 +9,9 @@ class TrustHosts extends Middleware
/**
* Get the host patterns that should be trusted.
*
* @return array
* @return array<int, string|null>
*/
public function hosts()
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),