mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Updates to ErrorHandler, add missing type hint \Throwable (#18302)
* Updated phpdoc so it has \Throwable
- `abstract protected function renderException($exception);` is extended in web/ErrorHandler to also have `\Error`.
- `public static function convertExceptionToError($exception)` is called from widgets/ActiveField.php with
```
/**
* PHP magic method that returns the string representation of this object.
* @return string the string representation of this object.
*/
public function __toString()
{
// __toString cannot throw exception
// use trigger_error to bypass this limitation
try {
return $this->render();
} catch (\Exception $e) {
ErrorHandler::convertExceptionToError($e);
return '';
} catch (\Throwable $e) {
ErrorHandler::convertExceptionToError($e);
return '';
}
}
```
* Add \Throwable to phpdoc in response.php
The ErrorHandler has been updated in phpdoc to have throwable, this complets that change.
* Update ErrorHandler.php
fixed missing `|`
This commit is contained in:
@ -295,7 +295,7 @@ class Response extends \yii\base\Response
|
||||
|
||||
/**
|
||||
* Sets the response status code based on the exception.
|
||||
* @param \Exception|\Error $e the exception object.
|
||||
* @param \Exception|\Error|\Throwable $e the exception object.
|
||||
* @throws InvalidArgumentException if the status code is invalid.
|
||||
* @return $this the response object itself
|
||||
* @since 2.0.12
|
||||
|
||||
Reference in New Issue
Block a user