@@ -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 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $exceptions = [$exception]; |
69 | 69 | $currentE = $exception; |
70 | 70 | |
71 | - while ($exception = $exception->getPrevious()) { |
|
71 | + while ($exception = $exception->getPrevious()){ |
|
72 | 72 | $exceptions[] = $exception; |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $result = []; |
78 | 78 | $rootDir = \getcwd(); |
79 | 79 | |
80 | - foreach ($exceptions as $exception) { |
|
80 | + foreach ($exceptions as $exception){ |
|
81 | 81 | $prefix = $currentE === $exception ? '' : 'Previous: '; |
82 | 82 | $row = $this->renderHeader( |
83 | 83 | \sprintf("%s[%s]\n%s", $prefix, $exception::class, $exception->getMessage()), |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $exception->getLine() |
95 | 95 | ); |
96 | 96 | |
97 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
97 | + if ($verbosity->value >= Verbosity::DEBUG->value){ |
|
98 | 98 | $row .= $this->renderTrace( |
99 | 99 | $exception, |
100 | 100 | new Highlighter( |
101 | 101 | $this->colorsSupport ? new ConsoleStyle() : new PlainStyle() |
102 | 102 | ) |
103 | 103 | ); |
104 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
104 | + } elseif ($verbosity->value >= Verbosity::VERBOSE->value){ |
|
105 | 105 | $row .= $this->renderTrace($exception); |
106 | 106 | } |
107 | 107 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $length += $padding; |
134 | 134 | |
135 | - foreach ($lines as $line) { |
|
135 | + foreach ($lines as $line){ |
|
136 | 136 | $result .= $this->format( |
137 | 137 | "<{$style}>%s%s%s</reset>\n", |
138 | 138 | \str_repeat('', $padding + 1), |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
151 | 151 | { |
152 | 152 | $stacktrace = $this->getStacktrace($e); |
153 | - if (empty($stacktrace)) { |
|
153 | + if (empty($stacktrace)){ |
|
154 | 154 | return ''; |
155 | 155 | } |
156 | 156 | |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | $pad = \strlen((string)\count($stacktrace)); |
161 | 161 | |
162 | - foreach ($stacktrace as $i => $trace) { |
|
162 | + foreach ($stacktrace as $i => $trace){ |
|
163 | 163 | $file = null; |
164 | 164 | $classColor = 'while'; |
165 | 165 | |
166 | - if (isset($trace['file'])) { |
|
166 | + if (isset($trace['file'])){ |
|
167 | 167 | $file = \str_starts_with($trace['file'], $rootDir) |
168 | 168 | ? \substr($trace['file'], \strlen($rootDir) + 1) |
169 | 169 | : $trace['file']; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $classColor = \str_starts_with($file, 'vendor/') ? 'gray' : 'white'; |
172 | 172 | } |
173 | 173 | |
174 | - if (isset($trace['type'], $trace['class'])) { |
|
174 | + if (isset($trace['type'], $trace['class'])){ |
|
175 | 175 | $line = $this->format( |
176 | 176 | "<$classColor>%s.</reset> <white>%s%s%s()</reset>", |
177 | 177 | \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT), |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $trace['type'], |
180 | 180 | $trace['function'] |
181 | 181 | ); |
182 | - } else { |
|
182 | + }else{ |
|
183 | 183 | $line = $this->format( |
184 | 184 | ' <white>%s()</reset>', |
185 | 185 | $trace['function'] |
186 | 186 | ); |
187 | 187 | } |
188 | - if ($file !== null) { |
|
188 | + if ($file !== null){ |
|
189 | 189 | $line .= $this->format( |
190 | 190 | ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>', |
191 | 191 | $file, |
@@ -193,20 +193,20 @@ discard block |
||
193 | 193 | ); |
194 | 194 | } |
195 | 195 | |
196 | - if (\in_array($line, $this->lines, true)) { |
|
196 | + if (\in_array($line, $this->lines, true)){ |
|
197 | 197 | continue; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $this->lines[] = $line; |
201 | 201 | |
202 | - $result .= $line . "\n"; |
|
202 | + $result .= $line."\n"; |
|
203 | 203 | |
204 | - if ($h !== null && !empty($trace['file'])) { |
|
204 | + if ($h !== null && !empty($trace['file'])){ |
|
205 | 205 | $result .= $h->highlightLines( |
206 | 206 | \file_get_contents($trace['file']), |
207 | 207 | $trace['line'], |
208 | 208 | static::SHOW_LINES |
209 | - ) . "\n"; |
|
209 | + )."\n"; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | */ |
219 | 219 | private function format(string $format, mixed ...$args): string |
220 | 220 | { |
221 | - if (!$this->colorsSupport) { |
|
221 | + if (!$this->colorsSupport){ |
|
222 | 222 | $format = \preg_replace('/<[^>]+>/', '', $format); |
223 | - } else { |
|
224 | - $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial) { |
|
223 | + }else{ |
|
224 | + $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial){ |
|
225 | 225 | $style = ''; |
226 | - foreach (\explode(',', \trim($partial[2], '/')) as $color) { |
|
227 | - if (isset(self::COLORS[$color])) { |
|
226 | + foreach (\explode(',', \trim($partial[2], '/')) as $color){ |
|
227 | + if (isset(self::COLORS[$color])){ |
|
228 | 228 | $style .= self::COLORS[$color]; |
229 | 229 | } |
230 | 230 | } |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function isColorsSupported(mixed $stream = STDOUT): bool |
245 | 245 | { |
246 | - if ('Hyper' === \getenv('TERM_PROGRAM')) { |
|
246 | + if ('Hyper' === \getenv('TERM_PROGRAM')){ |
|
247 | 247 | return true; |
248 | 248 | } |
249 | 249 | |
250 | - try { |
|
251 | - if (\DIRECTORY_SEPARATOR === '\\') { |
|
250 | + try{ |
|
251 | + if (\DIRECTORY_SEPARATOR === '\\'){ |
|
252 | 252 | return (\function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($stream)) |
253 | 253 | || \getenv('ANSICON') !== false |
254 | 254 | || \getenv('ConEmuANSI') === 'ON' |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | return @\stream_isatty($stream); |
259 | - } catch (\Throwable) { |
|
259 | + }catch (\Throwable){ |
|
260 | 260 | return false; |
261 | 261 | } |
262 | 262 | } |