Skip to content

Commit 28a9cf4

Browse files
committed
L10: laravel/laravel
1 parent 5bbf5db commit 28a9cf4

33 files changed

+102
-167
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
### Laravel ###
2+
/.phpunit.cache
23
/node_modules
34
/public/build
45
/public/hot

app/Console/Kernel.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ class Kernel extends ConsoleKernel
2121
{
2222
/**
2323
* Define the application's command schedule.
24-
*
25-
* @param \Illuminate\Console\Scheduling\Schedule $schedule
26-
*
27-
* @return void
2824
*/
29-
protected function schedule(Schedule $schedule)
25+
protected function schedule(Schedule $schedule): void
3026
{
3127
$schedule->command('invites:purge')
3228
->daily();
@@ -78,10 +74,8 @@ protected function schedule(Schedule $schedule)
7874

7975
/**
8076
* Register the commands for the application.
81-
*
82-
* @return void
8377
*/
84-
protected function commands()
78+
protected function commands(): void
8579
{
8680
$this->load(__DIR__ . '/Commands');
8781

app/Exceptions/Handler.php

-18
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@
1212

1313
class Handler extends ExceptionHandler
1414
{
15-
/**
16-
* A list of exception types with their corresponding custom log levels.
17-
*
18-
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
19-
*/
20-
protected $levels = [
21-
//
22-
];
23-
24-
/**
25-
* A list of the exception types that are not reported.
26-
*
27-
* @var array<int, class-string<\Throwable>>
28-
*/
29-
protected $dontReport = [
30-
//
31-
];
32-
3315
/**
3416
* A list of the inputs that are never flashed to the session on validation exceptions.
3517
*

app/Http/Controllers/Controller.php

+1-2
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

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,28 @@ class Kernel extends HttpKernel
4242

4343
'api' => [
4444
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
45-
'throttle:api',
45+
\Illuminate\Routing\Middleware\ThrottleRequests::class . ':api',
4646
\Illuminate\Routing\Middleware\SubstituteBindings::class,
4747
\LaravelDoctrine\ORM\Middleware\SubstituteBindings::class,
4848
],
4949
];
5050

5151
/**
52-
* The application's route middleware.
52+
* The application's middleware aliases.
5353
*
54-
* These middleware may be assigned to groups or used individually.
54+
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
5555
*
5656
* @var array<string, class-string|string>
5757
*/
58-
protected $routeMiddleware = [
58+
protected $middlewareAliases = [
5959
'auth' => \App\Http\Middleware\Authenticate::class,
6060
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
6161
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
6262
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
6363
'can' => \Illuminate\Auth\Middleware\Authorize::class,
6464
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
6565
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
66+
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
6667
'signed' => \App\Http\Middleware\ValidateSignature::class,
6768
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequestsWithRedis::class,
6869
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,

app/Http/Middleware/Authenticate.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,20 +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-
*
14-
* @return string|null
1512
*/
16-
protected function redirectTo($request)
13+
protected function redirectTo(Request $request): ?string
1714
{
18-
if (! $request->expectsJson()) {
19-
return route('login');
20-
}
15+
return $request->expectsJson() ? null : route('login');
2116
}
2217
}

app/Http/Middleware/RedirectIfAuthenticated.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -6,19 +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
*
15-
* @param \Illuminate\Http\Request $request
16-
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
17-
* @param string|null ...$guards
18-
*
19-
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
16+
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
2017
*/
21-
public function handle(Request $request, Closure $next, ...$guards)
18+
public function handle(Request $request, Closure $next, string ...$guards): Response
2219
{
2320
$guards = empty($guards) ? [null] : $guards;
2421

app/Http/Middleware/TrustHosts.php

+1-1
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

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ class AppServiceProvider extends ServiceProvider
1414
{
1515
/**
1616
* Register any application services.
17-
*
18-
* @return void
1917
*/
20-
public function register()
18+
public function register(): void
2119
{
2220
$this->app->singleton(PasswordStore::class, function ($app) {
2321
$passwordStoreManager = new PasswordStoreManager($app);
@@ -28,10 +26,8 @@ public function register()
2826

2927
/**
3028
* Bootstrap any application services.
31-
*
32-
* @return void
3329
*/
34-
public function boot()
30+
public function boot(): void
3531
{
3632
// Globally set the money format
3733
setlocale(LC_MONETARY, 'en_GB.UTF-8');

app/Providers/AuthServiceProvider.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,14 @@ class AuthServiceProvider extends ServiceProvider
2020
* @var array<class-string, class-string>
2121
*/
2222
protected $policies = [
23-
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
23+
//
2424
];
2525

2626
/**
2727
* Register any authentication / authorization services.
28-
*
29-
* @return void
3028
*/
31-
public function boot(EntityManagerInterface $em, PasswordStore $passwordStore)
29+
public function boot(EntityManagerInterface $em, PasswordStore $passwordStore): void
3230
{
33-
$this->registerPolicies();
34-
3531
Auth::provider('hms', function ($app, array $config) use ($em, $passwordStore) {
3632
return new HmsUserProvider($app['hash'], $em, $config['model'], $passwordStore);
3733
});

app/Providers/BroadcastServiceProvider.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider
99
{
1010
/**
1111
* Bootstrap any application services.
12-
*
13-
* @return void
1412
*/
15-
public function boot()
13+
public function boot(): void
1614
{
1715
Broadcast::routes();
1816

app/Providers/EventServiceProvider.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@ class EventServiceProvider extends ServiceProvider
4040

4141
/**
4242
* Register any events for your application.
43-
*
44-
* @return void
4543
*/
46-
public function boot()
44+
public function boot(): void
4745
{
4846
//
4947
}
5048

5149
/**
5250
* Determine if events and listeners should be automatically discovered.
53-
*
54-
* @return bool
5551
*/
56-
public function shouldDiscoverEvents()
52+
public function shouldDiscoverEvents(): bool
5753
{
5854
return true;
5955
}

app/Providers/HmsHelperServiceProvider.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ class HmsHelperServiceProvider extends ServiceProvider
1010
{
1111
/**
1212
* Bootstrap the application services.
13-
*
14-
* @return void
1513
*/
16-
public function boot()
14+
public function boot(): void
1715
{
1816
//
1917
}
2018

2119
/**
2220
* Register the application services.
23-
*
24-
* @return void
2521
*/
26-
public function register()
22+
public function register(): void
2723
{
2824
$this->app->bind('Features', function () {
2925
return new Features;

app/Providers/HorizonServiceProvider.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
1111
{
1212
/**
1313
* Register any application services.
14-
*
15-
* @return void
1614
*/
17-
public function register()
15+
public function register(): void
1816
{
1917
$this->app->bind(HorizonSafeQueueWorkCommand::class, function ($app) {
2018
return new HorizonSafeQueueWorkCommand($app['safeQueue.worker'], $app['cache.store']);

app/Providers/RepositoryServiceProvider.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@ class RepositoryServiceProvider extends ServiceProvider
1111
{
1212
/**
1313
* Bootstrap the application services.
14-
*
15-
* @return void
1614
*/
17-
public function boot()
15+
public function boot(): void
1816
{
1917
//
2018
}
2119

2220
/**
2321
* Register the application services.
24-
*
25-
* @return void
2622
*/
27-
public function register()
23+
public function register(): void
2824
{
2925
foreach (config('repositories.repositories') as $repository) {
3026
$entity = config('repositories.entity_namespace') . '\\' . $repository;

app/Providers/RouteServiceProvider.php

+5-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class RouteServiceProvider extends ServiceProvider
1212
{
1313
/**
14-
* The path to the "home" route for your application.
14+
* The path to your application's "home" route.
1515
*
1616
* Typically, users are redirected here after authentication.
1717
*
@@ -30,12 +30,12 @@ class RouteServiceProvider extends ServiceProvider
3030

3131
/**
3232
* Define your route model bindings, pattern filters, and other route configuration.
33-
*
34-
* @return void
3533
*/
36-
public function boot()
34+
public function boot(): void
3735
{
38-
$this->configureRateLimiting();
36+
RateLimiter::for('api', function (Request $request) {
37+
return Limit::perMinute(60)->by($request->user()?->getId() ?: $request->ip());
38+
});
3939

4040
$this->routes(function () {
4141
Route::middleware('api')
@@ -48,16 +48,4 @@ public function boot()
4848
->group(base_path('routes/web.php'));
4949
});
5050
}
51-
52-
/**
53-
* Configure the rate limiters for the application.
54-
*
55-
* @return void
56-
*/
57-
protected function configureRateLimiting()
58-
{
59-
RateLimiter::for('api', function (Request $request) {
60-
return Limit::perMinute(60)->by($request->user()?->getId() ?: $request->ip());
61-
});
62-
}
6351
}

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"optimize-autoloader": true,
102102
"allow-plugins": {
103103
"composer/package-versions-deprecated": true,
104+
"pestphp/pest-plugin": true,
104105
"php-http/discovery": true
105106
}
106107
},

0 commit comments

Comments
 (0)