Passed
Pull Request — master (#853)
by butschster
07:53
created
src/Exceptions/src/Renderer/PlainRenderer.php 1 patch
Braces   +27 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
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
 
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 
31 32
         $result = [];
32 33
 
33
-        foreach ($exceptions as $exception) {
34
+        foreach ($exceptions as $exception)
35
+        {
34 36
             $row = \sprintf(
35 37
                 "[%s]\n%s in %s:%s\n",
36 38
                 $exception::class,
@@ -39,9 +41,12 @@  discard block
 block discarded – undo
39 41
                 $exception->getLine()
40 42
             );
41 43
 
42
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
44
+            if ($verbosity->value >= Verbosity::DEBUG->value)
45
+            {
43 46
                 $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle()));
44
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
47
+            }
48
+            elseif ($verbosity->value >= Verbosity::VERBOSE->value)
49
+            {
45 50
                 $row .= $this->renderTrace($exception);
46 51
             }
47 52
 
@@ -59,31 +64,40 @@  discard block
 block discarded – undo
59 64
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
60 65
     {
61 66
         $stacktrace = $this->getStacktrace($e);
62
-        if (empty($stacktrace)) {
67
+        if (empty($stacktrace))
68
+        {
63 69
             return '';
64 70
         }
65 71
 
66 72
         $result = "\nException Trace:\n";
67 73
 
68
-        foreach ($stacktrace as $trace) {
69
-            if (isset($trace['type'], $trace['class'])) {
74
+        foreach ($stacktrace as $trace)
75
+        {
76
+            if (isset($trace['type'], $trace['class']))
77
+            {
70 78
                 $line = \sprintf(
71 79
                     ' %s%s%s()',
72 80
                     $trace['class'],
73 81
                     $trace['type'],
74 82
                     $trace['function']
75 83
                 );
76
-            } else {
84
+            }
85
+            else
86
+            {
77 87
                 $line = $trace['function'];
78 88
             }
79 89
 
80
-            if (isset($trace['file'])) {
90
+            if (isset($trace['file']))
91
+            {
81 92
                 $line .= \sprintf(' at %s:%s', $trace['file'], $trace['line']);
82
-            } else {
93
+            }
94
+            else
95
+            {
83 96
                 $line .= \sprintf(' at %s:%s', 'n/a', 'n/a');
84 97
             }
85 98
 
86
-            if (\in_array($line, $this->lines, true)) {
99
+            if (\in_array($line, $this->lines, true))
100
+            {
87 101
                 continue;
88 102
             }
89 103
 
@@ -91,7 +105,8 @@  discard block
 block discarded – undo
91 105
 
92 106
             $result .= $line . "\n";
93 107
 
94
-            if ($h !== null && !empty($trace['file'])) {
108
+            if ($h !== null && !empty($trace['file']))
109
+            {
95 110
                 $result .= $h->highlightLines(
96 111
                     \file_get_contents($trace['file']),
97 112
                     $trace['line'],
Please login to merge, or discard this patch.