BREAKING: increase PHP version requirement to 8.1.0

This commit is contained in:
Asnxthaony 2023-05-30 16:43:55 +08:00
parent d96dff1144
commit b811a7ae41
No known key found for this signature in database
GPG Key ID: 6537C59306464F54
15 changed files with 393 additions and 446 deletions

View File

@ -40,7 +40,7 @@ Blessing Skin 是一个开源的 PHP 项目,这意味着您可以自由地在
Blessing Skin 对您的服务器有一定的要求。在大多数情况下,下列所需的 PHP 扩展已经开启。 Blessing Skin 对您的服务器有一定的要求。在大多数情况下,下列所需的 PHP 扩展已经开启。
- 一台支持 URL 重写的主机Nginx 或 Apache - 一台支持 URL 重写的主机Nginx 或 Apache
- PHP >= 8.0.2 - PHP >= 8.1.0
- 安装并启用如下 PHP 扩展: - 安装并启用如下 PHP 扩展:
- OpenSSL >= 1.1.1 (TLS 1.3) - OpenSSL >= 1.1.1 (TLS 1.3)
- PDO - PDO

View File

@ -40,7 +40,7 @@ Blessing Skin is an open-source project written in PHP, which means you can depl
Blessing Skin has only a few system requirements. In most cases, these PHP extensions are already enabled. Blessing Skin has only a few system requirements. In most cases, these PHP extensions are already enabled.
- Web server with URL rewriting enabled (Nginx or Apache) - Web server with URL rewriting enabled (Nginx or Apache)
- PHP >= 8.0.2 - PHP >= 8.1.0
- PHP Extensions - PHP Extensions
- OpenSSL >= 1.1.1 (TLS 1.3) - OpenSSL >= 1.1.1 (TLS 1.3)
- PDO - PDO

View File

@ -9,25 +9,21 @@ class ScopeObserver
{ {
/** /**
* Handle the Scope "saved" event. * Handle the Scope "saved" event.
*
* @return void
*/ */
public function saved() public function saved(): void
{ {
$this->refreshCachedScopes(); $this->refreshCachedScopes();
} }
/** /**
* Handle the Scope "deleted" event. * Handle the Scope "deleted" event.
*
* @return void
*/ */
public function deleted() public function deleted(): void
{ {
$this->refreshCachedScopes(); $this->refreshCachedScopes();
} }
protected function refreshCachedScopes() protected function refreshCachedScopes(): void
{ {
Cache::forget('scopes'); Cache::forget('scopes');
Cache::rememberForever('scopes', function () { Cache::rememberForever('scopes', function () {

View File

@ -10,14 +10,14 @@ use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
public function register() public function register(): void
{ {
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher')); $this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton(Services\Option::class); $this->app->singleton(Services\Option::class);
$this->app->alias(Services\Option::class, 'options'); $this->app->alias(Services\Option::class, 'options');
} }
public function boot(Request $request) public function boot(Request $request): void
{ {
Paginator::useBootstrap(); Paginator::useBootstrap();

View File

@ -9,19 +9,17 @@ use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider class AuthServiceProvider extends ServiceProvider
{ {
/** /**
* The policy mappings for the application. * The model to policy mappings for the application.
* *
* @var array * @var array<class-string, class-string>
*/ */
protected $policies = [ protected $policies = [
]; ];
/** /**
* Register any authentication / authorization services. * Register any authentication / authorization services.
*
* @return void
*/ */
public function boot() public function boot(): void
{ {
$defaultScopes = [ $defaultScopes = [
'User.Read' => 'auth.oauth.scope.user.read', 'User.Read' => 'auth.oauth.scope.user.read',

View File

@ -9,7 +9,11 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi
class EventServiceProvider extends ServiceProvider 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>>
*/
protected $listen = [ protected $listen = [
'App\Events\PluginWasEnabled' => [ 'App\Events\PluginWasEnabled' => [
Listeners\CopyPluginAssets::class, Listeners\CopyPluginAssets::class,
@ -44,10 +48,8 @@ class EventServiceProvider extends ServiceProvider
/** /**
* Register any events for your application. * Register any events for your application.
*
* @return void
*/ */
public function boot() public function boot(): void
{ {
Scope::observe(ScopeObserver::class); Scope::observe(ScopeObserver::class);
} }

View File

@ -7,13 +7,13 @@ use Illuminate\Support\ServiceProvider;
class PluginServiceProvider extends ServiceProvider class PluginServiceProvider extends ServiceProvider
{ {
public function register() public function register(): void
{ {
$this->app->singleton(PluginManager::class); $this->app->singleton(PluginManager::class);
$this->app->alias(PluginManager::class, 'plugins'); $this->app->alias(PluginManager::class, 'plugins');
} }
public function boot(PluginManager $plugins) public function boot(PluginManager $plugins): void
{ {
$plugins->boot(); $plugins->boot();
} }

View File

@ -19,7 +19,7 @@ class RouteServiceProvider extends ServiceProvider
/** /**
* Define the routes for the application. * Define the routes for the application.
*/ */
public function map(Router $router) public function map(Router $router): void
{ {
$this->mapStaticRoutes($router); $this->mapStaticRoutes($router);
@ -40,7 +40,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "web" routes for the application. * Define the "web" routes for the application.
* These routes all receive session state, CSRF protection, etc. * These routes all receive session state, CSRF protection, etc.
*/ */
protected function mapWebRoutes(Router $router) protected function mapWebRoutes(Router $router): void
{ {
Route::middleware(['web']) Route::middleware(['web'])
->namespace($this->namespace) ->namespace($this->namespace)
@ -51,7 +51,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "static" routes for the application. * Define the "static" routes for the application.
* These routes will not load session, etc. * These routes will not load session, etc.
*/ */
protected function mapStaticRoutes(Router $router) protected function mapStaticRoutes(Router $router): void
{ {
Route::namespace($this->namespace) Route::namespace($this->namespace)
->group(base_path('routes/static.php')); ->group(base_path('routes/static.php'));
@ -61,7 +61,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "api" routes for the application. * Define the "api" routes for the application.
* These routes are typically stateless. * These routes are typically stateless.
*/ */
protected function mapApiRoutes() protected function mapApiRoutes(): void
{ {
Route::prefix('api') Route::prefix('api')
->middleware( ->middleware(

View File

@ -3,12 +3,12 @@
namespace App\Providers; namespace App\Providers;
use App\Http\View\Composers; use App\Http\View\Composers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use View;
class ViewServiceProvider extends ServiceProvider class ViewServiceProvider extends ServiceProvider
{ {
public function boot() public function boot(): void
{ {
View::composer([ View::composer([
'home', 'home',

View File

@ -29,7 +29,7 @@ ini_set('display_errors', true);
file_put_contents($envPath, preg_replace('/APP_KEY\s*=\s*/', 'APP_KEY='.$key."\n\n", $envFile)); file_put_contents($envPath, preg_replace('/APP_KEY\s*=\s*/', 'APP_KEY='.$key."\n\n", $envFile));
} }
$requiredVersion = '8.0.2'; $requiredVersion = '8.1.0';
preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches); preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1]; $version = $matches[1];
if (version_compare($version, $requiredVersion, '<')) { if (version_compare($version, $requiredVersion, '<')) {

View File

@ -3,7 +3,7 @@
"description": "A web application brings your custom skins back in offline Minecraft servers.", "description": "A web application brings your custom skins back in offline Minecraft servers.",
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": ">=8.0.2", "php": "^8.1",
"ext-ctype": "*", "ext-ctype": "*",
"ext-gd": "*", "ext-gd": "*",
"ext-json": "*", "ext-json": "*",
@ -28,7 +28,7 @@
"laravel/passport": "^11.0", "laravel/passport": "^11.0",
"lorisleiva/laravel-search-string": "^1.0", "lorisleiva/laravel-search-string": "^1.0",
"nesbot/carbon": "^2.0", "nesbot/carbon": "^2.0",
"nunomaduro/collision": "^6.1", "nunomaduro/collision": "^7.0",
"rcrowe/twigbridge": "^0.14", "rcrowe/twigbridge": "^0.14",
"spatie/laravel-translation-loader": "^2.7", "spatie/laravel-translation-loader": "^2.7",
"symfony/process": "^6.0", "symfony/process": "^6.0",
@ -41,12 +41,12 @@
"barryvdh/laravel-ide-helper": "^2.10", "barryvdh/laravel-ide-helper": "^2.10",
"fakerphp/faker": "^1.13", "fakerphp/faker": "^1.13",
"friendsofphp/php-cs-fixer": "^3.13", "friendsofphp/php-cs-fixer": "^3.13",
"laravel/browser-kit-testing": "^6.1", "laravel/browser-kit-testing": "^7.0",
"laravel/tinker": "^2.4", "laravel/tinker": "^2.4",
"mockery/mockery": "^1.4", "mockery/mockery": "^1.4",
"phpunit/phpunit": "^9.4", "phpunit/phpunit": "^10.0",
"symfony/css-selector": "^5.0", "symfony/css-selector": "^6.2",
"symfony/dom-crawler": "^5.0" "symfony/dom-crawler": "^6.2"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -70,6 +70,7 @@
] ]
}, },
"config": { "config": {
"optimize-autoloader": true,
"preferred-install": "dist", "preferred-install": "dist",
"sort-packages": true "sort-packages": true
}, },

765
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -108,6 +108,7 @@ class NotificationsControllerTest extends TestCase
public function testRead() public function testRead()
{ {
/** @var User */
$user = User::factory()->create(); $user = User::factory()->create();
$user->notify(new Notifications\SiteMessage('Hyouka', 'Kotenbu?')); $user->notify(new Notifications\SiteMessage('Hyouka', 'Kotenbu?'));
$user->refresh(); $user->refresh();
@ -119,7 +120,7 @@ class NotificationsControllerTest extends TestCase
$this->postJson('/user/notifications/'.$notification->id) $this->postJson('/user/notifications/'.$notification->id)
->assertJson([ ->assertJson([
'title' => $notification->data['title'], 'title' => $notification->data['title'],
'content' => $converter->convertToHtml($notification->data['content'])->getContent(), 'content' => $converter->convert($notification->data['content'])->getContent(),
'time' => $notification->created_at->toDateTimeString(), 'time' => $notification->created_at->toDateTimeString(),
]); ]);
$notification->refresh(); $notification->refresh();

View File

@ -73,7 +73,7 @@ class UpdateControllerTest extends TestCase
{ {
return array_merge([ return array_merge([
'spec' => 2, 'spec' => 2,
'php' => '8.0.2', 'php' => '8.1.0',
'latest' => $version, 'latest' => $version,
'url' => "https://whatever.test/$version/update.zip", 'url' => "https://whatever.test/$version/update.zip",
], $extra); ], $extra);

View File

@ -19,7 +19,7 @@ Copy-Item -Path "../$zip" -Destination $zip
$manifest.latest = $current $manifest.latest = $current
$manifest.url = $manifest.url.Replace($last, $current) $manifest.url = $manifest.url.Replace($last, $current)
$manifest.php = '8.0.2' $manifest.php = '8.1.0'
ConvertTo-Json $manifest | Out-File -FilePath update.json ConvertTo-Json $manifest | Out-File -FilePath update.json
Write-Host "Update source is prepared." -ForegroundColor Green Write-Host "Update source is prepared." -ForegroundColor Green