Passed
Push — master ( aad9e9...893d1e )
by Kirill
04:12
created
src/Boot/src/AbstractKernel.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function serve()
99 99
     {
100
-        foreach ($this->dispatchers as $dispatcher) {
101
-            if ($dispatcher->canServe()) {
100
+        foreach ($this->dispatchers as $dispatcher){
101
+            if ($dispatcher->canServe()){
102 102
                 return $this->container->runScope(
103 103
                     [DispatcherInterface::class => $dispatcher],
104 104
                     [$dispatcher, 'serve']
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         EnvironmentInterface $environment = null,
125 125
         bool $handleErrors = true
126 126
     ): ?self {
127
-        if ($handleErrors) {
127
+        if ($handleErrors){
128 128
             ExceptionHandler::register();
129 129
         }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $core = new static(new Container(), $directories);
134 134
         $core->container->bindSingleton(EnvironmentInterface::class, $environment);
135 135
 
136
-        try {
136
+        try{
137 137
             // will protect any against env overwrite action
138 138
             $core->container->runScope(
139 139
                 [EnvironmentInterface::class => $environment],
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     $core->bootstrap();
143 143
                 }
144 144
             );
145
-        } catch (\Throwable $e) {
145
+        }catch (\Throwable $e){
146 146
             ExceptionHandler::handleException($e);
147 147
 
148 148
             return null;
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,8 +97,10 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function serve()
99 99
     {
100
-        foreach ($this->dispatchers as $dispatcher) {
101
-            if ($dispatcher->canServe()) {
100
+        foreach ($this->dispatchers as $dispatcher)
101
+        {
102
+            if ($dispatcher->canServe())
103
+            {
102 104
                 return $this->container->runScope(
103 105
                     [DispatcherInterface::class => $dispatcher],
104 106
                     [$dispatcher, 'serve']
@@ -124,7 +126,8 @@  discard block
 block discarded – undo
124 126
         EnvironmentInterface $environment = null,
125 127
         bool $handleErrors = true
126 128
     ): ?self {
127
-        if ($handleErrors) {
129
+        if ($handleErrors)
130
+        {
128 131
             ExceptionHandler::register();
129 132
         }
130 133
 
@@ -133,7 +136,8 @@  discard block
 block discarded – undo
133 136
         $core = new static(new Container(), $directories);
134 137
         $core->container->bindSingleton(EnvironmentInterface::class, $environment);
135 138
 
136
-        try {
139
+        try
140
+        {
137 141
             // will protect any against env overwrite action
138 142
             $core->container->runScope(
139 143
                 [EnvironmentInterface::class => $environment],
@@ -142,7 +146,9 @@  discard block
 block discarded – undo
142 146
                     $core->bootstrap();
143 147
                 }
144 148
             );
145
-        } catch (\Throwable $e) {
149
+        }
150
+        catch (\Throwable $e)
151
+        {
146 152
             ExceptionHandler::handleException($e);
147 153
 
148 154
             return null;
Please login to merge, or discard this patch.
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.