Passed
Pull Request — master (#1087)
by Maxim
22:51
created
src/Router/src/Registry/RoutePatternRegistryInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
      * @param non-empty-string $name
9 9
      * @param non-empty-string|\Stringable $pattern
10 10
      */
11
-    public function register(string $name, string|\Stringable $pattern): void;
11
+    public function register(string $name, string | \Stringable $pattern): void;
12 12
 
13 13
     /**
14 14
      * @return array<non-empty-string, non-empty-string>
Please login to merge, or discard this patch.
src/Reactor/src/Partial/Method.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     {
73 73
         $param = PromotedParameter::fromElement($this->element->addPromotedParameter($name));
74 74
 
75
-        if (\func_num_args() > 1) {
75
+        if (\func_num_args() > 1){
76 76
             $param->setDefaultValue($defaultValue);
77 77
         }
78 78
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@
 block discarded – undo
72 72
     {
73 73
         $param = PromotedParameter::fromElement($this->element->addPromotedParameter($name));
74 74
 
75
-        if (\func_num_args() > 1) {
75
+        if (\func_num_args() > 1)
76
+        {
76 77
             $param->setDefaultValue($defaultValue);
77 78
         }
78 79
 
Please login to merge, or discard this patch.
src/Exceptions/src/Renderer/PlainRenderer.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  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
             $exceptions[] = $exception;
27 27
         }
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 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
 
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)((int) $i + 1), $pad, ' ', \STR_PAD_LEFT),
@@ -82,11 +90,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'],
Please login to merge, or discard this patch.
src/Exceptions/src/Renderer/ConsoleRenderer.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
256 256
             }
257 257
 
258 258
             return @\stream_isatty($stream);
259
-        } catch (\Throwable) {
259
+        }catch (\Throwable){
260 260
             return false;
261 261
         }
262 262
     }
Please login to merge, or discard this patch.
Braces   +48 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,7 +68,8 @@  discard block
 block discarded – undo
68 68
         $exceptions = [$exception];
69 69
         $currentE = $exception;
70 70
 
71
-        while ($exception = $exception->getPrevious()) {
71
+        while ($exception = $exception->getPrevious())
72
+        {
72 73
             $exceptions[] = $exception;
73 74
         }
74 75
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
         $result = [];
78 79
         $rootDir = \getcwd();
79 80
 
80
-        foreach ($exceptions as $exception) {
81
+        foreach ($exceptions as $exception)
82
+        {
81 83
             $prefix = $currentE === $exception ? '' : 'Previous: ';
82 84
             $row = $this->renderHeader(
83 85
                 \sprintf("%s[%s]\n%s", $prefix, $exception::class, $exception->getMessage()),
@@ -94,14 +96,17 @@  discard block
 block discarded – undo
94 96
                 $exception->getLine()
95 97
             );
96 98
 
97
-            if ($verbosity->value >= Verbosity::DEBUG->value) {
99
+            if ($verbosity->value >= Verbosity::DEBUG->value)
100
+            {
98 101
                 $row .= $this->renderTrace(
99 102
                     $exception,
100 103
                     new Highlighter(
101 104
                         $this->colorsSupport ? new ConsoleStyle() : new PlainStyle()
102 105
                     )
103 106
                 );
104
-            } elseif ($verbosity->value >= Verbosity::VERBOSE->value) {
107
+            }
108
+            elseif ($verbosity->value >= Verbosity::VERBOSE->value)
109
+            {
105 110
                 $row .= $this->renderTrace($exception);
106 111
             }
107 112
 
@@ -132,7 +137,8 @@  discard block
 block discarded – undo
132 137
 
133 138
         $length += $padding;
134 139
 
135
-        foreach ($lines as $line) {
140
+        foreach ($lines as $line)
141
+        {
136 142
             $result .= $this->format(
137 143
                 "<{$style}>%s%s%s</reset>\n",
138 144
                 \str_repeat('', $padding + 1),
@@ -150,7 +156,8 @@  discard block
 block discarded – undo
150 156
     private function renderTrace(\Throwable $e, Highlighter $h = null): string
151 157
     {
152 158
         $stacktrace = $this->getStacktrace($e);
153
-        if (empty($stacktrace)) {
159
+        if (empty($stacktrace))
160
+        {
154 161
             return '';
155 162
         }
156 163
 
@@ -159,11 +166,13 @@  discard block
 block discarded – undo
159 166
 
160 167
         $pad = \strlen((string)\count($stacktrace));
161 168
 
162
-        foreach ($stacktrace as $i => $trace) {
169
+        foreach ($stacktrace as $i => $trace)
170
+        {
163 171
             $file = null;
164 172
             $classColor = 'while';
165 173
 
166
-            if (isset($trace['file'])) {
174
+            if (isset($trace['file']))
175
+            {
167 176
                 $file = \str_starts_with($trace['file'], $rootDir)
168 177
                     ? \substr($trace['file'], \strlen($rootDir) + 1)
169 178
                     : $trace['file'];
@@ -171,7 +180,8 @@  discard block
 block discarded – undo
171 180
                 $classColor = \str_starts_with($file, 'vendor/') ? 'gray' : 'white';
172 181
             }
173 182
 
174
-            if (isset($trace['type'], $trace['class'])) {
183
+            if (isset($trace['type'], $trace['class']))
184
+            {
175 185
                 $line = $this->format(
176 186
                     "<$classColor>%s.</reset> <white>%s%s%s()</reset>",
177 187
                     \str_pad((string)((int)$i + 1), $pad, ' ', \STR_PAD_LEFT),
@@ -179,13 +189,16 @@  discard block
 block discarded – undo
179 189
                     $trace['type'],
180 190
                     $trace['function']
181 191
                 );
182
-            } else {
192
+            }
193
+            else
194
+            {
183 195
                 $line = $this->format(
184 196
                     ' <white>%s()</reset>',
185 197
                     $trace['function']
186 198
                 );
187 199
             }
188
-            if ($file !== null) {
200
+            if ($file !== null)
201
+            {
189 202
                 $line .= $this->format(
190 203
                     ' <yellow>at</reset> <green>%s</reset><yellow>:</reset><white>%s</reset>',
191 204
                     $file,
@@ -193,7 +206,8 @@  discard block
 block discarded – undo
193 206
                 );
194 207
             }
195 208
 
196
-            if (\in_array($line, $this->lines, true)) {
209
+            if (\in_array($line, $this->lines, true))
210
+            {
197 211
                 continue;
198 212
             }
199 213
 
@@ -201,7 +215,8 @@  discard block
 block discarded – undo
201 215
 
202 216
             $result .= $line . "\n";
203 217
 
204
-            if ($h !== null && !empty($trace['file'])) {
218
+            if ($h !== null && !empty($trace['file']))
219
+            {
205 220
                 $result .= $h->highlightLines(
206 221
                     \file_get_contents($trace['file']),
207 222
                     $trace['line'],
@@ -218,13 +233,19 @@  discard block
 block discarded – undo
218 233
      */
219 234
     private function format(string $format, mixed ...$args): string
220 235
     {
221
-        if (!$this->colorsSupport) {
236
+        if (!$this->colorsSupport)
237
+        {
222 238
             $format = \preg_replace('/<[^>]+>/', '', $format);
223
-        } else {
224
-            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial) {
239
+        }
240
+        else
241
+        {
242
+            $format = \preg_replace_callback('/(<([^>]+)>)/', static function ($partial)
243
+            {
225 244
                 $style = '';
226
-                foreach (\explode(',', \trim($partial[2], '/')) as $color) {
227
-                    if (isset(self::COLORS[$color])) {
245
+                foreach (\explode(',', \trim($partial[2], '/')) as $color)
246
+                {
247
+                    if (isset(self::COLORS[$color]))
248
+                    {
228 249
                         $style .= self::COLORS[$color];
229 250
                     }
230 251
                 }
@@ -243,12 +264,15 @@  discard block
 block discarded – undo
243 264
      */
244 265
     private function isColorsSupported(mixed $stream = STDOUT): bool
245 266
     {
246
-        if ('Hyper' === \getenv('TERM_PROGRAM')) {
267
+        if ('Hyper' === \getenv('TERM_PROGRAM'))
268
+        {
247 269
             return true;
248 270
         }
249 271
 
250
-        try {
251
-            if (\DIRECTORY_SEPARATOR === '\\') {
272
+        try
273
+        {
274
+            if (\DIRECTORY_SEPARATOR === '\\')
275
+            {
252 276
                 return (\function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support($stream))
253 277
                     || \getenv('ANSICON') !== false
254 278
                     || \getenv('ConEmuANSI') === 'ON'
@@ -256,7 +280,9 @@  discard block
 block discarded – undo
256 280
             }
257 281
 
258 282
             return @\stream_isatty($stream);
259
-        } catch (\Throwable) {
283
+        }
284
+        catch (\Throwable)
285
+        {
260 286
             return false;
261 287
         }
262 288
     }
Please login to merge, or discard this patch.
src/Scaffolder/src/helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Scaffolder;
6 6
 
7
-if (!\function_exists('trimPostfix')) {
7
+if (!\function_exists('trimPostfix')){
8 8
     /**
9 9
      * @internal
10 10
      */
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
     }
17 17
 }
18 18
 
19
-if (!\function_exists('defineArrayType')) {
19
+if (!\function_exists('defineArrayType')){
20 20
     /**
21 21
      * @internal
22 22
      */
23 23
     function defineArrayType(array $array, string $failureType = null): ?string
24 24
     {
25
-        $types = \array_map(static fn ($value): string => \gettype($value), $array);
25
+        $types = \array_map(static fn ($value) : string => \gettype($value), $array);
26 26
 
27 27
         $types = \array_unique($types);
28 28
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 namespace Spiral\Scaffolder;
6 6
 
7
-if (!\function_exists('trimPostfix')) {
7
+if (!\function_exists('trimPostfix'))
8
+{
8 9
     /**
9 10
      * @internal
10 11
      */
@@ -16,7 +17,8 @@  discard block
 block discarded – undo
16 17
     }
17 18
 }
18 19
 
19
-if (!\function_exists('defineArrayType')) {
20
+if (!\function_exists('defineArrayType'))
21
+{
20 22
     /**
21 23
      * @internal
22 24
      */
Please login to merge, or discard this patch.
src/Framework/Bootloader/DomainBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
     ): InterceptableCore {
29 29
         $interceptableCore = new InterceptableCore($core, $dispatcher);
30 30
 
31
-        foreach (static::defineInterceptors() as $interceptor) {
32
-            if (!$interceptor instanceof CoreInterceptorInterface) {
31
+        foreach (static::defineInterceptors() as $interceptor){
32
+            if (!$interceptor instanceof CoreInterceptorInterface){
33 33
                 $interceptor = $container->get($interceptor);
34 34
             }
35 35
             $interceptableCore->addInterceptor($interceptor);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,10 @@
 block discarded – undo
28 28
     ): InterceptableCore {
29 29
         $interceptableCore = new InterceptableCore($core, $dispatcher);
30 30
 
31
-        foreach (static::defineInterceptors() as $interceptor) {
32
-            if (!$interceptor instanceof CoreInterceptorInterface) {
31
+        foreach (static::defineInterceptors() as $interceptor)
32
+        {
33
+            if (!$interceptor instanceof CoreInterceptorInterface)
34
+            {
33 35
                 $interceptor = $container->get($interceptor);
34 36
             }
35 37
             $interceptableCore->addInterceptor($interceptor);
Please login to merge, or discard this patch.
src/Cache/src/CacheRepository.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
         protected CacheInterface $storage,
21 21
         protected ?EventDispatcherInterface $dispatcher = null,
22 22
         protected ?string $prefix = null
23
-    ) {
23
+    ){
24 24
     }
25 25
 
26 26
     public function get(string $key, mixed $default = null): mixed
27 27
     {
28 28
         $value = $this->storage->get($this->resolveKey($key));
29 29
 
30
-        if ($value === null) {
30
+        if ($value === null){
31 31
             $this->dispatcher?->dispatch(new CacheMissed($this->resolveKey($key)));
32 32
 
33 33
             return $default;
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
         return $value;
39 39
     }
40 40
 
41
-    public function set(string $key, mixed $value, \DateInterval|int|null $ttl = null): bool
41
+    public function set(string $key, mixed $value, \DateInterval | int | null $ttl = null): bool
42 42
     {
43 43
         $result = $this->storage->set($this->resolveKey($key), $value, $ttl);
44 44
 
45
-        if ($result) {
45
+        if ($result){
46 46
             $this->dispatcher?->dispatch(new KeyWritten($this->resolveKey($key), $value));
47 47
         }
48 48
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $result = $this->storage->delete($this->resolveKey($key));
55 55
 
56
-        if ($result) {
56
+        if ($result){
57 57
             $this->dispatcher?->dispatch(new KeyDeleted($this->resolveKey($key)));
58 58
         }
59 59
 
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $result = [];
71 71
 
72
-        foreach ($keys as $key) {
72
+        foreach ($keys as $key){
73 73
             $result[$key] = $this->get($key, $default);
74 74
         }
75 75
 
76 76
         return $result;
77 77
     }
78 78
 
79
-    public function setMultiple(iterable $values, \DateInterval|int|null $ttl = null): bool
79
+    public function setMultiple(iterable $values, \DateInterval | int | null $ttl = null): bool
80 80
     {
81 81
         $state = null;
82 82
 
83
-        foreach ($values as $key => $value) {
83
+        foreach ($values as $key => $value){
84 84
             $result = $this->set($key, $value, $ttl);
85 85
             $state = \is_null($state) ? $result : $result && $state;
86 86
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function deleteMultiple(iterable $keys): bool
92 92
     {
93 93
         $state = null;
94
-        foreach ($keys as $key) {
94
+        foreach ($keys as $key){
95 95
             $result = $this->delete($key);
96 96
             $state = \is_null($state) ? $result : $result && $state;
97 97
         }
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 
112 112
     private function resolveKey(string $key): string
113 113
     {
114
-        if (!empty($this->prefix)) {
115
-            return $this->prefix . $key;
114
+        if (!empty($this->prefix)){
115
+            return $this->prefix.$key;
116 116
         }
117 117
 
118 118
         return $key;
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $value = $this->storage->get($this->resolveKey($key));
29 29
 
30
-        if ($value === null) {
30
+        if ($value === null)
31
+        {
31 32
             $this->dispatcher?->dispatch(new CacheMissed($this->resolveKey($key)));
32 33
 
33 34
             return $default;
@@ -42,7 +43,8 @@  discard block
 block discarded – undo
42 43
     {
43 44
         $result = $this->storage->set($this->resolveKey($key), $value, $ttl);
44 45
 
45
-        if ($result) {
46
+        if ($result)
47
+        {
46 48
             $this->dispatcher?->dispatch(new KeyWritten($this->resolveKey($key), $value));
47 49
         }
48 50
 
@@ -53,7 +55,8 @@  discard block
 block discarded – undo
53 55
     {
54 56
         $result = $this->storage->delete($this->resolveKey($key));
55 57
 
56
-        if ($result) {
58
+        if ($result)
59
+        {
57 60
             $this->dispatcher?->dispatch(new KeyDeleted($this->resolveKey($key)));
58 61
         }
59 62
 
@@ -69,7 +72,8 @@  discard block
 block discarded – undo
69 72
     {
70 73
         $result = [];
71 74
 
72
-        foreach ($keys as $key) {
75
+        foreach ($keys as $key)
76
+        {
73 77
             $result[$key] = $this->get($key, $default);
74 78
         }
75 79
 
@@ -80,7 +84,8 @@  discard block
 block discarded – undo
80 84
     {
81 85
         $state = null;
82 86
 
83
-        foreach ($values as $key => $value) {
87
+        foreach ($values as $key => $value)
88
+        {
84 89
             $result = $this->set($key, $value, $ttl);
85 90
             $state = \is_null($state) ? $result : $result && $state;
86 91
         }
@@ -91,7 +96,8 @@  discard block
 block discarded – undo
91 96
     public function deleteMultiple(iterable $keys): bool
92 97
     {
93 98
         $state = null;
94
-        foreach ($keys as $key) {
99
+        foreach ($keys as $key)
100
+        {
95 101
             $result = $this->delete($key);
96 102
             $state = \is_null($state) ? $result : $result && $state;
97 103
         }
@@ -111,7 +117,8 @@  discard block
 block discarded – undo
111 117
 
112 118
     private function resolveKey(string $key): string
113 119
     {
114
-        if (!empty($this->prefix)) {
120
+        if (!empty($this->prefix))
121
+        {
115 122
             return $this->prefix . $key;
116 123
         }
117 124
 
Please login to merge, or discard this patch.
src/Cache/src/CacheManager.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         private readonly CacheConfig $config,
20 20
         private readonly FactoryInterface $factory,
21 21
         private readonly ?EventDispatcherInterface $dispatcher = null,
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     public function storage(?string $name = null): CacheInterface
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
         $storage = $this->config->getAliases()[$name] ?? $name;
31 31
 
32 32
         $prefix = null;
33
-        if (\is_array($storage)) {
33
+        if (\is_array($storage)){
34 34
             $prefix = !empty($storage['prefix']) ? $storage['prefix'] : null;
35 35
             $storage = $storage['storage'];
36 36
         }
37 37
 
38
-        if (!isset($this->storages[$storage])) {
38
+        if (!isset($this->storages[$storage])){
39 39
             $this->storages[$storage] = $this->resolve($storage);
40 40
         }
41 41
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,12 +30,14 @@
 block discarded – undo
30 30
         $storage = $this->config->getAliases()[$name] ?? $name;
31 31
 
32 32
         $prefix = null;
33
-        if (\is_array($storage)) {
33
+        if (\is_array($storage))
34
+        {
34 35
             $prefix = !empty($storage['prefix']) ? $storage['prefix'] : null;
35 36
             $storage = $storage['storage'];
36 37
         }
37 38
 
38
-        if (!isset($this->storages[$storage])) {
39
+        if (!isset($this->storages[$storage]))
40
+        {
39 41
             $this->storages[$storage] = $this->resolve($storage);
40 42
         }
41 43
 
Please login to merge, or discard this patch.
src/Cookies/tests/CookiesTest.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function testScope(): void
54 54
     {
55 55
         $core = $this->httpCore([CookiesMiddleware::class]);
56
-        $core->setHandler(function ($r) {
56
+        $core->setHandler(function ($r){
57 57
             $this->assertInstanceOf(
58 58
                 CookieQueue::class,
59 59
                 ContainerScope::getContainer()->get(ServerRequestInterface::class)
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function testSetEncryptedCookie(): void
78 78
     {
79 79
         $core = $this->httpCore([CookiesMiddleware::class]);
80
-        $core->setHandler(function ($r) {
80
+        $core->setHandler(function ($r){
81 81
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
82 82
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
83 83
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function testSetNotProtectedCookie(): void
100 100
     {
101 101
         $core = $this->httpCore([CookiesMiddleware::class]);
102
-        $core->setHandler(function ($r) {
102
+        $core->setHandler(function ($r){
103 103
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
104 104
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value');
105 105
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function testDecrypt(): void
119 119
     {
120 120
         $core = $this->httpCore([CookiesMiddleware::class]);
121
-        $core->setHandler(function ($r) {
121
+        $core->setHandler(function ($r){
122 122
 
123 123
             /**
124 124
              * @var ServerRequest $r
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     public function testDecryptArray(): void
137 137
     {
138 138
         $core = $this->httpCore([CookiesMiddleware::class]);
139
-        $core->setHandler(function ($r) {
139
+        $core->setHandler(function ($r){
140 140
 
141 141
             /**
142 142
              * @var ServerRequest $r
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function testDecryptBroken(): void
155 155
     {
156 156
         $core = $this->httpCore([CookiesMiddleware::class]);
157
-        $core->setHandler(function ($r) {
157
+        $core->setHandler(function ($r){
158 158
 
159 159
             /**
160 160
              * @var ServerRequest $r
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             return $r->getCookieParams()['name'];
163 163
         });
164 164
 
165
-        $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN';
165
+        $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN';
166 166
 
167 167
         $response = $this->get($core, '/', [], [], ['name' => $value]);
168 168
         $this->assertSame(200, $response->getStatusCode());
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     public function testDelete(): void
173 173
     {
174 174
         $core = $this->httpCore([CookiesMiddleware::class]);
175
-        $core->setHandler(function ($r) {
175
+        $core->setHandler(function ($r){
176 176
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
177 177
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
178 178
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         ]));
201 201
 
202 202
         $core = $this->httpCore([CookiesMiddleware::class]);
203
-        $core->setHandler(function ($r) {
203
+        $core->setHandler(function ($r){
204 204
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
205 205
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
206 206
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         ]));
226 226
 
227 227
         $core = $this->httpCore([CookiesMiddleware::class]);
228
-        $core->setHandler(function ($r) {
228
+        $core->setHandler(function ($r){
229 229
 
230 230
             /**
231 231
              * @var ServerRequest $r
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         ]));
250 250
 
251 251
         $core = $this->httpCore([CookiesMiddleware::class]);
252
-        $core->setHandler(function ($r) {
252
+        $core->setHandler(function ($r){
253 253
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
254 254
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
255 255
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         $cookies = $this->fetchCookies($response);
264 264
         $this->assertArrayHasKey('name', $cookies);
265 265
 
266
-        $core->setHandler(function ($r) {
266
+        $core->setHandler(function ($r){
267 267
             return $r->getCookieParams()['name'];
268 268
         });
269 269
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         $result = [];
320 320
 
321
-        foreach ($response->getHeaders() as $line) {
321
+        foreach ($response->getHeaders() as $line){
322 322
             $cookie = explode('=', implode('', $line));
323 323
             $result[$cookie[0]] = rawurldecode(substr(
324 324
                 (string)$cookie[1],
Please login to merge, or discard this patch.
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@  discard block
 block discarded – undo
53 53
     public function testScope(): void
54 54
     {
55 55
         $core = $this->httpCore([CookiesMiddleware::class]);
56
-        $core->setHandler(function ($r) {
56
+        $core->setHandler(function ($r)
57
+        {
57 58
             $this->assertInstanceOf(
58 59
                 CookieQueue::class,
59 60
                 ContainerScope::getContainer()->get(ServerRequestInterface::class)
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
     public function testSetEncryptedCookie(): void
78 79
     {
79 80
         $core = $this->httpCore([CookiesMiddleware::class]);
80
-        $core->setHandler(function ($r) {
81
+        $core->setHandler(function ($r)
82
+        {
81 83
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
82 84
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
83 85
 
@@ -99,7 +101,8 @@  discard block
 block discarded – undo
99 101
     public function testSetNotProtectedCookie(): void
100 102
     {
101 103
         $core = $this->httpCore([CookiesMiddleware::class]);
102
-        $core->setHandler(function ($r) {
104
+        $core->setHandler(function ($r)
105
+        {
103 106
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
104 107
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value');
105 108
 
@@ -118,7 +121,8 @@  discard block
 block discarded – undo
118 121
     public function testDecrypt(): void
119 122
     {
120 123
         $core = $this->httpCore([CookiesMiddleware::class]);
121
-        $core->setHandler(function ($r) {
124
+        $core->setHandler(function ($r)
125
+        {
122 126
 
123 127
             /**
124 128
              * @var ServerRequest $r
@@ -136,7 +140,8 @@  discard block
 block discarded – undo
136 140
     public function testDecryptArray(): void
137 141
     {
138 142
         $core = $this->httpCore([CookiesMiddleware::class]);
139
-        $core->setHandler(function ($r) {
143
+        $core->setHandler(function ($r)
144
+        {
140 145
 
141 146
             /**
142 147
              * @var ServerRequest $r
@@ -154,7 +159,8 @@  discard block
 block discarded – undo
154 159
     public function testDecryptBroken(): void
155 160
     {
156 161
         $core = $this->httpCore([CookiesMiddleware::class]);
157
-        $core->setHandler(function ($r) {
162
+        $core->setHandler(function ($r)
163
+        {
158 164
 
159 165
             /**
160 166
              * @var ServerRequest $r
@@ -172,7 +178,8 @@  discard block
 block discarded – undo
172 178
     public function testDelete(): void
173 179
     {
174 180
         $core = $this->httpCore([CookiesMiddleware::class]);
175
-        $core->setHandler(function ($r) {
181
+        $core->setHandler(function ($r)
182
+        {
176 183
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
177 184
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
178 185
 
@@ -200,7 +207,8 @@  discard block
 block discarded – undo
200 207
         ]));
201 208
 
202 209
         $core = $this->httpCore([CookiesMiddleware::class]);
203
-        $core->setHandler(function ($r) {
210
+        $core->setHandler(function ($r)
211
+        {
204 212
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
205 213
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
206 214
 
@@ -225,7 +233,8 @@  discard block
 block discarded – undo
225 233
         ]));
226 234
 
227 235
         $core = $this->httpCore([CookiesMiddleware::class]);
228
-        $core->setHandler(function ($r) {
236
+        $core->setHandler(function ($r)
237
+        {
229 238
 
230 239
             /**
231 240
              * @var ServerRequest $r
@@ -249,7 +258,8 @@  discard block
 block discarded – undo
249 258
         ]));
250 259
 
251 260
         $core = $this->httpCore([CookiesMiddleware::class]);
252
-        $core->setHandler(function ($r) {
261
+        $core->setHandler(function ($r)
262
+        {
253 263
             ContainerScope::getContainer()->get(ServerRequestInterface::class)
254 264
                 ->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value');
255 265
 
@@ -263,7 +273,8 @@  discard block
 block discarded – undo
263 273
         $cookies = $this->fetchCookies($response);
264 274
         $this->assertArrayHasKey('name', $cookies);
265 275
 
266
-        $core->setHandler(function ($r) {
276
+        $core->setHandler(function ($r)
277
+        {
267 278
             return $r->getCookieParams()['name'];
268 279
         });
269 280
 
@@ -318,7 +329,8 @@  discard block
 block discarded – undo
318 329
     {
319 330
         $result = [];
320 331
 
321
-        foreach ($response->getHeaders() as $line) {
332
+        foreach ($response->getHeaders() as $line)
333
+        {
322 334
             $cookie = explode('=', implode('', $line));
323 335
             $result[$cookie[0]] = rawurldecode(substr(
324 336
                 (string)$cookie[1],
Please login to merge, or discard this patch.