Skip to content

Commit 74a5448

Browse files
driesvintslaravel-shiftStyleCIBot
authored
Laravel 9.x Shift (laravelio#112)
* Move `resources/lang` folder * Remove `fruitcake/laravel-cors` dependency * Streamline `$commands` property * Replace deprecated `HEADER_X_FORWARDED_ALL` constant * Upgrade to Flysystem 3.0 * Shift core files * Convert `optional()` to nullsafe operator * Remove unnecessary `$model` property * Shift to class based routes * Shift config files * Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them and merged your true customizations - where ENV variables may not be used. * Bump Laravel dependencies * Use `<env>` tags for configuration `<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI. Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/ * Adopt anonymous migrations * Shift cleanup * Apply fixes from StyleCI * wip * Apply fixes from StyleCI * wip Co-authored-by: Shift <[email protected]> Co-authored-by: StyleCI Bot <[email protected]>
1 parent 059ffe4 commit 74a5448

36 files changed

+1369
-1312
lines changed

app/Console/Kernel.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
class Kernel extends ConsoleKernel
99
{
10-
/**
11-
* The Artisan commands provided by your application.
12-
*
13-
* @var array
14-
*/
15-
protected $commands = [
16-
//
17-
];
18-
1910
/**
2011
* Define the application's command schedule.
2112
*

app/Exceptions/Handler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Handler extends ExceptionHandler
1010
/**
1111
* A list of the exception types that are not reported.
1212
*
13-
* @var array
13+
* @var array<int, class-string<Throwable>>
1414
*/
1515
protected $dontReport = [
1616
//
@@ -19,9 +19,10 @@ class Handler extends ExceptionHandler
1919
/**
2020
* A list of the inputs that are never flashed for validation exceptions.
2121
*
22-
* @var array
22+
* @var array<int, string>
2323
*/
2424
protected $dontFlash = [
25+
'current_password',
2526
'password',
2627
'password_confirmation',
2728
];

app/Http/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Kernel extends HttpKernel
1616
protected $middleware = [
1717
// \App\Http\Middleware\TrustHosts::class,
1818
\App\Http\Middleware\TrustProxies::class,
19-
\Fruitcake\Cors\HandleCors::class,
19+
\Illuminate\Http\Middleware\HandleCors::class,
2020
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
2121
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
2222
\App\Http\Middleware\TrimStrings::class,

app/Http/Middleware/TrimStrings.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ class TrimStrings extends Middleware
99
/**
1010
* The names of the attributes that should not be trimmed.
1111
*
12-
* @var array
12+
* @var array<int, string>
1313
*/
1414
protected $except = [
15+
'current_password',
1516
'password',
1617
'password_confirmation',
1718
];

app/Http/Middleware/TrustProxies.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace App\Http\Middleware;
44

5-
use Fideloper\Proxy\TrustProxies as Middleware;
5+
use Illuminate\Http\Middleware\TrustProxies as Middleware;
66
use Illuminate\Http\Request;
77

88
class TrustProxies extends Middleware
99
{
1010
/**
1111
* The trusted proxies for this application.
1212
*
13-
* @var array|string|null
13+
* @var array<int, string>|string|null
1414
*/
1515
protected $proxies;
1616

@@ -19,5 +19,10 @@ class TrustProxies extends Middleware
1919
*
2020
* @var int
2121
*/
22-
protected $headers = Request::HEADER_X_FORWARDED_ALL;
22+
protected $headers =
23+
Request::HEADER_X_FORWARDED_FOR |
24+
Request::HEADER_X_FORWARDED_HOST |
25+
Request::HEADER_X_FORWARDED_PORT |
26+
Request::HEADER_X_FORWARDED_PROTO |
27+
Request::HEADER_X_FORWARDED_AWS_ELB;
2328
}

app/Providers/EventServiceProvider.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EventServiceProvider extends ServiceProvider
1212
/**
1313
* The event listener mappings for the application.
1414
*
15-
* @var array
15+
* @var array<class-string, array<int, class-string>>
1616
*/
1717
protected $listen = [
1818
Registered::class => [
@@ -29,4 +29,14 @@ public function boot()
2929
{
3030
//
3131
}
32+
33+
/**
34+
* Determine if events and listeners should be automatically discovered.
35+
*
36+
* @return bool
37+
*/
38+
public function shouldDiscoverEvents()
39+
{
40+
return false;
41+
}
3242
}

app/Providers/RouteServiceProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ public function boot()
3131
$this->routes(function () {
3232
Route::prefix('api')
3333
->middleware('api')
34-
->namespace($this->namespace)
3534
->group(base_path('routes/api.php'));
3635

3736
Route::middleware('web')
38-
->namespace($this->namespace)
3937
->group(base_path('routes/web.php'));
4038
});
4139
}
@@ -48,7 +46,7 @@ public function boot()
4846
protected function configureRateLimiting()
4947
{
5048
RateLimiter::for('api', function (Request $request) {
51-
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
49+
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
5250
});
5351
}
5452
}

composer.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@
99
"license": "MIT",
1010
"require": {
1111
"php": "8.1.*",
12-
"blade-ui-kit/blade-heroicons": "^0.3.1",
13-
"facade/ignition": "^2.5",
14-
"fideloper/proxy": "^4.4",
15-
"fruitcake/laravel-cors": "^2.0",
16-
"guzzlehttp/guzzle": "^7.0.1",
17-
"laravel/framework": "^8.12",
18-
"laravel/tinker": "^2.5",
19-
"ramsey/uuid": "^4.1"
12+
"blade-ui-kit/blade-heroicons": "^1.3",
13+
"guzzlehttp/guzzle": "^7.2",
14+
"laravel/framework": "^9.7",
15+
"laravel/tinker": "^2.7",
16+
"ramsey/uuid": "^4.3",
17+
"league/flysystem-aws-s3-v3": "^3.0",
18+
"spatie/laravel-ignition": "^1.1"
2019
},
2120
"require-dev": {
22-
"doctrine/dbal": "^3.0",
21+
"doctrine/dbal": "^3.3",
2322
"fakerphp/faker": "^1.9.1",
24-
"mockery/mockery": "^1.4.2",
25-
"nunomaduro/collision": "^5.0",
26-
"phpunit/phpunit": "^9.3.3"
23+
"mockery/mockery": "^1.4.4",
24+
"nunomaduro/collision": "^6.1",
25+
"phpunit/phpunit": "^9.5.10"
2726
},
2827
"config": {
2928
"optimize-autoloader": true,
@@ -59,6 +58,9 @@
5958
],
6059
"post-create-project-cmd": [
6160
"@php artisan key:generate --ansi"
61+
],
62+
"post-update-cmd": [
63+
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
6264
]
6365
}
64-
}
66+
}

0 commit comments

Comments
 (0)