示例#1
0
 /**
  * Get a ErrorException instance.
  *
  * @param \ParseError|\TypeError|\Throwable $exception
  *
  * @return \ErrorException
  */
 private function getErrorException($exception) : ErrorException
 {
     if ($exception instanceof ParseError) {
         $message = 'Parse error: ' . $exception->getMessage();
         $severity = E_PARSE;
     } elseif ($exception instanceof TypeError) {
         $message = 'Type error: ' . $exception->getMessage();
         $severity = E_RECOVERABLE_ERROR;
     } else {
         $message = $exception->getMessage();
         $severity = E_ERROR;
     }
     return new ErrorException($message, $exception->getCode(), $severity, $exception->getFile(), $exception->getLine());
 }