Skip to content

Commit 8fc83b7

Browse files
committed
Return previous error handler callback upon set
1 parent 4058691 commit 8fc83b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Promise/ErrorHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ private function __construct()
3636
*
3737
* @param callable|null $onError Callback to invoke on errors or `null` to reset.
3838
*
39-
* @return void
39+
* @return callable|null Previous callback.
4040
*/
4141
public static function set(callable $onError = null)
4242
{
43+
$previous = self::$callback;
4344
self::$callback = $onError;
45+
return $previous;
4446
}
4547

4648
/**

0 commit comments

Comments
 (0)