Completed
Push — 6.0 ( 0ccc8d...e71200 )
by yun
05:51
created
src/think/exception/ValidateException.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
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\exception;
14 14
 
Please login to merge, or discard this patch.
src/think/exception/HttpResponseException.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
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\exception;
14 14
 
Please login to merge, or discard this patch.
src/think/exception/HttpException.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
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\exception;
14 14
 
Please login to merge, or discard this patch.
src/think/response/View.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
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\response;
14 14
 
Please login to merge, or discard this patch.
src/think/response/Json.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
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\response;
14 14
 
Please login to merge, or discard this patch.
src/think/route/Url.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\route;
14 14
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 }
191 191
             }
192 192
         } elseif (false === strpos($domain, '.') && 0 !== strpos($domain, $rootDomain)) {
193
-            $domain .= '.' . $rootDomain;
193
+            $domain .= '.'.$rootDomain;
194 194
         }
195 195
 
196 196
         if (false !== strpos($domain, '://')) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $scheme = $this->https || $request->isSsl() ? 'https://' : 'http://';
200 200
         }
201 201
 
202
-        return $scheme . $domain;
202
+        return $scheme.$domain;
203 203
     }
204 204
 
205 205
     /**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             }
219 219
         }
220 220
 
221
-        return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.' . $suffix;
221
+        return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.'.$suffix;
222 222
     }
223 223
 
224 224
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                 $app        = empty($path) ? $app : array_pop($path);
256 256
             }
257 257
 
258
-            $url = $controller . '/' . $action;
258
+            $url = $controller.'/'.$action;
259 259
 
260 260
             if ($app && $this->app->config->get('app.auto_multi_app')) {
261 261
                 $bind = $this->app->config->get('app.domain_bind', []);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
                     $map = $this->app->config->get('app.app_map', []);
266 266
 
267 267
                     if ($key = array_search($app, $map)) {
268
-                        $url = $key . '/' . $url;
268
+                        $url = $key.'/'.$url;
269 269
                     } else {
270
-                        $url = $app . '/' . $url;
270
+                        $url = $app.'/'.$url;
271 271
                     }
272 272
                 }
273 273
             }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             }
333 333
 
334 334
             if (!in_array($request->port(), [80, 443])) {
335
-                $domain .= ':' . $request->port();
335
+                $domain .= ':'.$request->port();
336 336
             }
337 337
 
338 338
             if (empty($pattern)) {
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 
344 344
             foreach ($pattern as $key => $val) {
345 345
                 if (isset($vars[$key])) {
346
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
346
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
347 347
                     unset($vars[$key]);
348 348
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
349 349
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
350 350
                 } elseif (2 == $val) {
351
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
351
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
352 352
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
353 353
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
354 354
                 } else {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
377 377
             // [name] 表示使用路由命名标识生成URL
378 378
             $name = substr($url, 1, $pos - 1);
379
-            $url  = 'name' . substr($url, $pos + 1);
379
+            $url  = 'name'.substr($url, $pos + 1);
380 380
         }
381 381
 
382 382
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         }
404 404
 
405 405
         if ($url) {
406
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
406
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
407 407
             $checkDomain = $domain && is_string($domain) ? $domain : null;
408 408
 
409 409
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
             }
431 431
 
432 432
             if ($request->app() && $this->app->config->get('app.auto_multi_app') && !$this->app->http->isBindDomain()) {
433
-                $url = $request->app() . '/' . $url;
433
+                $url = $request->app().'/'.$url;
434 434
             }
435 435
         } elseif (!empty($rule) && isset($name)) {
436
-            throw new \InvalidArgumentException('route name not exists:' . $name);
436
+            throw new \InvalidArgumentException('route name not exists:'.$name);
437 437
         } else {
438 438
             // 检测URL绑定
439 439
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             $file = str_replace('\\', '/', dirname($file));
472 472
         }
473 473
 
474
-        $url = rtrim($file, '/') . '/' . $url;
474
+        $url = rtrim($file, '/').'/'.$url;
475 475
 
476 476
         // URL后缀
477 477
         if ('/' == substr($url, -1) || '' == $url) {
@@ -481,32 +481,32 @@  discard block
 block discarded – undo
481 481
         }
482 482
 
483 483
         // 锚点
484
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
484
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
485 485
 
486 486
         // 参数组装
487 487
         if (!empty($vars)) {
488 488
             // 添加参数
489 489
             if ($this->route->config('url_common_param')) {
490 490
                 $vars = http_build_query($vars);
491
-                $url .= $suffix . '?' . $vars . $anchor;
491
+                $url .= $suffix.'?'.$vars.$anchor;
492 492
             } else {
493 493
                 foreach ($vars as $var => $val) {
494 494
                     if ('' !== $val) {
495
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
495
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
496 496
                     }
497 497
                 }
498 498
 
499
-                $url .= $suffix . $anchor;
499
+                $url .= $suffix.$anchor;
500 500
             }
501 501
         } else {
502
-            $url .= $suffix . $anchor;
502
+            $url .= $suffix.$anchor;
503 503
         }
504 504
 
505 505
         // 检测域名
506 506
         $domain = $this->parseDomain($url, $domain);
507 507
 
508 508
         // URL组装
509
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
509
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
510 510
     }
511 511
 
512 512
     public function __toString()
Please login to merge, or discard this patch.
src/think/cache/Driver.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\cache;
14 14
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function getCacheKey(string $name): string
86 86
     {
87
-        return $this->options['prefix'] . $name;
87
+        return $this->options['prefix'].$name;
88 88
     }
89 89
 
90 90
     /**
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 
146 146
         $time = time();
147 147
 
148
-        while ($time + 5 > time() && $this->has($name . '_lock')) {
148
+        while ($time + 5 > time() && $this->has($name.'_lock')) {
149 149
             // 存在锁定则等待
150 150
             usleep(200000);
151 151
         }
152 152
 
153 153
         try {
154 154
             // 锁定
155
-            $this->set($name . '_lock', true);
155
+            $this->set($name.'_lock', true);
156 156
 
157 157
             if ($value instanceof Closure) {
158 158
                 // 获取缓存数据
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
             $this->set($name, $value, $expire);
164 164
 
165 165
             // 解锁
166
-            $this->delete($name . '_lock');
166
+            $this->delete($name.'_lock');
167 167
         } catch (Exception | throwable $e) {
168
-            $this->delete($name . '_lock');
168
+            $this->delete($name.'_lock');
169 169
             throw $e;
170 170
         }
171 171
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $key  = implode('-', $name);
185 185
 
186 186
         if (!isset($this->tag[$key])) {
187
-            $name = array_map(function ($val) {
187
+            $name = array_map(function($val) {
188 188
                 return $this->getTagKey($val);
189 189
             }, $name);
190 190
             $this->tag[$key] = new TagSet($name, $this);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function getTagKey(string $tag): string
214 214
     {
215
-        return $this->options['tag_prefix'] . md5($tag);
215
+        return $this->options['tag_prefix'].md5($tag);
216 216
     }
217 217
 
218 218
     /**
Please login to merge, or discard this patch.
src/think/Console.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 // +----------------------------------------------------------------------
7 7
 // | Author: zhangyajun <[email protected]>
8 8
 // +----------------------------------------------------------------------
9
-declare (strict_types = 1);
9
+declare(strict_types=1);
10 10
 
11 11
 namespace think;
12 12
 
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
     public function findNamespace(string $namespace): string
462 462
     {
463 463
         $allNamespaces = $this->getNamespaces();
464
-        $expr          = preg_replace_callback('{([^:]+|)}', function ($matches) {
465
-            return preg_quote($matches[1]) . '[^:]*';
464
+        $expr          = preg_replace_callback('{([^:]+|)}', function($matches) {
465
+            return preg_quote($matches[1]).'[^:]*';
466 466
         }, $namespace);
467
-        $namespaces    = preg_grep('{^' . $expr . '}', $allNamespaces);
467
+        $namespaces    = preg_grep('{^'.$expr.'}', $allNamespaces);
468 468
 
469 469
         if (empty($namespaces)) {
470 470
             $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -501,13 +501,13 @@  discard block
 block discarded – undo
501 501
     {
502 502
         $allCommands = array_keys($this->commands);
503 503
 
504
-        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
505
-            return preg_quote($matches[1]) . '[^:]*';
504
+        $expr = preg_replace_callback('{([^:]+|)}', function($matches) {
505
+            return preg_quote($matches[1]).'[^:]*';
506 506
         }, $name);
507 507
 
508
-        $commands = preg_grep('{^' . $expr . '}', $allCommands);
508
+        $commands = preg_grep('{^'.$expr.'}', $allCommands);
509 509
 
510
-        if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
510
+        if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
511 511
             if (false !== $pos = strrpos($name, ':')) {
512 512
                 $this->findNamespace(substr($name, 0, $pos));
513 513
             }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
             }
702 702
         }
703 703
 
704
-        $alternatives = array_filter($alternatives, function ($lev) use ($threshold) {
704
+        $alternatives = array_filter($alternatives, function($lev) use ($threshold) {
705 705
             return $lev < 2 * $threshold;
706 706
         });
707 707
         asort($alternatives);
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 
723 723
         foreach ($parts as $part) {
724 724
             if (count($namespaces)) {
725
-                $namespaces[] = end($namespaces) . ':' . $part;
725
+                $namespaces[] = end($namespaces).':'.$part;
726 726
             } else {
727 727
                 $namespaces[] = $part;
728 728
             }
Please login to merge, or discard this patch.
tests/ContainerTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         Container::setInstance($container);
59 59
 
60
-        $container->bind('name', function () {
60
+        $container->bind('name', function() {
61 61
             return 'Taylor';
62 62
         });
63 63
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->expectExceptionMessage('class not exists: name');
75 75
         $container->get('name');
76 76
 
77
-        $container->bind('name', function () {
77
+        $container->bind('name', function() {
78 78
             return 'Taylor';
79 79
         });
80 80
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $container = new Container;
87 87
 
88
-        $container->bind('name', function () {
88
+        $container->bind('name', function() {
89 89
             return 'Taylor';
90 90
         });
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $container = new Container;
102 102
 
103
-        $container->bind('name', function () {
103
+        $container->bind('name', function() {
104 104
             return 'Taylor';
105 105
         });
106 106
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         $this->assertSame($object, Container::getInstance());
194 194
 
195
-        Container::setInstance(function () {
195
+        Container::setInstance(function() {
196 196
             return $this;
197 197
         });
198 198
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $this->expectException(Exception::class);
213 213
         $this->expectExceptionMessageRegExp('/function not exists: {Closure}@.+#L\d+-\d+/');
214 214
         $container = new Container;
215
-        $container->invokeFunction(function () {
215
+        $container->invokeFunction(function() {
216 216
             throw new \ReflectionException('test exception');
217 217
         });
218 218
     }
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 
232 232
         $container->invokeMethod([$stub, 'some']);
233 233
 
234
-        $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test'));
234
+        $this->assertSame($container, $container->invokeMethod(Taylor::class.'::test'));
235 235
 
236 236
         $reflect = new ReflectionMethod($container, 'exists');
237 237
 
238 238
         $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class]));
239 239
 
240
-        $this->assertSame($container, $container->invoke(function (Container $container) {
240
+        $this->assertSame($container, $container->invoke(function(Container $container) {
241 241
             return $container;
242 242
         }));
243 243
 
244
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test'));
244
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test'));
245 245
 
246 246
         $object = $container->invokeClass(SomeClass::class);
247 247
         $this->assertInstanceOf(SomeClass::class, $object);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         $stdClass = new stdClass();
251 251
 
252
-        $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
252
+        $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
253 253
             $this->assertEquals('value1', $key1);
254 254
             $this->assertEquals('default', $key2);
255 255
             $this->assertEquals('value2', $lowKey);
Please login to merge, or discard this patch.