Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db1661b

Browse files
authored
Merge pull request #118 from async-interop/return_old_error_handler
Loop::setErrorHandler should return the last error handler
2 parents 50fd5e3 + 44fd40a commit db1661b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Loop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ public static function getState($key)
388388
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute. `null` will clear the
389389
* current handler.
390390
*
391-
* @return void
391+
* @return callable(\Throwable|\Exception $error)|null The previous handler, `null` if there was none.
392392
*/
393393
public static function setErrorHandler(callable $callback = null)
394394
{
395395
$driver = self::$driver ?: self::get();
396-
$driver->setErrorHandler($callback);
396+
return $driver->setErrorHandler($callback);
397397
}
398398

399399
/**

src/Loop/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ final public function getState($key)
246246
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute. `null` will clear the
247247
* current handler.
248248
*
249-
* @return void
249+
* @return callable(\Throwable|\Exception $error)|null The previous handler, `null` if there was none.
250250
*/
251251
abstract public function setErrorHandler(callable $callback = null);
252252

0 commit comments

Comments
 (0)