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:
My6UoT9
2020-09-30 01:34:23 +02:00
committed by GitHub
parent 1d7baabab5
commit 03da5bb689
2 changed files with 5 additions and 5 deletions

View File

@ -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