Skip to content

Commit b735ddc

Browse files
author
DKravtsov
committed
PHP 8.1 and Laravel 9
1 parent 088b6b9 commit b735ddc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3811
-5358
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trim_trailing_whitespace = true
1111
[*.md]
1212
trim_trailing_whitespace = false
1313

14-
[*.yml]
14+
[*.{yml,yaml}]
1515
indent_size = 2
1616

1717
[{composer.json,Makefile}]

.env.dev

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ APP_DEBUG=true
55
APP_URL=http://localhost
66

77
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
89
LOG_LEVEL=debug
910

1011
DB_CONNECTION=mysql
@@ -16,7 +17,7 @@ DB_PASSWORD=secret
1617

1718
BROADCAST_DRIVER=log
1819
CACHE_DRIVER=file
19-
FILESYSTEM_DRIVER=local
20+
FILESYSTEM_DISK=local
2021
QUEUE_CONNECTION=sync
2122
SESSION_DRIVER=file
2223
SESSION_LIFETIME=120
@@ -33,7 +34,7 @@ MAIL_PORT=1025
3334
MAIL_USERNAME=null
3435
MAIL_PASSWORD=null
3536
MAIL_ENCRYPTION=null
36-
MAIL_FROM_ADDRESS=null
37+
MAIL_FROM_ADDRESS="hello@example.com"
3738
MAIL_FROM_NAME="${APP_NAME}"
3839

3940
AWS_ACCESS_KEY_ID=

.php-cs-fixer.dist.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@
1919
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
2020
'single_blank_line_before_namespace' => true,
2121
'blank_line_after_namespace' => true,
22-
'blank_line_after_opening_tag' => true,
22+
'phpdoc_align' => ['align' => 'left'],
23+
'types_spaces' => 'single',
2324

2425
// skip list (see ecs.php)
2526
'no_multiline_whitespace_around_double_arrow' => false,
2627
'phpdoc_no_package' => false,
2728
'phpdoc_summary' => false,
2829
'phpdoc_separation' => false,
30+
'blank_line_after_opening_tag' => false,
2931
'class_attributes_separation' => false,
3032
'no_blank_lines_before_namespace' => false,
3133
'not_operator_with_successor_space' => false,
3234
'single_line_throw' => false,
33-
34-
])->setFinder($finder);
35+
'no_extra_blank_lines' => ['tokens' => ['break']],
36+
])
37+
->setFinder($finder);

.styleci.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
php:
22
preset: laravel
3-
version: 8
43
disabled:
54
- no_unused_imports
65
finder:
76
not-name:
87
- index.php
9-
- server.php
108
js:
119
finder:
1210
not-name:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.0-apache
1+
FROM php:8.1-apache
22

33
# set main params
44
ARG BUILD_ARGUMENT_DEBUG_ENABLED=false

app/Exceptions/Handler.php

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
class Handler extends ExceptionHandler
1111
{
12+
/**
13+
* A list of exception types with their corresponding custom log levels.
14+
*
15+
* @var array<class-string<Throwable>, \Psr\Log\LogLevel::*>
16+
*/
17+
protected $levels = [];
18+
1219
/**
1320
* A list of the exception types that are not reported.
1421
*

app/Http/Kernel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Kernel extends HttpKernel
1818
protected $middleware = [
1919
// \App\Http\Middleware\TrustHosts::class,
2020
\App\Http\Middleware\TrustProxies::class,
21-
\Fruitcake\Cors\HandleCors::class,
21+
\Illuminate\Http\Middleware\HandleCors::class,
2222
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
2323
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
2424
\App\Http\Middleware\TrimStrings::class,
@@ -35,7 +35,6 @@ class Kernel extends HttpKernel
3535
\App\Http\Middleware\EncryptCookies::class,
3636
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
3737
\Illuminate\Session\Middleware\StartSession::class,
38-
// \Illuminate\Session\Middleware\AuthenticateSession::class,
3938
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
4039
\App\Http\Middleware\VerifyCsrfToken::class,
4140
\Illuminate\Routing\Middleware\SubstituteBindings::class,
@@ -58,6 +57,7 @@ class Kernel extends HttpKernel
5857
protected $routeMiddleware = [
5958
'auth' => \App\Http\Middleware\Authenticate::class,
6059
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
60+
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
6161
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
6262
'can' => \Illuminate\Auth\Middleware\Authorize::class,
6363
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,

app/Http/Middleware/RedirectIfAuthenticated.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ class RedirectIfAuthenticated
1414
/**
1515
* Handle an incoming request.
1616
*
17+
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
1718
* @param string|null ...$guards
18-
* @return mixed
19+
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
1920
*/
2021
public function handle(Request $request, Closure $next, ...$guards)
2122
{

app/Http/Middleware/TrustHosts.php

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class TrustHosts extends Middleware
1010
{
1111
/**
1212
* Get the host patterns that should be trusted.
13+
*
14+
* @return array<int, string|null>
1315
*/
1416
public function hosts(): array
1517
{

app/Providers/EventServiceProvider.php

+8
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ class EventServiceProvider extends ServiceProvider
2929
public function boot(): void
3030
{
3131
}
32+
33+
/**
34+
* Determine if events and listeners should be automatically discovered.
35+
*/
36+
public function shouldDiscoverEvents(): bool
37+
{
38+
return false;
39+
}
3240
}

app/Providers/RouteServiceProvider.php

+3-14
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ class RouteServiceProvider extends ServiceProvider
1919
*/
2020
public const HOME = '/home';
2121

22-
/**
23-
* The controller namespace for the application.
24-
*
25-
* When present, controller route declarations will automatically be prefixed with this namespace.
26-
*
27-
* @var string|null
28-
*/
29-
// protected $namespace = 'App\\Http\\Controllers';
30-
3122
/**
3223
* Define your route model bindings, pattern filters, etc.
3324
*/
@@ -36,13 +27,11 @@ public function boot(): void
3627
$this->configureRateLimiting();
3728

3829
$this->routes(function () {
39-
Route::prefix('api')
40-
->middleware('api')
41-
->namespace($this->namespace)
30+
Route::middleware('api')
31+
->prefix('api')
4232
->group(base_path('routes/api.php'));
4333

4434
Route::middleware('web')
45-
->namespace($this->namespace)
4635
->group(base_path('routes/web.php'));
4736
});
4837
}
@@ -53,7 +42,7 @@ public function boot(): void
5342
protected function configureRateLimiting(): void
5443
{
5544
RateLimiter::for('api', function (Request $request) {
56-
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
45+
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
5746
});
5847
}
5948
}

composer.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,35 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^8.0",
24+
"php": "^8.1",
2525
"ext-ctype": "*",
2626
"ext-iconv": "*",
2727
"ext-json": "*",
2828
"ext-mbstring": "*",
2929
"ext-pdo": "*",
3030
"ext-pdo_mysql": "*",
31-
"fruitcake/laravel-cors": "^2.0",
3231
"guzzlehttp/guzzle": "^7.4",
3332
"jaybizzle/laravel-migrations-organiser": "^6.1",
34-
"laravel/framework": "^8.76",
35-
"laravel/sanctum": "^2.13",
36-
"laravel/tinker": "^2.6"
33+
"laravel/framework": "^9.2",
34+
"laravel/sanctum": "^2.14",
35+
"laravel/tinker": "^2.7"
3736
},
3837
"require-dev": {
39-
"bamarni/composer-bin-plugin": "^1.4",
38+
"bamarni/composer-bin-plugin": "^1.5",
4039
"barryvdh/laravel-ide-helper": "^2.10",
41-
"ergebnis/composer-normalize": "^2.18",
42-
"facade/ignition": "^2.5",
40+
"ergebnis/composer-normalize": "^2.22",
4341
"fakerphp/faker": "^1.9",
4442
"laravel/sail": "^1.0",
4543
"mockery/mockery": "^1.4",
4644
"neronmoon/scriptsdev": "^0.1",
47-
"nunomaduro/collision": "^5.0",
45+
"nunomaduro/collision": "^6.1",
46+
"spatie/laravel-ignition": "^1.0",
4847
"roave/security-advisories": "dev-latest"
4948
},
5049
"config": {
5150
"optimize-autoloader": true,
5251
"platform": {
53-
"php": "8.0.0"
52+
"php": "8.1.0"
5453
},
5554
"preferred-install": "dist",
5655
"sort-packages": true,
@@ -63,6 +62,8 @@
6362
},
6463
"extra": {
6564
"bamarni-bin": {
65+
"bin-links": true,
66+
"forward-command": true,
6667
"target-directory": "tools"
6768
},
6869
"laravel": {

0 commit comments

Comments
 (0)