Skip to content

Commit

Permalink
chore: Upgrade to Laravel 10
Browse files Browse the repository at this point in the history
This bumps the minimum PHP requirement to 8.1. No other significant
changes of note.
  • Loading branch information
zooley committed Jan 18, 2024
1 parent 7e705c6 commit e187fee
Show file tree
Hide file tree
Showing 25 changed files with 1,418 additions and 1,542 deletions.
9 changes: 2 additions & 7 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,16 @@ class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

Expand Down
22 changes: 1 addition & 21 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@

class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];

/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
Expand All @@ -43,10 +25,8 @@ class Handler extends ExceptionHandler

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
use AuthorizesRequests, ValidatesRequests;
}
5 changes: 2 additions & 3 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
//\App\Modules\Listeners\Http\Middleware\RegisterListeners::class,
\App\Modules\Users\Http\Middleware\LastActivity::class,
\App\Modules\Menus\Http\Middleware\SetActiveMenu::class,
\App\Http\Middleware\HandleInertiaRequests::class
],

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
//\App\Modules\Listeners\Http\Middleware\RegisterListeners::class,
\App\Modules\Core\Http\Middleware\ApiDocs::class,
],
];
Expand All @@ -70,6 +68,7 @@ class Kernel extends HttpKernel
'can' => \App\Halcyon\Access\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
//'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
//'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
//'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
Expand Down
12 changes: 4 additions & 8 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
protected function redirectTo(Request $request): ?string
{
if (! $request->expectsJson()) {
return route('login');
}
return $request->expectsJson() ? null : route('login');
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class EncryptCookies extends Middleware
protected $except = [
//
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/PreventRequestsDuringMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class PreventRequestsDuringMaintenance extends Middleware
protected $except = [
//
];
}
}
10 changes: 4 additions & 6 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
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(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\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;

Expand All @@ -29,4 +27,4 @@ public function handle(Request $request, Closure $next, ...$guards)

return $next($request);
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ class TrimStrings extends Middleware
'password',
'password_confirmation',
];
}
}
4 changes: 2 additions & 2 deletions app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class TrustHosts extends Middleware
*
* @return array<int, string|null>
*/
public function hosts()
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class TrustProxies extends Middleware
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
}
22 changes: 22 additions & 0 deletions app/Http/Middleware/ValidateSignature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Routing\Middleware\ValidateSignature as Middleware;

class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class VerifyCsrfToken extends Middleware
protected $except = [
//
];
}
}
14 changes: 5 additions & 9 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@

namespace App\Providers;

// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;

class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
//
];

/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
public function boot(): void
{
$this->registerPolicies();

//
}
}
}
6 changes: 2 additions & 4 deletions app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
Broadcast::routes();

require base_path('routes/channels.php');
}
}
}
12 changes: 4 additions & 8 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
Expand All @@ -22,21 +22,17 @@ class EventServiceProvider extends ServiceProvider

/**
* Register any events for your application.
*
* @return void
*/
public function boot()
public function boot(): void
{
//
}

/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
public function shouldDiscoverEvents(): bool
{
return false;
}
}
}
8 changes: 2 additions & 6 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class RouteServiceProvider extends ServiceProvider

/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
public function boot(): void
{
$this->configureRateLimiting();

Expand All @@ -40,10 +38,8 @@ public function boot()

/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
protected function configureRateLimiting(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["cms", "halcyon", "laravel", "hpc"],
"license": "Purdue University Open Source License",
"require": {
"php": "^8.0.2",
"php": "^8.1",
"adldap2/adldap2": "^10.4.3",
"apereo/phpcas": "^1.6.0",
"cilogon/oauth2-cilogon": "^1.1.6",
Expand All @@ -15,23 +15,23 @@
"inertiajs/inertia-laravel": "*",
"jenssegers/agent": "^2.6.4",
"lab404/laravel-impersonate": "^1.7.3",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"nathanheffley/laravel-slack-blocks": "^2.3.0",
"nwidart/laravel-modules": "^9.0.6",
"openspout/openspout": "^4.12.1",
"nwidart/laravel-modules": "^10.0.4",
"openspout/openspout": "^4.23.0",
"phpdocumentor/reflection-docblock": "^5.3.0",
"spatie/laravel-sitemap": "^6.3"
"spatie/laravel-sitemap": "^7.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading

0 comments on commit e187fee

Please sign in to comment.