Passed
Push — master ( 2291e3...cd7158 )
by Anton
03:34
created
src/Exceptions/tests/HighlighterTest.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function testHtmlHighlighter(): void
30 30
     {
31
-        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
31
+        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default));
32 32
 
33 33
         $this->assertStringContainsString('HighlighterTest', $highlighter->highlight(file_get_contents(__FILE__)));
34 34
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function testHtmlHighlighterLines(): void
61 61
     {
62
-        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT));
62
+        $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default));
63 63
 
64 64
         $this->assertStringContainsString(
65 65
             'HighlighterTest',
Please login to merge, or discard this patch.
src/Exceptions/views/exception.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         </div>
48 48
     </div>
49 49
     <?php
50
-    foreach ($valueWrapper->getValues() as $id => $content) {
50
+    foreach ($valueWrapper->getValues() as $id => $content){
51 51
         echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>";
52 52
     }
53 53
     ?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@
 block discarded – undo
47 47
         </div>
48 48
     </div>
49 49
     <?php
50
-    foreach ($valueWrapper->getValues() as $id => $content) {
50
+    foreach ($valueWrapper->getValues() as $id => $content)
51
+    {
51 52
         echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>";
52 53
     }
53 54
     ?>
Please login to merge, or discard this patch.
src/Exceptions/views/partials/stacktrace.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 $vendorDir = dirname(dirname($vendorDir));
11 11
 $vendorID = null;
12 12
 $vendorCount = 0;
13
-foreach ($stacktrace as $index => $trace) {
13
+foreach ($stacktrace as $index => $trace){
14 14
     $args = [];
15
-    if (isset($trace['args'])) {
15
+    if (isset($trace['args'])){
16 16
         $args = $valueWrapper->wrap($trace['args']);
17 17
     }
18 18
 
19
-    $function = '<strong>' . $trace['function'] . '</strong>';
20
-    if (isset($trace['type']) && isset($trace['class'])) {
19
+    $function = '<strong>'.$trace['function'].'</strong>';
20
+    if (isset($trace['type']) && isset($trace['class'])){
21 21
         $reflection = new ReflectionClass($trace['class']);
22 22
         $function = sprintf(
23 23
             '<span title="%s">%s</span>%s%s',
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         );
29 29
     }
30 30
 
31
-    if (!isset($trace['file']) || !file_exists($trace['file'])) { ?>
31
+    if (!isset($trace['file']) || !file_exists($trace['file'])){ ?>
32 32
         <div class="container no-trace">
33 33
             <?= $function ?>(<span class="arguments"><?= join(', ', $args) ?></span>)
34 34
         </div>
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
     }
38 38
 
39 39
     $isVendor = strpos($trace['file'], $vendorDir) === 0 && $index > 1;
40
-    if ($isVendor) {
41
-        if ($vendorID === null) {
40
+    if ($isVendor){
41
+        if ($vendorID === null){
42 42
             $vendorID = $index;
43 43
             $vendorCount++;
44 44
             echo sprintf('<span id="hidden-trace-%s" style="display: none;">', $vendorID);
45
-        } else {
45
+        }else{
46 46
             $vendorCount++;
47 47
         }
48
-    } elseif ($vendorID !== null) {
48
+    } elseif ($vendorID !== null){
49 49
         echo '</span>';
50 50
         echo sprintf(
51 51
             '<div id="%s" class="container" style="cursor: pointer;" onclick="toggle(\'%s\'); toggle(\'%s\');">&plus; %s vendor frame(s)...</div>',
52
-            'toggle-trace-' . $vendorID,
53
-            'toggle-trace-' . $vendorID,
54
-            'hidden-trace-' . $vendorID,
52
+            'toggle-trace-'.$vendorID,
53
+            'toggle-trace-'.$vendorID,
54
+            'hidden-trace-'.$vendorID,
55 55
             $vendorCount
56 56
         );
57 57
         $vendorID = null;
@@ -72,6 +72,6 @@  discard block
 block discarded – undo
72 72
     <?php
73 73
 }
74 74
 
75
-if ($vendorID !== null) {
75
+if ($vendorID !== null){
76 76
     echo '</span>';
77 77
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,14 +10,17 @@  discard block
 block discarded – undo
10 10
 $vendorDir = dirname(dirname($vendorDir));
11 11
 $vendorID = null;
12 12
 $vendorCount = 0;
13
-foreach ($stacktrace as $index => $trace) {
13
+foreach ($stacktrace as $index => $trace)
14
+{
14 15
     $args = [];
15
-    if (isset($trace['args'])) {
16
+    if (isset($trace['args']))
17
+    {
16 18
         $args = $valueWrapper->wrap($trace['args']);
17 19
     }
18 20
 
19 21
     $function = '<strong>' . $trace['function'] . '</strong>';
20
-    if (isset($trace['type']) && isset($trace['class'])) {
22
+    if (isset($trace['type']) && isset($trace['class']))
23
+    {
21 24
         $reflection = new ReflectionClass($trace['class']);
22 25
         $function = sprintf(
23 26
             '<span title="%s">%s</span>%s%s',
@@ -28,7 +31,9 @@  discard block
 block discarded – undo
28 31
         );
29 32
     }
30 33
 
31
-    if (!isset($trace['file']) || !file_exists($trace['file'])) { ?>
34
+    if (!isset($trace['file']) || !file_exists($trace['file']))
35
+    {
36
+?>
32 37
         <div class="container no-trace">
33 38
             <?= $function ?>(<span class="arguments"><?= join(', ', $args) ?></span>)
34 39
         </div>
@@ -37,15 +42,21 @@  discard block
 block discarded – undo
37 42
     }
38 43
 
39 44
     $isVendor = strpos($trace['file'], $vendorDir) === 0 && $index > 1;
40
-    if ($isVendor) {
41
-        if ($vendorID === null) {
45
+    if ($isVendor)
46
+    {
47
+        if ($vendorID === null)
48
+        {
42 49
             $vendorID = $index;
43 50
             $vendorCount++;
44 51
             echo sprintf('<span id="hidden-trace-%s" style="display: none;">', $vendorID);
45
-        } else {
52
+        }
53
+        else
54
+        {
46 55
             $vendorCount++;
47 56
         }
48
-    } elseif ($vendorID !== null) {
57
+    }
58
+    elseif ($vendorID !== null)
59
+    {
49 60
         echo '</span>';
50 61
         echo sprintf(
51 62
             '<div id="%s" class="container" style="cursor: pointer;" onclick="toggle(\'%s\'); toggle(\'%s\');">&plus; %s vendor frame(s)...</div>',
@@ -72,6 +83,7 @@  discard block
 block discarded – undo
72 83
     <?php
73 84
 }
74 85
 
75
-if ($vendorID !== null) {
86
+if ($vendorID !== null)
87
+{
76 88
     echo '</span>';
77 89
 }
Please login to merge, or discard this patch.
src/Exceptions/views/partials/tags.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <div class="tags">
2 2
     <div class="container">
3 3
         <?php
4
-        foreach ($tags as $tag => $value) {
4
+        foreach ($tags as $tag => $value){
5 5
             echo sprintf(
6 6
                 '<div class="tag"><div class="name">%s</div><div class="value">%s</div></div>',
7 7
                 $tag,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <div class="tags">
2 2
     <div class="container">
3 3
         <?php
4
-        foreach ($tags as $tag => $value) {
4
+        foreach ($tags as $tag => $value)
5
+        {
5 6
             echo sprintf(
6 7
                 '<div class="tag"><div class="name">%s</div><div class="value">%s</div></div>',
7 8
                 $tag,
Please login to merge, or discard this patch.
src/Exceptions/views/partials/logs.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
             <table>
6 6
                 <?php
7 7
                 /** @var \Spiral\Logger\Event\LogEvent $log */
8
-                foreach ($logEvents as $log) {
8
+                foreach ($logEvents as $log){
9 9
                     echo sprintf(
10 10
                         '<tr><td class="channel">%s</td><td class="message">%s</td></tr>',
11 11
                         $log->getChannel(),
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
             <table>
6 6
                 <?php
7 7
                 /** @var \Spiral\Logger\Event\LogEvent $log */
8
-                foreach ($logEvents as $log) {
8
+                foreach ($logEvents as $log)
9
+                {
9 10
                     echo sprintf(
10 11
                         '<tr><td class="channel">%s</td><td class="message">%s</td></tr>',
11 12
                         $log->getChannel(),
Please login to merge, or discard this patch.
src/Exceptions/views/partials/variables.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
             </div>
7 7
             <div class="dump" id="<?= md5($name) ?>-variables" style="display: none;">
8 8
                 <?php
9
-                if (!is_array($content)) {
9
+                if (!is_array($content)){
10 10
                     echo is_scalar($value) ? htmlspecialchars($value) : json_encode($value, JSON_PRETTY_PRINT);
11
-                } else { ?>
11
+                }else{ ?>
12 12
                     <table>
13 13
                         <?php
14
-                        foreach ($content as $key => $value) {
14
+                        foreach ($content as $key => $value){
15 15
                             // todo: values
16 16
                             echo sprintf(
17 17
                                 '<tr><td class="name">%s</td><td>%s</td></tr>',
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,17 @@
 block discarded – undo
6 6
             </div>
7 7
             <div class="dump" id="<?= md5($name) ?>-variables" style="display: none;">
8 8
                 <?php
9
-                if (!is_array($content)) {
9
+                if (!is_array($content))
10
+                {
10 11
                     echo is_scalar($value) ? htmlspecialchars($value) : json_encode($value, JSON_PRETTY_PRINT);
11
-                } else { ?>
12
+                }
13
+                else
14
+                {
15
+?>
12 16
                     <table>
13 17
                         <?php
14
-                        foreach ($content as $key => $value) {
18
+                        foreach ($content as $key => $value)
19
+                        {
15 20
                             // todo: values
16 21
                             echo sprintf(
17 22
                                 '<tr><td class="name">%s</td><td>%s</td></tr>',
Please login to merge, or discard this patch.
src/Exceptions/views/partials/chain.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,23 +4,23 @@  discard block
 block discarded – undo
4 4
  * @var Throwable                       $exception
5 5
  * @var \Spiral\Exceptions\ValueWrapper $valueWrapper
6 6
  */
7
-foreach ($stacktrace as $index => $trace) {
8
-    if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])) {
7
+foreach ($stacktrace as $index => $trace){
8
+    if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])){
9 9
         $trace['file'] = $stacktrace[$index - 1]['file'];
10 10
         $trace['line'] = $stacktrace[$index - 1]['line'];
11 11
     }
12 12
 
13
-    if (!isset($stacktrace[$index + 1])) {
13
+    if (!isset($stacktrace[$index + 1])){
14 14
         $trace['file'] = $exception->getFile();
15 15
         $trace['line'] = $exception->getLine();
16 16
     }
17 17
 
18
-    if (!isset($trace['function']) || !isset($trace['file'])) {
18
+    if (!isset($trace['function']) || !isset($trace['file'])){
19 19
         continue;
20 20
     }
21 21
 
22
-    $function = '<strong>' . $trace['function'] . '</strong>';
23
-    if (isset($trace['type']) && isset($trace['class'])) {
22
+    $function = '<strong>'.$trace['function'].'</strong>';
23
+    if (isset($trace['type']) && isset($trace['class'])){
24 24
         $reflection = new ReflectionClass($trace['class']);
25 25
         $function = sprintf(
26 26
             '<span title="%s">%s</span>%s%s',
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     }
33 33
 
34 34
     $args = [];
35
-    if (isset($trace['args'])) {
35
+    if (isset($trace['args'])){
36 36
         $args = $valueWrapper->wrap($trace['args']);
37 37
     } ?>
38 38
     <div class="call">
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,23 +4,28 @@  discard block
 block discarded – undo
4 4
  * @var Throwable                       $exception
5 5
  * @var \Spiral\Exceptions\ValueWrapper $valueWrapper
6 6
  */
7
-foreach ($stacktrace as $index => $trace) {
8
-    if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])) {
7
+foreach ($stacktrace as $index => $trace)
8
+{
9
+    if (empty($trace['file']) && isset($stacktrace[$index - 1]['file']))
10
+    {
9 11
         $trace['file'] = $stacktrace[$index - 1]['file'];
10 12
         $trace['line'] = $stacktrace[$index - 1]['line'];
11 13
     }
12 14
 
13
-    if (!isset($stacktrace[$index + 1])) {
15
+    if (!isset($stacktrace[$index + 1]))
16
+    {
14 17
         $trace['file'] = $exception->getFile();
15 18
         $trace['line'] = $exception->getLine();
16 19
     }
17 20
 
18
-    if (!isset($trace['function']) || !isset($trace['file'])) {
21
+    if (!isset($trace['function']) || !isset($trace['file']))
22
+    {
19 23
         continue;
20 24
     }
21 25
 
22 26
     $function = '<strong>' . $trace['function'] . '</strong>';
23
-    if (isset($trace['type']) && isset($trace['class'])) {
27
+    if (isset($trace['type']) && isset($trace['class']))
28
+    {
24 29
         $reflection = new ReflectionClass($trace['class']);
25 30
         $function = sprintf(
26 31
             '<span title="%s">%s</span>%s%s',
@@ -32,7 +37,8 @@  discard block
 block discarded – undo
32 37
     }
33 38
 
34 39
     $args = [];
35
-    if (isset($trace['args'])) {
40
+    if (isset($trace['args']))
41
+    {
36 42
         $args = $valueWrapper->wrap($trace['args']);
37 43
     } ?>
38 44
     <div class="call">
Please login to merge, or discard this patch.
src/Exceptions/src/AbstractHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace)){
37 37
             return [];
38 38
         }
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                 'line' => $e->getLine()
44 44
             ] + $stacktrace[0];
45 45
 
46
-        if ($stacktrace[0] != $header) {
46
+        if ($stacktrace[0] != $header){
47 47
             array_unshift($stacktrace, $header);
48 48
         }
49 49
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
     protected function getStacktrace(\Throwable $e): array
34 34
     {
35 35
         $stacktrace = $e->getTrace();
36
-        if (empty($stacktrace)) {
36
+        if (empty($stacktrace))
37
+        {
37 38
             return [];
38 39
         }
39 40
 
@@ -43,7 +44,8 @@  discard block
 block discarded – undo
43 44
                 'line' => $e->getLine()
44 45
             ] + $stacktrace[0];
45 46
 
46
-        if ($stacktrace[0] != $header) {
47
+        if ($stacktrace[0] != $header)
48
+        {
47 49
             array_unshift($stacktrace, $header);
48 50
         }
49 51
 
Please login to merge, or discard this patch.
src/Exceptions/src/PlainHandler.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $result = '';
27 27
 
28
-        if ($e instanceof \Error) {
29
-            $result .= '[' . get_class($e) . "]\n" . $e->getMessage();
30
-        } else {
31
-            $result .= '[' . get_class($e) . "]\n" . $e->getMessage();
28
+        if ($e instanceof \Error){
29
+            $result .= '['.get_class($e)."]\n".$e->getMessage();
30
+        }else{
31
+            $result .= '['.get_class($e)."]\n".$e->getMessage();
32 32
         }
33 33
 
34 34
         $result .= sprintf("in %s:%s\n", $e->getFile(), $e->getLine());
35 35
 
36
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
36
+        if ($verbosity >= self::VERBOSITY_DEBUG){
37 37
             $result .= $this->renderTrace($e, new Highlighter(new PlainStyle()));
38
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
38
+        } elseif ($verbosity >= self::VERBOSITY_VERBOSE){
39 39
             $result .= $this->renderTrace($e);
40 40
         }
41 41
 
@@ -52,38 +52,38 @@  discard block
 block discarded – undo
52 52
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
53 53
     {
54 54
         $stacktrace = $this->getStacktrace($e);
55
-        if (empty($stacktrace)) {
55
+        if (empty($stacktrace)){
56 56
             return '';
57 57
         }
58 58
 
59 59
         $result = "\nException Trace:\n";
60 60
 
61
-        foreach ($stacktrace as $trace) {
62
-            if (isset($trace['type']) && isset($trace['class'])) {
61
+        foreach ($stacktrace as $trace){
62
+            if (isset($trace['type']) && isset($trace['class'])){
63 63
                 $line = sprintf(
64 64
                     ' %s%s%s()',
65 65
                     $trace['class'],
66 66
                     $trace['type'],
67 67
                     $trace['function']
68 68
                 );
69
-            } else {
69
+            }else{
70 70
                 $line = $trace['function'];
71 71
             }
72 72
 
73
-            if (isset($trace['file'])) {
73
+            if (isset($trace['file'])){
74 74
                 $line .= sprintf(' at %s:%s', $trace['file'], $trace['line']);
75
-            } else {
75
+            }else{
76 76
                 $line .= sprintf(' at %s:%s', 'n/a', 'n/a');
77 77
             }
78 78
 
79
-            $result .= $line . "\n";
79
+            $result .= $line."\n";
80 80
 
81
-            if (!empty($h) && !empty($trace['file'])) {
81
+            if (!empty($h) && !empty($trace['file'])){
82 82
                 $result .= $h->highlightLines(
83 83
                     file_get_contents($trace['file']),
84 84
                     $trace['line'],
85 85
                     static::SHOW_LINES
86
-                ) . "\n";
86
+                )."\n";
87 87
             }
88 88
         }
89 89
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,17 +25,23 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $result = '';
27 27
 
28
-        if ($e instanceof \Error) {
28
+        if ($e instanceof \Error)
29
+        {
29 30
             $result .= '[' . get_class($e) . "]\n" . $e->getMessage();
30
-        } else {
31
+        }
32
+        else
33
+        {
31 34
             $result .= '[' . get_class($e) . "]\n" . $e->getMessage();
32 35
         }
33 36
 
34 37
         $result .= sprintf("in %s:%s\n", $e->getFile(), $e->getLine());
35 38
 
36
-        if ($verbosity >= self::VERBOSITY_DEBUG) {
39
+        if ($verbosity >= self::VERBOSITY_DEBUG)
40
+        {
37 41
             $result .= $this->renderTrace($e, new Highlighter(new PlainStyle()));
38
-        } elseif ($verbosity >= self::VERBOSITY_VERBOSE) {
42
+        }
43
+        elseif ($verbosity >= self::VERBOSITY_VERBOSE)
44
+        {
39 45
             $result .= $this->renderTrace($e);
40 46
         }
41 47
 
@@ -52,33 +58,42 @@  discard block
 block discarded – undo
52 58
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
53 59
     {
54 60
         $stacktrace = $this->getStacktrace($e);
55
-        if (empty($stacktrace)) {
61
+        if (empty($stacktrace))
62
+        {
56 63
             return '';
57 64
         }
58 65
 
59 66
         $result = "\nException Trace:\n";
60 67
 
61
-        foreach ($stacktrace as $trace) {
62
-            if (isset($trace['type']) && isset($trace['class'])) {
68
+        foreach ($stacktrace as $trace)
69
+        {
70
+            if (isset($trace['type']) && isset($trace['class']))
71
+            {
63 72
                 $line = sprintf(
64 73
                     ' %s%s%s()',
65 74
                     $trace['class'],
66 75
                     $trace['type'],
67 76
                     $trace['function']
68 77
                 );
69
-            } else {
78
+            }
79
+            else
80
+            {
70 81
                 $line = $trace['function'];
71 82
             }
72 83
 
73
-            if (isset($trace['file'])) {
84
+            if (isset($trace['file']))
85
+            {
74 86
                 $line .= sprintf(' at %s:%s', $trace['file'], $trace['line']);
75
-            } else {
87
+            }
88
+            else
89
+            {
76 90
                 $line .= sprintf(' at %s:%s', 'n/a', 'n/a');
77 91
             }
78 92
 
79 93
             $result .= $line . "\n";
80 94
 
81
-            if (!empty($h) && !empty($trace['file'])) {
95
+            if (!empty($h) && !empty($trace['file']))
96
+            {
82 97
                 $result .= $h->highlightLines(
83 98
                     file_get_contents($trace['file']),
84 99
                     $trace['line'],
Please login to merge, or discard this patch.