@@ -22,7 +22,8 @@ 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 | 27 | $exceptions[] = $exception; |
| 27 | 28 | } |
| 28 | 29 | |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | $result = []; |
| 32 | 33 | $rootDir = \getcwd(); |
| 33 | 34 | |
| 34 | - foreach ($exceptions as $exception) { |
|
| 35 | + foreach ($exceptions as $exception) |
|
| 36 | + { |
|
| 35 | 37 | $file = \str_starts_with($exception->getFile(), $rootDir) |
| 36 | 38 | ? \substr($exception->getFile(), \strlen($rootDir) + 1) |
| 37 | 39 | : $exception->getFile(); |
@@ -44,9 +46,12 @@ discard block |
||
| 44 | 46 | $exception->getLine(), |
| 45 | 47 | ); |
| 46 | 48 | |
| 47 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
| 49 | + if ($verbosity->value >= Verbosity::DEBUG->value) |
|
| 50 | + { |
|
| 48 | 51 | $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle())); |
| 49 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
| 52 | + } |
|
| 53 | + elseif ($verbosity->value >= Verbosity::VERBOSE->value) |
|
| 54 | + { |
|
| 50 | 55 | $row .= $this->renderTrace($exception); |
| 51 | 56 | } |
| 52 | 57 | |
@@ -64,7 +69,8 @@ discard block |
||
| 64 | 69 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
| 65 | 70 | { |
| 66 | 71 | $stacktrace = $this->getStacktrace($e); |
| 67 | - if ($stacktrace === []) { |
|
| 72 | + if ($stacktrace === []) |
|
| 73 | + { |
|
| 68 | 74 | return ''; |
| 69 | 75 | } |
| 70 | 76 | |
@@ -73,8 +79,10 @@ discard block |
||
| 73 | 79 | |
| 74 | 80 | $pad = \strlen((string)\count($stacktrace)); |
| 75 | 81 | |
| 76 | - foreach ($stacktrace as $i => $trace) { |
|
| 77 | - if (isset($trace['type'], $trace['class'])) { |
|
| 82 | + foreach ($stacktrace as $i => $trace) |
|
| 83 | + { |
|
| 84 | + if (isset($trace['type'], $trace['class'])) |
|
| 85 | + { |
|
| 78 | 86 | $line = \sprintf( |
| 79 | 87 | '%s. %s%s%s()', |
| 80 | 88 | \str_pad((string)($i + 1), $pad, ' ', \STR_PAD_LEFT), |
@@ -82,11 +90,14 @@ discard block |
||
| 82 | 90 | $trace['type'], |
| 83 | 91 | $trace['function'] |
| 84 | 92 | ); |
| 85 | - } else { |
|
| 93 | + } |
|
| 94 | + else |
|
| 95 | + { |
|
| 86 | 96 | $line = $trace['function']; |
| 87 | 97 | } |
| 88 | 98 | |
| 89 | - if (isset($trace['file'])) { |
|
| 99 | + if (isset($trace['file'])) |
|
| 100 | + { |
|
| 90 | 101 | $file = \str_starts_with($trace['file'], $rootDir) |
| 91 | 102 | ? \substr($trace['file'], \strlen($rootDir) + 1) |
| 92 | 103 | : $trace['file']; |
@@ -94,7 +105,8 @@ discard block |
||
| 94 | 105 | $line .= \sprintf(' at %s:%s', $file, $trace['line']); |
| 95 | 106 | } |
| 96 | 107 | |
| 97 | - if (\in_array($line, $this->lines, true)) { |
|
| 108 | + if (\in_array($line, $this->lines, true)) |
|
| 109 | + { |
|
| 98 | 110 | continue; |
| 99 | 111 | } |
| 100 | 112 | |
@@ -102,7 +114,8 @@ discard block |
||
| 102 | 114 | |
| 103 | 115 | $result .= $line . "\n"; |
| 104 | 116 | |
| 105 | - if ($h !== null && !empty($trace['file'])) { |
|
| 117 | + if ($h !== null && !empty($trace['file'])) |
|
| 118 | + { |
|
| 106 | 119 | $result .= $h->highlightLines( |
| 107 | 120 | \file_get_contents($trace['file']), |
| 108 | 121 | $trace['line'], |