diff --git a/src/ExceptionNotifyServiceProvider.php b/src/ExceptionNotifyServiceProvider.php index 27c5810..ce3a6d5 100644 --- a/src/ExceptionNotifyServiceProvider.php +++ b/src/ExceptionNotifyServiceProvider.php @@ -157,11 +157,11 @@ protected function extendExceptionHandler(): self /** @var callable(\Throwable):mixed|void $reportUsing */ $reportUsing = $reportUsingCreator($exceptionHandler); - if (! $reportUsing instanceof \Closure) { - $reportUsing = \Closure::fromCallable($reportUsing); + if ($reportUsing instanceof \Closure) { + $reportUsing = $reportUsing->bindTo($exceptionHandler, $exceptionHandler); } - $exceptionHandler->reportable($reportUsing->bindTo($exceptionHandler, $exceptionHandler)); + $exceptionHandler->reportable($reportUsing); } return $exceptionHandler;