Skip to content

Commit 31e57f3

Browse files
Merge pull request #33 from ExposureSoftware/shift-157061
Laravel 10.x Shift
2 parents 8976287 + cbe67dc commit 31e57f3

39 files changed

Lines changed: 162 additions & 428 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/storage/*.key
55
/vendor
66
.env
7-
.phpunit.result.cache
7+
/.phpunit.cache
88
Homestead.json
99
Homestead.yaml
1010
npm-debug.log

app/Console/Kernel.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,16 @@ class Kernel extends ConsoleKernel
99
{
1010
/**
1111
* Define the application's command schedule.
12-
*
13-
* @return void
1412
*/
15-
protected function schedule(Schedule $schedule)
13+
protected function schedule(Schedule $schedule): void
1614
{
17-
// $schedule->command('inspire')
18-
// ->hourly();
15+
// $schedule->command('inspire')->hourly();
1916
}
2017

2118
/**
2219
* Register the commands for the application.
23-
*
24-
* @return void
2520
*/
26-
protected function commands()
21+
protected function commands(): void
2722
{
2823
$this->load(__DIR__.'/Commands');
2924

app/Exceptions/Handler.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,7 @@
88
class Handler extends ExceptionHandler
99
{
1010
/**
11-
* A list of exception types with their corresponding custom log levels.
12-
*
13-
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
14-
*/
15-
protected $levels = [
16-
//
17-
];
18-
19-
/**
20-
* A list of the exception types that are not reported.
21-
*
22-
* @var array<int, class-string<\Throwable>>
23-
*/
24-
protected $dontReport = [
25-
//
26-
];
27-
28-
/**
29-
* A list of the inputs that are never flashed to the session on validation exceptions.
11+
* The list of the inputs that are never flashed to the session on validation exceptions.
3012
*
3113
* @var array<int, string>
3214
*/
@@ -38,10 +20,8 @@ class Handler extends ExceptionHandler
3820

3921
/**
4022
* Register the exception handling callbacks for the application.
41-
*
42-
* @return void
4323
*/
44-
public function register()
24+
public function register(): void
4525
{
4626
$this->reportable(function (Throwable $e) {
4727
//

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ public function __construct()
4343

4444
/**
4545
* Get a validator for an incoming registration request.
46-
*
47-
* @return \Illuminate\Contracts\Validation\Validator
4846
*/
49-
protected function validator(array $data)
47+
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator
5048
{
5149
return Validator::make($data, [
5250
'name' => ['required', 'string', 'max:255'],
@@ -57,10 +55,8 @@ protected function validator(array $data)
5755

5856
/**
5957
* Create a new user instance after a valid registration.
60-
*
61-
* @return \App\User
6258
*/
63-
protected function create(array $data)
59+
protected function create(array $data): User
6460
{
6561
return User::create([
6662
'name' => $data['name'],

app/Http/Controllers/Controller.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
namespace App\Http\Controllers;
44

55
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6-
use Illuminate\Foundation\Bus\DispatchesJobs;
76
use Illuminate\Foundation\Validation\ValidatesRequests;
87
use Illuminate\Routing\Controller as BaseController;
98

109
class Controller extends BaseController
1110
{
12-
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
11+
use AuthorizesRequests, ValidatesRequests;
1312
}

app/Http/Kernel.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,27 @@ class Kernel extends HttpKernel
4040

4141
'api' => [
4242
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
43-
'throttle:api',
43+
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
4444
\Illuminate\Routing\Middleware\SubstituteBindings::class,
4545
],
4646
];
4747

4848
/**
49-
* The application's route middleware.
49+
* The application's middleware aliases.
5050
*
51-
* These middleware may be assigned to groups or used individually.
51+
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
5252
*
5353
* @var array<string, class-string|string>
5454
*/
55-
protected $routeMiddleware = [
55+
protected $middlewareAliases = [
5656
'auth' => \App\Http\Middleware\Authenticate::class,
5757
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
5858
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
5959
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
6060
'can' => \Illuminate\Auth\Middleware\Authorize::class,
6161
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
6262
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
63+
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
6364
'signed' => \App\Http\Middleware\ValidateSignature::class,
6465
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
6566
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,

app/Http/Middleware/Authenticate.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
namespace App\Http\Middleware;
44

55
use Illuminate\Auth\Middleware\Authenticate as Middleware;
6+
use Illuminate\Http\Request;
67

78
class Authenticate extends Middleware
89
{
910
/**
1011
* Get the path the user should be redirected to when they are not authenticated.
11-
*
12-
* @param \Illuminate\Http\Request $request
13-
* @return string
1412
*/
15-
protected function redirectTo($request)
13+
protected function redirectTo(Request $request): ?string
1614
{
17-
if (! $request->expectsJson()) {
18-
return route('login');
19-
}
15+
return $request->expectsJson() ? null : route('login');
2016
}
2117
}

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66
use Closure;
77
use Illuminate\Http\Request;
88
use Illuminate\Support\Facades\Auth;
9+
use Symfony\Component\HttpFoundation\Response;
910

1011
class RedirectIfAuthenticated
1112
{
1213
/**
1314
* Handle an incoming request.
1415
*
1516
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
16-
* @param string|null ...$guards
17-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
1817
*/
19-
public function handle(Request $request, Closure $next, ...$guards)
18+
public function handle(Request $request, Closure $next, string ...$guards): Response
2019
{
2120
$guards = empty($guards) ? [null] : $guards;
2221

app/Http/Middleware/TrustHosts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TrustHosts extends Middleware
1111
*
1212
* @return array<int, string|null>
1313
*/
14-
public function hosts()
14+
public function hosts(): array
1515
{
1616
return [
1717
$this->allSubdomainsOfApplicationUrl(),

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@ class AppServiceProvider extends ServiceProvider
88
{
99
/**
1010
* Register any application services.
11-
*
12-
* @return void
1311
*/
14-
public function register()
12+
public function register(): void
1513
{
1614
//
1715
}
1816

1917
/**
2018
* Bootstrap any application services.
21-
*
22-
* @return void
2319
*/
24-
public function boot()
20+
public function boot(): void
2521
{
2622
//
2723
}

0 commit comments

Comments
 (0)