Skip to content

Commit 019038f

Browse files
Allow callable to be pass as error handler
1 parent 3a87027 commit 019038f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AsyncEventDispatcher.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ class AsyncEventDispatcher implements EventDispatcherInterface
3232

3333
/**
3434
* @param ListenerProviderInterface $listenerProvider The provider of event listeners
35-
* @param Closure(Throwable): (void) $errorHandler The handler for errors thrown by listeners
35+
* @param callable(Throwable): (void) $errorHandler The handler for errors thrown by listeners
3636
*/
3737
public function __construct(
3838
private readonly ListenerProviderInterface $listenerProvider,
39-
?Closure $errorHandler = null
39+
?callable $errorHandler = null
4040
) {
4141
if ($errorHandler === null) {
4242
$this->errorHandler = function (Throwable $exception): void {};
4343
} else {
44-
$this->errorHandler = $errorHandler;
44+
$this->errorHandler = Closure::fromCallable($errorHandler);
4545
}
4646
}
4747

0 commit comments

Comments
 (0)