Completed
Push — 6.0 ( 6d3b4b...d9c211 )
by liu
06:00
created
src/think/exception/FuncNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(string $message, string $func = '', Throwable $previous = null)
14 14
     {
15 15
         $this->message = $message;
16
-        $this->func   = $func;
16
+        $this->func = $func;
17 17
 
18 18
         parent::__construct($message, 0, $previous);
19 19
     }
Please login to merge, or discard this patch.
tests/ContainerTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         Container::setInstance($container);
65 65
 
66
-        $container->bind('name', function () {
66
+        $container->bind('name', function() {
67 67
             return 'Taylor';
68 68
         });
69 69
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $this->expectExceptionMessage('class not exists: name');
81 81
         $container->get('name');
82 82
 
83
-        $container->bind('name', function () {
83
+        $container->bind('name', function() {
84 84
             return 'Taylor';
85 85
         });
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $container = new Container;
93 93
 
94
-        $container->bind('name', function () {
94
+        $container->bind('name', function() {
95 95
             return 'Taylor';
96 96
         });
97 97
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $container = new Container;
108 108
 
109
-        $container->bind('name', function () {
109
+        $container->bind('name', function() {
110 110
             return 'Taylor';
111 111
         });
112 112
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
         $this->assertSame($object, Container::getInstance());
200 200
 
201
-        Container::setInstance(function () {
201
+        Container::setInstance(function() {
202 202
             return $this;
203 203
         });
204 204
 
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
         $container = new Container();
211 211
         $container->bind(Container::class, $container);
212 212
 
213
-        $container->resolving(function (SomeClass $taylor, Container $container) {
213
+        $container->resolving(function(SomeClass $taylor, Container $container) {
214 214
             $taylor->count++;
215 215
         });
216
-        $container->resolving(SomeClass::class, function (SomeClass $taylor, Container $container) {
216
+        $container->resolving(SomeClass::class, function(SomeClass $taylor, Container $container) {
217 217
             $taylor->count++;
218 218
         });
219 219
 
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
 
253 253
         $this->assertEquals('48', $container->invoke('ord', ['0']));
254 254
 
255
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test', []));
255
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test', []));
256 256
 
257
-        $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test'));
257
+        $this->assertSame($container, $container->invokeMethod(Taylor::class.'::test'));
258 258
 
259 259
         $reflect = new ReflectionMethod($container, 'exists');
260 260
 
261 261
         $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class]));
262 262
 
263
-        $this->assertSame($container, $container->invoke(function (Container $container) {
263
+        $this->assertSame($container, $container->invoke(function(Container $container) {
264 264
             return $container;
265 265
         }));
266 266
 
267
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test'));
267
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test'));
268 268
 
269 269
         $object = $container->invokeClass(SomeClass::class);
270 270
         $this->assertInstanceOf(SomeClass::class, $object);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $stdClass = new stdClass();
274 274
 
275
-        $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
275
+        $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
276 276
             $this->assertEquals('value1', $key1);
277 277
             $this->assertEquals('default', $key2);
278 278
             $this->assertEquals('value2', $lowKey);
Please login to merge, or discard this patch.
src/think/middleware/CheckRequestCache.php 1 patch
Spacing   +7 added lines, -7 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\middleware;
14 14
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
         if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) {
90 90
             $header                  = $response->getHeader();
91
-            $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate';
92
-            $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
93
-            $header['Expires']       = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT';
91
+            $header['Cache-Control'] = 'max-age='.$expire.',must-revalidate';
92
+            $header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT';
93
+            $header['Expires']       = gmdate('D, d M Y H:i:s', time() + $expire).' GMT';
94 94
 
95 95
             $this->cache->tag($tag)->set($key, [$response->getContent(), $header, time()], $expire);
96 96
         }
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         if (false !== strpos($key, ':')) {
142 142
             $param = $request->param();
143 143
             foreach ($param as $item => $val) {
144
-                if (is_string($val) && false !== strpos($key, ':' . $item)) {
145
-                    $key = str_replace(':' . $item, $val, $key);
144
+                if (is_string($val) && false !== strpos($key, ':'.$item)) {
145
+                    $key = str_replace(':'.$item, $val, $key);
146 146
                 }
147 147
             }
148 148
         } elseif (strpos($key, ']')) {
149
-            if ('[' . $request->ext() . ']' == $key) {
149
+            if ('['.$request->ext().']' == $key) {
150 150
                 // 缓存某个后缀的请求
151 151
                 $key = md5($request->url());
152 152
             } else {
Please login to merge, or discard this patch.
src/think/route/Url.php 1 patch
Spacing   +20 added lines, -20 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
     /**
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             // 解析到控制器
243 243
             $url = substr($url, 1);
244 244
         } elseif ('' === $url) {
245
-            $url = $request->controller() . '/' . $request->action();
245
+            $url = $request->controller().'/'.$request->action();
246 246
         } else {
247 247
             $controller = $request->controller();
248 248
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             $action     = array_pop($path);
251 251
             $controller = empty($path) ? $controller : array_pop($path);
252 252
 
253
-            $url = $controller . '/' . $action;
253
+            $url = $controller.'/'.$action;
254 254
         }
255 255
 
256 256
         return $url;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     {
298 298
         $request = $this->app->request;
299 299
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
300
-            $allowDomain .= '.' . $request->rootDomain();
300
+            $allowDomain .= '.'.$request->rootDomain();
301 301
         }
302 302
         $port = $request->port();
303 303
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
 
318 318
             if ($port && !in_array($port, [80, 443])) {
319
-                $domain .= ':' . $port;
319
+                $domain .= ':'.$port;
320 320
             }
321 321
 
322 322
             if (empty($pattern)) {
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 
328 328
             foreach ($pattern as $key => $val) {
329 329
                 if (isset($vars[$key])) {
330
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
330
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
331 331
                     unset($vars[$key]);
332 332
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
333 333
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
334 334
                 } elseif (2 == $val) {
335
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
335
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
336 336
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
337 337
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
338 338
                 } else {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
361 361
             // [name] 表示使用路由命名标识生成URL
362 362
             $name = substr($url, 1, $pos - 1);
363
-            $url  = 'name' . substr($url, $pos + 1);
363
+            $url  = 'name'.substr($url, $pos + 1);
364 364
         }
365 365
 
366 366
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
         }
388 388
 
389 389
         if ($url) {
390
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
390
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
391 391
             $checkDomain = $domain && is_string($domain) ? $domain : null;
392 392
 
393 393
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                 $suffix = $match[2];
414 414
             }
415 415
         } elseif (!empty($rule) && isset($name)) {
416
-            throw new \InvalidArgumentException('route name not exists:' . $name);
416
+            throw new \InvalidArgumentException('route name not exists:'.$name);
417 417
         } else {
418 418
             // 检测URL绑定
419 419
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             $file = str_replace('\\', '/', dirname($file));
452 452
         }
453 453
 
454
-        $url = rtrim($file, '/') . '/' . $url;
454
+        $url = rtrim($file, '/').'/'.$url;
455 455
 
456 456
         // URL后缀
457 457
         if ('/' == substr($url, -1) || '' == $url) {
@@ -461,33 +461,33 @@  discard block
 block discarded – undo
461 461
         }
462 462
 
463 463
         // 锚点
464
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
464
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
465 465
 
466 466
         // 参数组装
467 467
         if (!empty($vars)) {
468 468
             // 添加参数
469 469
             if ($this->route->config('url_common_param')) {
470 470
                 $vars = http_build_query($vars);
471
-                $url .= $suffix . '?' . $vars . $anchor;
471
+                $url .= $suffix.'?'.$vars.$anchor;
472 472
             } else {
473 473
                 foreach ($vars as $var => $val) {
474 474
                     $val = (string) $val;
475 475
                     if ('' !== $val) {
476
-                        $url .= $depr . $var . $depr . urlencode($val);
476
+                        $url .= $depr.$var.$depr.urlencode($val);
477 477
                     }
478 478
                 }
479 479
 
480
-                $url .= $suffix . $anchor;
480
+                $url .= $suffix.$anchor;
481 481
             }
482 482
         } else {
483
-            $url .= $suffix . $anchor;
483
+            $url .= $suffix.$anchor;
484 484
         }
485 485
 
486 486
         // 检测域名
487 487
         $domain = $this->parseDomain($url, $domain);
488 488
 
489 489
         // URL组装
490
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
490
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
491 491
     }
492 492
 
493 493
     public function __toString()
Please login to merge, or discard this patch.
src/think/response/Html.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/session/Store.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
      */
119 119
     public function setId($id = null): void
120 120
     {
121
-        $this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true) . session_create_id());
121
+        $this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true).session_create_id());
122 122
     }
123 123
 
124 124
     /**
Please login to merge, or discard this patch.
src/think/log/driver/Socket.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: luofei614 <weibo.com/luofei614>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\log\driver;
14 14
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             if ($this->app->exists('request')) {
90 90
                 $current_uri = $this->app->request->url(true);
91 91
             } else {
92
-                $current_uri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []);
92
+                $current_uri = 'cmd:'.implode(' ', $_SERVER['argv'] ?? []);
93 93
             }
94 94
 
95 95
             // 基本信息
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         foreach ($log as $type => $val) {
106 106
             $trace[] = [
107 107
                 'type' => ($expand_level[$type] ?? false) ? 'group' : 'groupCollapsed',
108
-                'msg'  => '[ ' . $type . ' ]',
108
+                'msg'  => '[ '.$type.' ]',
109 109
                 'css'  => $this->css[$type] ?? '',
110 110
             ];
111 111
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         ];
192 192
 
193 193
         $msg     = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR);
194
-        $address = '/' . $client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁
194
+        $address = '/'.$client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁
195 195
 
196 196
         $this->send($this->config['host'], $msg, $address);
197 197
     }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     protected function send($host, $message = '', $address = '/')
264 264
     {
265
-        $url = 'http://' . $host . ':' . $this->port . $address;
265
+        $url = 'http://'.$host.':'.$this->port.$address;
266 266
         $ch  = curl_init();
267 267
 
268 268
         curl_setopt($ch, CURLOPT_URL, $url);
Please login to merge, or discard this patch.
src/think/Response.php 1 patch
Spacing   +4 added lines, -4 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;
14 14
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public static function create($data = '', string $type = 'html', int $code = 200): Response
104 104
     {
105
-        $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type));
105
+        $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\'.ucfirst(strtolower($type));
106 106
 
107 107
         return Container::getInstance()->invokeClass($class, [$data, $code]);
108 108
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             http_response_code($this->code);
136 136
             // 发送头部信息
137 137
             foreach ($this->header as $name => $val) {
138
-                header($name . (!is_null($val) ? ':' . $val : ''));
138
+                header($name.(!is_null($val) ? ':'.$val : ''));
139 139
             }
140 140
         }
141 141
         if ($this->cookie) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
      */
345 345
     public function contentType(string $contentType, string $charset = 'utf-8')
346 346
     {
347
-        $this->header['Content-Type'] = $contentType . '; charset=' . $charset;
347
+        $this->header['Content-Type'] = $contentType.'; charset='.$charset;
348 348
 
349 349
         return $this;
350 350
     }
Please login to merge, or discard this patch.
src/think/route/dispatch/Url.php 1 patch
Spacing   +6 added lines, -6 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\dispatch;
14 14
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         if ($bind && preg_match('/^[a-z]/is', $bind)) {
48 48
             $bind = str_replace('/', $depr, $bind);
49 49
             // 如果有域名绑定
50
-            $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr);
50
+            $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr);
51 51
         }
52 52
 
53 53
         $path = $this->rule->parseUrlPath($url);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $controller = !empty($path) ? array_shift($path) : null;
60 60
 
61 61
         if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) {
62
-            throw new HttpException(404, 'controller not exists:' . $controller);
62
+            throw new HttpException(404, 'controller not exists:'.$controller);
63 63
         }
64 64
 
65 65
         // 解析操作
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
         // 解析额外参数
70 70
         if ($path) {
71
-            preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) {
71
+            preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) {
72 72
                 $var[$match[1]] = strip_tags($match[2]);
73 73
             }, implode('|', $path));
74 74
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $route = [$controller, $action];
87 87
 
88 88
         if ($this->hasDefinedRoute($route)) {
89
-            throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url));
89
+            throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url));
90 90
         }
91 91
 
92 92
         return $route;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         list($controller, $action) = $route;
104 104
 
105 105
         // 检查地址是否被定义过路由
106
-        $name = strtolower(Str::studly($controller) . '/' . $action);
106
+        $name = strtolower(Str::studly($controller).'/'.$action);
107 107
 
108 108
         $host   = $this->request->host(true);
109 109
         $method = $this->request->method();
Please login to merge, or discard this patch.