@@ -36,7 +36,7 @@ |
||
| 36 | 36 | * @param \Error|\Exception $ex |
| 37 | 37 | * @param string[] &$data |
| 38 | 38 | * @param int $offset |
| 39 | - * @return mixed |
|
| 39 | + * @return string[] |
|
| 40 | 40 | */ |
| 41 | 41 | public static function getThrowableStack($ex, &$data = [], $offset = 0) |
| 42 | 42 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $trace = $ex->getTrace(); |
| 82 | 82 | $file = str_replace('.php', '', basename($ex->getFile())); |
| 83 | 83 | $elements = [ |
| 84 | - '[throwable] ' . get_class($ex) . '(...) in ' . $file .':' . $ex->getLine() |
|
| 84 | + '[throwable] ' . get_class($ex) . '(...) in ' . $file . ':' . $ex->getLine() |
|
| 85 | 85 | ]; |
| 86 | 86 | |
| 87 | 87 | foreach ($trace as $currentTrack) |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected static function parseTraceElement($element) |
| 103 | 103 | { |
| 104 | - $element['class'] = isset($element['class']) ? $element['class'] : 'Undefined'; |
|
| 105 | - $element['file'] = isset($element['file']) ? $element['file'] : 'unknown'; |
|
| 106 | - $element['line'] = isset($element['line']) ? $element['line'] : 0; |
|
| 107 | - $element['type'] = isset($element['type']) ? $element['type'] : ''; |
|
| 104 | + $element['class'] = isset($element['class']) ? $element['class'] : 'Undefined'; |
|
| 105 | + $element['file'] = isset($element['file']) ? $element['file'] : 'unknown'; |
|
| 106 | + $element['line'] = isset($element['line']) ? $element['line'] : 0; |
|
| 107 | + $element['type'] = isset($element['type']) ? $element['type'] : ''; |
|
| 108 | 108 | $element['function'] = isset($element['function']) ? $element['function'] : '::undefined'; |
| 109 | - $element['args'] = isset($element['args']) ? $element['args'] : []; |
|
| 109 | + $element['args'] = isset($element['args']) ? $element['args'] : []; |
|
| 110 | 110 | |
| 111 | 111 | return implode('', [ |
| 112 | 112 | '[call] ', |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $message = preg_replace('#([a-zA-Z0-9-_]+?)/#siU', '', $message); |
| 20 | 20 | $message = preg_replace('#/#si', '', $message, 1); |
| 21 | - } |
|
| 22 | - else |
|
| 21 | + } else |
|
| 23 | 22 | { |
| 24 | 23 | $message = trim($message, '"'); |
| 25 | 24 | $file = str_replace('.php', '', basename($ex['file'])); |
@@ -135,12 +134,10 @@ discard block |
||
| 135 | 134 | if (is_array($element)) |
| 136 | 135 | { |
| 137 | 136 | $element = 'Array'; |
| 138 | - } |
|
| 139 | - else if (is_object($element)) |
|
| 137 | + } else if (is_object($element)) |
|
| 140 | 138 | { |
| 141 | 139 | $element = get_class($element); |
| 142 | - } |
|
| 143 | - else if (is_string($element)) |
|
| 140 | + } else if (is_string($element)) |
|
| 144 | 141 | { |
| 145 | 142 | $element = (strlen($element) > 32) ? substr($element, 0, 32) . '...' : $element; |
| 146 | 143 | $element = '"' . $element . '"'; |
@@ -100,55 +100,55 @@ |
||
| 100 | 100 | */ |
| 101 | 101 | private static function getSystemError($type) |
| 102 | 102 | { |
| 103 | - switch($type) |
|
| 103 | + switch ($type) |
|
| 104 | 104 | { |
| 105 | 105 | case E_ERROR: // 1 // |
| 106 | - return [ 'E_ERROR', static::E_ERROR ]; |
|
| 106 | + return ['E_ERROR', static::E_ERROR]; |
|
| 107 | 107 | |
| 108 | 108 | case E_WARNING: // 2 // |
| 109 | - return [ 'E_WARNING', static::E_WARNING ]; |
|
| 109 | + return ['E_WARNING', static::E_WARNING]; |
|
| 110 | 110 | |
| 111 | 111 | case E_PARSE: // 4 // |
| 112 | - return [ 'E_PARSE', static::E_ERROR ]; |
|
| 112 | + return ['E_PARSE', static::E_ERROR]; |
|
| 113 | 113 | |
| 114 | 114 | case E_NOTICE: // 8 // |
| 115 | - return [ 'E_NOTICE', static::E_NOTICE ]; |
|
| 115 | + return ['E_NOTICE', static::E_NOTICE]; |
|
| 116 | 116 | |
| 117 | 117 | case E_CORE_ERROR: // 16 // |
| 118 | - return [ 'E_CORE_ERROR', static::E_ERROR ]; |
|
| 118 | + return ['E_CORE_ERROR', static::E_ERROR]; |
|
| 119 | 119 | |
| 120 | 120 | case E_CORE_WARNING: // 32 // |
| 121 | - return [ 'E_CORE_WARNING', static::E_WARNING ]; |
|
| 121 | + return ['E_CORE_WARNING', static::E_WARNING]; |
|
| 122 | 122 | |
| 123 | 123 | case E_COMPILE_ERROR: // 64 // |
| 124 | - return [ 'E_COMPILE_ERROR', static::E_ERROR ]; |
|
| 124 | + return ['E_COMPILE_ERROR', static::E_ERROR]; |
|
| 125 | 125 | |
| 126 | 126 | case E_COMPILE_WARNING: // 128 // |
| 127 | - return [ 'E_COMPILE_WARNING', static::E_WARNING ]; |
|
| 127 | + return ['E_COMPILE_WARNING', static::E_WARNING]; |
|
| 128 | 128 | |
| 129 | 129 | case E_USER_ERROR: // 256 // |
| 130 | - return [ 'E_USER_ERROR', static::E_ERROR ]; |
|
| 130 | + return ['E_USER_ERROR', static::E_ERROR]; |
|
| 131 | 131 | |
| 132 | 132 | case E_USER_WARNING: // 512 // |
| 133 | - return [ 'E_USER_WARNING', static::E_WARNING ]; |
|
| 133 | + return ['E_USER_WARNING', static::E_WARNING]; |
|
| 134 | 134 | |
| 135 | 135 | case E_USER_NOTICE: // 1024 // |
| 136 | - return [ 'E_USER_NOTICE', static::E_NOTICE ]; |
|
| 136 | + return ['E_USER_NOTICE', static::E_NOTICE]; |
|
| 137 | 137 | |
| 138 | 138 | case E_STRICT: // 2048 // |
| 139 | - return [ 'E_STRICT', static::E_ERROR ]; |
|
| 139 | + return ['E_STRICT', static::E_ERROR]; |
|
| 140 | 140 | |
| 141 | 141 | case E_RECOVERABLE_ERROR: // 4096 // |
| 142 | - return [ 'E_RECOVERABLE_ERROR', static::E_WARNING ]; |
|
| 142 | + return ['E_RECOVERABLE_ERROR', static::E_WARNING]; |
|
| 143 | 143 | |
| 144 | 144 | case E_DEPRECATED: // 8192 // |
| 145 | - return [ 'E_DEPRECATED', static::E_NOTICE ]; |
|
| 145 | + return ['E_DEPRECATED', static::E_NOTICE]; |
|
| 146 | 146 | |
| 147 | 147 | case E_USER_DEPRECATED: // 16384 // |
| 148 | - return [ 'E_USER_DEPRECATED', static::E_NOTICE ]; |
|
| 148 | + return ['E_USER_DEPRECATED', static::E_NOTICE]; |
|
| 149 | 149 | |
| 150 | 150 | default: |
| 151 | - return [ 'E_UNKNOWN', static::E_UNSUPPORTED ]; |
|
| 151 | + return ['E_UNKNOWN', static::E_UNSUPPORTED]; |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -78,12 +78,10 @@ |
||
| 78 | 78 | try |
| 79 | 79 | { |
| 80 | 80 | static::handleError($err['type'], $err['message'], $err['file'], $err['line']); |
| 81 | - } |
|
| 82 | - catch (\Error $ex) |
|
| 81 | + } catch (\Error $ex) |
|
| 83 | 82 | { |
| 84 | 83 | echo call_user_func(static::$errHandler, $ex) . PHP_EOL; |
| 85 | - } |
|
| 86 | - catch (\Exception $ex) |
|
| 84 | + } catch (\Exception $ex) |
|
| 87 | 85 | { |
| 88 | 86 | echo call_user_func(static::$excHandler, $ex) . PHP_EOL; |
| 89 | 87 | } |
@@ -44,14 +44,12 @@ |
||
| 44 | 44 | $this->class = get_class($throwableOrMessage); |
| 45 | 45 | $this->message = $throwableOrMessage->getMessage(); |
| 46 | 46 | $this->prev = $prev === null ? null : new ThrowableProxy($prev); |
| 47 | - } |
|
| 48 | - else if (is_array($throwableOrMessage)) |
|
| 47 | + } else if (is_array($throwableOrMessage)) |
|
| 49 | 48 | { |
| 50 | 49 | $this->class = $throwableOrMessage[0]; |
| 51 | 50 | $this->message = $throwableOrMessage[1]; |
| 52 | 51 | $this->prev = null; |
| 53 | - } |
|
| 54 | - else |
|
| 52 | + } else |
|
| 55 | 53 | { |
| 56 | 54 | $this->class = 'Exception'; |
| 57 | 55 | $this->message = $throwableOrMessage; |