Skip to content

Remove default value for setErrorHandler #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/EventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ public static function unreference(string $callbackId): string
*
* Subsequent calls to this method will overwrite the previous handler.
*
* @param (\Closure(\Throwable):void)|null $closure The callback to execute. `null` will clear the current handler.
* @param (\Closure(\Throwable):void)|null $errorHandler The callback to execute. `null` will clear the current handler.
*
* @return (\Closure(\Throwable):void)|null The previous handler, `null` if there was none.
*/
public static function setErrorHandler(\Closure $closure = null): ?\Closure
public static function setErrorHandler(?\Closure $errorHandler): ?\Closure
{
return self::getDriver()->setErrorHandler($closure);
return self::getDriver()->setErrorHandler($errorHandler);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/EventLoop/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ public function unreference(string $callbackId): string;
*
* Subsequent calls to this method will overwrite the previous handler.
*
* @param (\Closure(\Throwable):void)|null $closure The callback to execute. `null` will clear the current handler.
* @param (\Closure(\Throwable):void)|null $errorHandler The callback to execute. `null` will clear the current handler.
*
* @return (\Closure(\Throwable):void)|null The previous handler, `null` if there was none.
*/
public function setErrorHandler(?\Closure $closure = null): ?callable;
public function setErrorHandler(?\Closure $errorHandler): ?callable;

/**
* Get the underlying loop handle.
Expand Down
4 changes: 2 additions & 2 deletions src/EventLoop/Driver/TracingDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public function unreference(string $callbackId): string
return $callbackId;
}

public function setErrorHandler(\Closure $closure = null): ?callable
public function setErrorHandler(?\Closure $errorHandler): ?callable
{
return $this->driver->setErrorHandler($closure);
return $this->driver->setErrorHandler($errorHandler);
}

/** @inheritdoc */
Expand Down
4 changes: 2 additions & 2 deletions src/EventLoop/Internal/AbstractDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ public function createSuspension(): Suspension
return new DriverSuspension($this->runCallback, $this->queueCallback, $this->interruptCallback);
}

public function setErrorHandler(\Closure $closure = null): ?callable
public function setErrorHandler(?\Closure $errorHandler): ?callable
{
$previous = $this->errorHandler;
$this->errorHandler = $closure;
$this->errorHandler = $errorHandler;
return $previous;
}

Expand Down