@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ): string { |
23 | 23 | $verbosity ??= $this->defaultVerbosity; |
24 | 24 | $exceptions = [$exception]; |
25 | - while ($exception = $exception->getPrevious()) { |
|
25 | + while ($exception = $exception->getPrevious()){ |
|
26 | 26 | $exceptions[] = $exception; |
27 | 27 | } |
28 | 28 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $result = []; |
32 | 32 | $rootDir = \getcwd(); |
33 | 33 | |
34 | - foreach ($exceptions as $exception) { |
|
34 | + foreach ($exceptions as $exception){ |
|
35 | 35 | $file = \str_starts_with($exception->getFile(), $rootDir) |
36 | 36 | ? \substr($exception->getFile(), \strlen($rootDir) + 1) |
37 | 37 | : $exception->getFile(); |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | $exception->getLine(), |
45 | 45 | ); |
46 | 46 | |
47 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
47 | + if ($verbosity->value >= Verbosity::DEBUG->value){ |
|
48 | 48 | $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle())); |
49 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
49 | + } elseif ($verbosity->value >= Verbosity::VERBOSE->value){ |
|
50 | 50 | $row .= $this->renderTrace($exception); |
51 | 51 | } |
52 | 52 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
65 | 65 | { |
66 | 66 | $stacktrace = $this->getStacktrace($e); |
67 | - if ($stacktrace === []) { |
|
67 | + if ($stacktrace === []){ |
|
68 | 68 | return ''; |
69 | 69 | } |
70 | 70 | |
@@ -73,20 +73,20 @@ discard block |
||
73 | 73 | |
74 | 74 | $pad = \strlen((string)\count($stacktrace)); |
75 | 75 | |
76 | - foreach ($stacktrace as $i => $trace) { |
|
77 | - if (isset($trace['type'], $trace['class'])) { |
|
76 | + foreach ($stacktrace as $i => $trace){ |
|
77 | + if (isset($trace['type'], $trace['class'])){ |
|
78 | 78 | $line = \sprintf( |
79 | 79 | '%s. %s%s%s()', |
80 | - \str_pad((string)((int) $i + 1), $pad, ' ', \STR_PAD_LEFT), |
|
80 | + \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT), |
|
81 | 81 | $trace['class'], |
82 | 82 | $trace['type'], |
83 | 83 | $trace['function'] |
84 | 84 | ); |
85 | - } else { |
|
85 | + }else{ |
|
86 | 86 | $line = $trace['function']; |
87 | 87 | } |
88 | 88 | |
89 | - if (isset($trace['file'])) { |
|
89 | + if (isset($trace['file'])){ |
|
90 | 90 | $file = \str_starts_with($trace['file'], $rootDir) |
91 | 91 | ? \substr($trace['file'], \strlen($rootDir) + 1) |
92 | 92 | : $trace['file']; |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | $line .= \sprintf(' at %s:%s', $file, $trace['line']); |
95 | 95 | } |
96 | 96 | |
97 | - if (\in_array($line, $this->lines, true)) { |
|
97 | + if (\in_array($line, $this->lines, true)){ |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->lines[] = $line; |
102 | 102 | |
103 | - $result .= $line . "\n"; |
|
103 | + $result .= $line."\n"; |
|
104 | 104 | |
105 | - if ($h !== null && !empty($trace['file'])) { |
|
105 | + if ($h !== null && !empty($trace['file'])){ |
|
106 | 106 | $result .= $h->highlightLines( |
107 | 107 | \file_get_contents($trace['file']), |
108 | 108 | $trace['line'], |
109 | 109 | self::SHOW_LINES |
110 | - ) . "\n"; |
|
110 | + )."\n"; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - return $result . "\n"; |
|
114 | + return $result."\n"; |
|
115 | 115 | } |
116 | 116 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $verbosity ??= $this->defaultVerbosity; |
66 | 66 | |
67 | 67 | $exceptions = [$exception]; |
68 | - while ($exception = $exception->getPrevious()) { |
|
68 | + while ($exception = $exception->getPrevious()){ |
|
69 | 69 | $exceptions[] = $exception; |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $result = []; |
75 | 75 | $rootDir = \getcwd(); |
76 | 76 | |
77 | - foreach ($exceptions as $exception) { |
|
77 | + foreach ($exceptions as $exception){ |
|
78 | 78 | $row = $this->renderHeader( |
79 | 79 | \sprintf("[%s]\n%s", $exception::class, $exception->getMessage()), |
80 | 80 | $exception instanceof \Error ? 'bg:magenta,white' : 'bg:red,white' |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | $exception->getLine() |
91 | 91 | ); |
92 | 92 | |
93 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
93 | + if ($verbosity->value >= Verbosity::DEBUG->value){ |
|
94 | 94 | $row .= $this->renderTrace($exception, new Highlighter( |
95 | 95 | $this->colorsSupport ? new ConsoleStyle() : new PlainStyle() |
96 | 96 | )); |
97 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
97 | + } elseif ($verbosity->value >= Verbosity::VERBOSE->value){ |
|
98 | 98 | $row .= $this->renderTrace($exception); |
99 | 99 | } |
100 | 100 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $length += $padding; |
127 | 127 | |
128 | - foreach ($lines as $line) { |
|
128 | + foreach ($lines as $line){ |
|
129 | 129 | $result .= $this->format( |
130 | 130 | "<{$style}>%s%s%s</reset>\n", |
131 | 131 | \str_repeat('', $padding + 1), |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
144 | 144 | { |
145 | 145 | $stacktrace = $this->getStacktrace($e); |
146 | - if (empty($stacktrace)) { |
|
146 | + if (empty($stacktrace)){ |
|
147 | 147 | return ''; |
148 | 148 | } |
149 | 149 | |
@@ -152,23 +152,23 @@ discard block |
||
152 | 152 | |
153 | 153 | $pad = \strlen((string)\count($stacktrace)); |
154 | 154 | |
155 | - foreach ($stacktrace as $i => $trace) { |
|
156 | - if (isset($trace['type'], $trace['class'])) { |
|
155 | + foreach ($stacktrace as $i => $trace){ |
|
156 | + if (isset($trace['type'], $trace['class'])){ |
|
157 | 157 | $line = $this->format( |
158 | 158 | ' <white>%s. %s%s%s()</reset>', |
159 | - \str_pad((string)((int) $i + 1), $pad, ' ', \STR_PAD_LEFT), |
|
159 | + \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT), |
|
160 | 160 | $trace['class'], |
161 | 161 | $trace['type'], |
162 | 162 | $trace['function'] |
163 | 163 | ); |
164 | - } else { |
|
164 | + }else{ |
|
165 | 165 | $line = $this->format( |
166 | 166 | ' <white>%s()</reset>', |
167 | 167 | $trace['function'] |
168 | 168 | ); |
169 | 169 | } |
170 | 170 | |
171 | - if (isset($trace['file'])) { |
|
171 | + if (isset($trace['file'])){ |
|
172 | 172 | $file = \str_starts_with($trace['file'], $rootDir) |
173 | 173 | ? \substr($trace['file'], \strlen($rootDir) + 1) |
174 | 174 | : $trace['file']; |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if (\in_array($line, $this->lines, true)) { |
|
183 | + if (\in_array($line, $this->lines, true)){ |
|
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | |
187 | - $result .= $line . "\n"; |
|
187 | + $result .= $line."\n"; |
|
188 | 188 | |
189 | - if ($h !== null && !empty($trace['file'])) { |
|
189 | + if ($h !== null && !empty($trace['file'])){ |
|
190 | 190 | $result .= $h->highlightLines( |
191 | 191 | \file_get_contents($trace['file']), |
192 | 192 | $trace['line'], |
193 | 193 | static::SHOW_LINES |
194 | - ) . "\n"; |
|
194 | + )."\n"; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function format(string $format, mixed ...$args): string |
205 | 205 | { |
206 | - if (!$this->colorsSupport) { |
|
206 | + if (!$this->colorsSupport){ |
|
207 | 207 | $format = \preg_replace('/<[^>]+>/', '', $format); |
208 | - } else { |
|
209 | - $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial) { |
|
208 | + }else{ |
|
209 | + $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial){ |
|
210 | 210 | $style = ''; |
211 | - foreach (\explode(',', \trim($partial[2], '/')) as $color) { |
|
212 | - if (isset(self::COLORS[$color])) { |
|
211 | + foreach (\explode(',', \trim($partial[2], '/')) as $color){ |
|
212 | + if (isset(self::COLORS[$color])){ |
|
213 | 213 | $style .= self::COLORS[$color]; |
214 | 214 | } |
215 | 215 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | */ |
229 | 229 | private function isColorsSupported(mixed $stream = STDOUT): bool |
230 | 230 | { |
231 | - if ('Hyper' === \getenv('TERM_PROGRAM')) { |
|
231 | + if ('Hyper' === \getenv('TERM_PROGRAM')){ |
|
232 | 232 | return true; |
233 | 233 | } |
234 | 234 | |
235 | - try { |
|
236 | - if (\DIRECTORY_SEPARATOR === '\\') { |
|
235 | + try{ |
|
236 | + if (\DIRECTORY_SEPARATOR === '\\'){ |
|
237 | 237 | return (\function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($stream)) |
238 | 238 | || \getenv('ANSICON') !== false |
239 | 239 | || \getenv('ConEmuANSI') === 'ON' |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | return @\stream_isatty($stream); |
244 | - } catch (\Throwable) { |
|
244 | + }catch (\Throwable){ |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | } |