From 0a43c5aa674fab9c157737523a983a0b75b02b91 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Fri, 12 Jan 2024 20:37:11 +0800 Subject: [PATCH] style: format code --- app/Exceptions/Handler.php | 1 + app/Http/Kernel.php | 24 ++++++++++++------------ app/Services/OptionForm.php | 2 +- tests/ServicesTest/PluginManagerTest.php | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e23923a67..278d31854 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -55,6 +55,7 @@ protected function convertExceptionToArray(Throwable $e) // @codeCoverageIgnoreStart $isFromPlugins = !app()->runningUnitTests() && Str::contains($trace['file'], resolve('plugins')->getPluginsDirs()->all()); + // @codeCoverageIgnoreEnd return Str::startsWith($trace['file'], 'app') || $isFromPlugins; }) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 7d0faf65e..616134ffb 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -17,8 +17,8 @@ class Kernel extends HttpKernel \Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\TrimStrings::class, - \App\Http\Middleware\ConvertEmptyStringsToNull::class, - \App\Http\Middleware\DetectLanguagePrefer::class, + Middleware\ConvertEmptyStringsToNull::class, + Middleware\DetectLanguagePrefer::class, ]; /** @@ -33,8 +33,8 @@ class Kernel extends HttpKernel \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class, - \App\Http\Middleware\EnforceEverGreen::class, - \App\Http\Middleware\RedirectToSetup::class, + Middleware\EnforceEverGreen::class, + Middleware\RedirectToSetup::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], @@ -44,9 +44,9 @@ class Kernel extends HttpKernel 'authorize' => [ 'auth:web', - \App\Http\Middleware\RejectBannedUser::class, - \App\Http\Middleware\EnsureEmailFilled::class, - \App\Http\Middleware\FireUserAuthenticated::class, + Middleware\RejectBannedUser::class, + Middleware\EnsureEmailFilled::class, + Middleware\FireUserAuthenticated::class, ], ]; @@ -58,13 +58,13 @@ class Kernel extends HttpKernel * @var array */ protected $middlewareAliases = [ - 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth' => Middleware\Authenticate::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'role' => \App\Http\Middleware\CheckRole::class, - 'setup' => \App\Http\Middleware\CheckInstallation::class, + 'guest' => Middleware\RedirectIfAuthenticated::class, + 'role' => Middleware\CheckRole::class, + 'setup' => Middleware\CheckInstallation::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \App\Http\Middleware\CheckUserVerified::class, + 'verified' => Middleware\CheckUserVerified::class, 'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class, 'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class, ]; diff --git a/app/Services/OptionForm.php b/app/Services/OptionForm.php index 400fd61f9..e60089e27 100644 --- a/app/Services/OptionForm.php +++ b/app/Services/OptionForm.php @@ -59,7 +59,7 @@ public function __construct(string $id, string $title = self::AUTO_DETECT) } /** - * @throws \BadMethodCallException + * @throws BadMethodCallException */ public function __call(string $method, array $params): OptionFormItem { diff --git a/tests/ServicesTest/PluginManagerTest.php b/tests/ServicesTest/PluginManagerTest.php index b4808059b..0e535ade6 100644 --- a/tests/ServicesTest/PluginManagerTest.php +++ b/tests/ServicesTest/PluginManagerTest.php @@ -598,7 +598,7 @@ public function testEnable() $this->assertTrue($manager->getEnabledPlugins()->has('fake')); $this->assertEquals( 'fake', - json_decode(resolve(\App\Services\Option::class)->get('plugins_enabled'), true)[0]['name'] + json_decode(resolve(Option::class)->get('plugins_enabled'), true)[0]['name'] ); $this->assertTrue($manager->enable('dep')['unsatisfied']->isNotEmpty()); @@ -624,7 +624,7 @@ public function testDisable() return true; }); $this->assertFalse($manager->getEnabledPlugins()->has('fake')); - $this->assertCount(0, json_decode(resolve(\App\Services\Option::class)->get('plugins_enabled'), true)); + $this->assertCount(0, json_decode(resolve(Option::class)->get('plugins_enabled'), true)); } public function testDelete()