Skip to content

Commit dd2432b

Browse files
committed
refactor(src): Improve extendExceptionHandler method in ExceptionNotifyServiceProvider
- Simplified conditional logic in the extendExceptionHandler method - Removed unnecessary method_exists check
1 parent 6841cf3 commit dd2432b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ExceptionNotifyServiceProvider.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Illuminate\Container\Container;
2222
use Illuminate\Contracts\Container\BindingResolutionException;
2323
use Illuminate\Contracts\Debug\ExceptionHandler;
24+
use Illuminate\Foundation\Exceptions\Handler;
2425
use Illuminate\Http\Request;
2526
use Illuminate\Support\Collection;
2627
use Illuminate\Support\ServiceProvider;
@@ -142,10 +143,7 @@ protected function registerTestCommand(): self
142143
protected function extendExceptionHandler(): self
143144
{
144145
$this->app->extend(ExceptionHandler::class, function (ExceptionHandler $exceptionHandler): ExceptionHandler {
145-
if (
146-
($reportUsingCreator = config('exception-notify.report_using_creator'))
147-
&& method_exists($exceptionHandler, 'reportable')
148-
) {
146+
if ($reportUsingCreator = config('exception-notify.report_using_creator')) {
149147
/** @var callable(ExceptionHandler):callable|class-string $reportUsingCreator */
150148
if (\is_string($reportUsingCreator) && class_exists($reportUsingCreator)) {
151149
$reportUsingCreator = $this->app->make($reportUsingCreator);
@@ -157,6 +155,7 @@ protected function extendExceptionHandler(): self
157155
$reportUsing = $reportUsing->bindTo($exceptionHandler, $exceptionHandler);
158156
}
159157

158+
/** @var Handler $exceptionHandler */
160159
$exceptionHandler->reportable($reportUsing);
161160
}
162161

0 commit comments

Comments
 (0)