Skip to content

Commit 632baae

Browse files
committed
Refactor(src): Improve exception reporting
- Use bindTo() to bind reportUsing closure to exceptionHandler - Remove unnecessary closure conversion
1 parent 969916e commit 632baae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ExceptionNotifyServiceProvider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ protected function extendExceptionHandler(): self
157157

158158
/** @var callable(\Throwable):mixed|void $reportUsing */
159159
$reportUsing = $reportUsingCreator($exceptionHandler);
160-
if (! $reportUsing instanceof \Closure) {
161-
$reportUsing = \Closure::fromCallable($reportUsing);
160+
if ($reportUsing instanceof \Closure) {
161+
$reportUsing = $reportUsing->bindTo($exceptionHandler, $exceptionHandler);
162162
}
163163

164-
$exceptionHandler->reportable($reportUsing->bindTo($exceptionHandler, $exceptionHandler));
164+
$exceptionHandler->reportable($reportUsing);
165165
}
166166

167167
return $exceptionHandler;

0 commit comments

Comments
 (0)