From 080e098a2cac0ba4acfb525b39bb20be391dfe5e Mon Sep 17 00:00:00 2001 From: Ahti Nurme Date: Thu, 15 Feb 2024 14:01:22 +0200 Subject: [PATCH 1/4] Always extend projects Exception handler, not default --- src/TranslationsUIServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TranslationsUIServiceProvider.php b/src/TranslationsUIServiceProvider.php index 24364eb..54456d8 100644 --- a/src/TranslationsUIServiceProvider.php +++ b/src/TranslationsUIServiceProvider.php @@ -2,7 +2,7 @@ namespace Outhebox\TranslationsUI; -use Illuminate\Contracts\Debug\ExceptionHandler; +use App\Exceptions\Handler as ExceptionHandler; use Outhebox\TranslationsUI\Console\Commands\CleanOldVersionCommand; use Outhebox\TranslationsUI\Console\Commands\ContributorCommand; use Outhebox\TranslationsUI\Console\Commands\ExportTranslationsCommand; From 0acb1a8fb1ed9324c73258d5a76f8bd1856de6d5 Mon Sep 17 00:00:00 2001 From: Ahti Nurme Date: Thu, 15 Feb 2024 15:31:21 +0200 Subject: [PATCH 2/4] Always extend projects Exception handler, not default --- src/Exceptions/TranslationsUIExceptionHandler.php | 4 ++-- src/TranslationsUIServiceProvider.php | 2 +- tests/Mocks/HandlerMock.php | 9 +++++++++ tests/TestCase.php | 8 ++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 tests/Mocks/HandlerMock.php diff --git a/src/Exceptions/TranslationsUIExceptionHandler.php b/src/Exceptions/TranslationsUIExceptionHandler.php index d5d0578..d81cf47 100644 --- a/src/Exceptions/TranslationsUIExceptionHandler.php +++ b/src/Exceptions/TranslationsUIExceptionHandler.php @@ -2,7 +2,7 @@ namespace Outhebox\TranslationsUI\Exceptions; -use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use App\Exceptions\Handler; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -11,7 +11,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Throwable; -class TranslationsUIExceptionHandler extends ExceptionHandler +class TranslationsUIExceptionHandler extends Handler { public static function isTranslationsUIRequest(Request $request): bool { diff --git a/src/TranslationsUIServiceProvider.php b/src/TranslationsUIServiceProvider.php index 54456d8..24364eb 100644 --- a/src/TranslationsUIServiceProvider.php +++ b/src/TranslationsUIServiceProvider.php @@ -2,7 +2,7 @@ namespace Outhebox\TranslationsUI; -use App\Exceptions\Handler as ExceptionHandler; +use Illuminate\Contracts\Debug\ExceptionHandler; use Outhebox\TranslationsUI\Console\Commands\CleanOldVersionCommand; use Outhebox\TranslationsUI\Console\Commands\ContributorCommand; use Outhebox\TranslationsUI\Console\Commands\ExportTranslationsCommand; diff --git a/tests/Mocks/HandlerMock.php b/tests/Mocks/HandlerMock.php new file mode 100644 index 0000000..891eb5c --- /dev/null +++ b/tests/Mocks/HandlerMock.php @@ -0,0 +1,9 @@ + HandlerMock::class, + ]; + } + protected function setUp(): void { parent::setUp(); From ca5811d183322edfea4f2a85db35af0c3fa88bca Mon Sep 17 00:00:00 2001 From: Ahti Nurme Date: Thu, 15 Feb 2024 15:35:48 +0200 Subject: [PATCH 3/4] Don't force to use custom handler, use the one that's available --- src/Exceptions/ExtendedHandler.php | 10 ++++++++++ src/Exceptions/TranslationsUIExceptionHandler.php | 14 +++++++++++++- tests/Mocks/HandlerMock.php | 9 --------- tests/TestCase.php | 8 -------- 4 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 src/Exceptions/ExtendedHandler.php delete mode 100644 tests/Mocks/HandlerMock.php diff --git a/src/Exceptions/ExtendedHandler.php b/src/Exceptions/ExtendedHandler.php new file mode 100644 index 0000000..1f83603 --- /dev/null +++ b/src/Exceptions/ExtendedHandler.php @@ -0,0 +1,10 @@ + HandlerMock::class, - ]; - } - protected function setUp(): void { parent::setUp(); From bc74f4f00df571b1d09fa2b4cf0296d49bd00fc6 Mon Sep 17 00:00:00 2001 From: Ahti Nurme Date: Thu, 15 Feb 2024 15:42:58 +0200 Subject: [PATCH 4/4] Remove the extended handler class --- src/Exceptions/ExtendedHandler.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/Exceptions/ExtendedHandler.php diff --git a/src/Exceptions/ExtendedHandler.php b/src/Exceptions/ExtendedHandler.php deleted file mode 100644 index 1f83603..0000000 --- a/src/Exceptions/ExtendedHandler.php +++ /dev/null @@ -1,10 +0,0 @@ -