Completed
Pull Request — 6.0 (#2034)
by nhzex
05:30
created
src/think/session/driver/File.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\session\driver;
14 14
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $this->config = array_merge($this->config, $config);
40 40
 
41 41
         if (empty($this->config['path'])) {
42
-            $this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR;
42
+            $this->config['path'] = $app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'session'.DIRECTORY_SEPARATOR;
43 43
         } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) {
44 44
             $this->config['path'] .= DIRECTORY_SEPARATOR;
45 45
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $lifetime = $this->config['expire'];
77 77
         $now      = time();
78 78
 
79
-        $files = $this->findFiles($this->config['path'], function (SplFileInfo $item) use ($lifetime, $now) {
79
+        $files = $this->findFiles($this->config['path'], function(SplFileInfo $item) use ($lifetime, $now) {
80 80
             return $now > $item->getMTime() + $lifetime;
81 81
         });
82 82
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     {
119 119
         if ($this->config['prefix']) {
120 120
             // 使用子目录
121
-            $name = $this->config['prefix'] . DIRECTORY_SEPARATOR . 'sess_' . $name;
121
+            $name = $this->config['prefix'].DIRECTORY_SEPARATOR.'sess_'.$name;
122 122
         } else {
123
-            $name = 'sess_' . $name;
123
+            $name = 'sess_'.$name;
124 124
         }
125 125
 
126
-        $filename = $this->config['path'] . $name;
126
+        $filename = $this->config['path'].$name;
127 127
         $dir      = dirname($filename);
128 128
 
129 129
         if ($auto && !is_dir($dir)) {
Please login to merge, or discard this patch.
src/think/session/driver/Cache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 
36 36
     public function read(string $sessionId): string
37 37
     {
38
-        return (string) $this->handler->get($this->prefix . $sessionId);
38
+        return (string) $this->handler->get($this->prefix.$sessionId);
39 39
     }
40 40
 
41 41
     public function delete(string $sessionId): bool
42 42
     {
43
-        return $this->handler->delete($this->prefix . $sessionId);
43
+        return $this->handler->delete($this->prefix.$sessionId);
44 44
     }
45 45
 
46 46
     public function write(string $sessionId, string $data): bool
47 47
     {
48
-        return $this->handler->set($this->prefix . $sessionId, $data, $this->expire);
48
+        return $this->handler->set($this->prefix.$sessionId, $data, $this->expire);
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/think/Session.php 1 patch
Spacing   +2 added lines, -2 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
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function getConfig(string $name = null, $default = null)
42 42
     {
43 43
         if (!is_null($name)) {
44
-            return $this->app->config->get('session.' . $name, $default);
44
+            return $this->app->config->get('session.'.$name, $default);
45 45
         }
46 46
 
47 47
         return $this->app->config->get('session');
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) . uniqid());
121
+        $this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true).uniqid());
122 122
     }
123 123
 
124 124
     /**
Please login to merge, or discard this patch.
src/helper.php 1 patch
Spacing   +13 added lines, -14 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
 //------------------------
14 14
 // ThinkPHP 助手函数
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
         $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);
191 191
 
192 192
         if (PHP_SAPI == 'cli') {
193
-            $output = PHP_EOL . $output . PHP_EOL;
193
+            $output = PHP_EOL.$output.PHP_EOL;
194 194
         } else {
195 195
             if (!extension_loaded('xdebug')) {
196 196
                 $output = htmlspecialchars($output, ENT_SUBSTITUTE);
197 197
             }
198
-            $output = '<pre>' . $output . '</pre>';
198
+            $output = '<pre>'.$output.'</pre>';
199 199
         }
200 200
 
201 201
         echo $output;
@@ -274,8 +274,7 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         return isset($has) ?
277
-        request()->has($key, $method) :
278
-        request()->$method($key, $default, $filter);
277
+        request()->has($key, $method) : request()->$method($key, $default, $filter);
279 278
     }
280 279
 }
281 280
 
@@ -352,7 +351,7 @@  discard block
 block discarded – undo
352 351
     function parse_name(string $name, int $type = 0, bool $ucfirst = true): string
353 352
     {
354 353
         if ($type) {
355
-            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
354
+            $name = preg_replace_callback('/_([a-zA-Z])/', function($match) {
356 355
                 return strtoupper($match[1]);
357 356
             }, $name);
358 357
 
@@ -459,7 +458,7 @@  discard block
 block discarded – undo
459 458
     {
460 459
         $token = Request::buildToken($name, $type);
461 460
 
462
-        return '<input type="hidden" name="' . $name . '" value="' . $token . '" />';
461
+        return '<input type="hidden" name="'.$name.'" value="'.$token.'" />';
463 462
     }
464 463
 }
465 464
 
@@ -474,7 +473,7 @@  discard block
 block discarded – undo
474 473
     {
475 474
         $token = Request::buildToken($name, $type);
476 475
 
477
-        return '<meta name="csrf-token" content="' . $token . '">';
476
+        return '<meta name="csrf-token" content="'.$token.'">';
478 477
     }
479 478
 }
480 479
 
@@ -599,7 +598,7 @@  discard block
 block discarded – undo
599 598
      */
600 599
     function app_path($path = '')
601 600
     {
602
-        return app()->getAppPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path);
601
+        return app()->getAppPath().($path ? $path.DIRECTORY_SEPARATOR : $path);
603 602
     }
604 603
 }
605 604
 
@@ -612,7 +611,7 @@  discard block
 block discarded – undo
612 611
      */
613 612
     function base_path($path = '')
614 613
     {
615
-        return app()->getBasePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path);
614
+        return app()->getBasePath().($path ? $path.DIRECTORY_SEPARATOR : $path);
616 615
     }
617 616
 }
618 617
 
@@ -625,7 +624,7 @@  discard block
 block discarded – undo
625 624
      */
626 625
     function config_path($path = '')
627 626
     {
628
-        return app()->getConfigPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path);
627
+        return app()->getConfigPath().($path ? $path.DIRECTORY_SEPARATOR : $path);
629 628
     }
630 629
 }
631 630
 
@@ -638,7 +637,7 @@  discard block
 block discarded – undo
638 637
      */
639 638
     function public_path($path = '')
640 639
     {
641
-        return app()->getRootPath() . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path);
640
+        return app()->getRootPath().($path ? ltrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $path);
642 641
     }
643 642
 }
644 643
 
@@ -651,7 +650,7 @@  discard block
 block discarded – undo
651 650
      */
652 651
     function runtime_path($path = '')
653 652
     {
654
-        return app()->getRuntimePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path);
653
+        return app()->getRuntimePath().($path ? $path.DIRECTORY_SEPARATOR : $path);
655 654
     }
656 655
 }
657 656
 
@@ -664,6 +663,6 @@  discard block
 block discarded – undo
664 663
      */
665 664
     function root_path($path = '')
666 665
     {
667
-        return app()->getRootPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path);
666
+        return app()->getRootPath().($path ? $path.DIRECTORY_SEPARATOR : $path);
668 667
     }
669 668
 }
Please login to merge, or discard this patch.
src/think/middleware/LoadLangPack.php 1 patch
Spacing   +2 added lines, -2 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
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         if ($this->lang->defaultLangSet() != $langset) {
49 49
             // 加载系统语言包
50 50
             $this->lang->load([
51
-                $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php',
51
+                $this->app->getThinkPath().'lang'.DIRECTORY_SEPARATOR.$langset.'.php',
52 52
             ]);
53 53
 
54 54
             $this->app->LoadLangPack($langset);
Please login to merge, or discard this patch.
src/think/route/dispatch/Controller.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
         if (strpos($controller, '.')) {
55 55
             $pos              = strrpos($controller, '.');
56
-            $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1));
56
+            $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1));
57 57
         } else {
58 58
             $this->controller = Str::studly($controller);
59 59
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             // 实例化控制器
74 74
             $instance = $this->controller($this->controller);
75 75
         } catch (ClassNotFoundException $e) {
76
-            throw new HttpException(404, 'controller not exists:' . $e->getClass());
76
+            throw new HttpException(404, 'controller not exists:'.$e->getClass());
77 77
         }
78 78
 
79 79
         // 注册控制器中间件
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
         return $this->app->middleware->pipeline('controller')
83 83
             ->send($this->request)
84
-            ->then(function () use ($instance) {
84
+            ->then(function() use ($instance) {
85 85
                 // 获取当前操作名
86
-                $action = $this->actionName . $this->rule->config('action_suffix');
86
+                $action = $this->actionName.$this->rule->config('action_suffix');
87 87
 
88 88
                 if (is_callable([$instance, $action])) {
89 89
                     $vars = $this->request->param();
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                     }
100 100
                 } else {
101 101
                     // 操作不存在
102
-                    throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
102
+                    throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()');
103 103
                 }
104 104
 
105 105
                 $data = $this->app->invokeReflectMethod($instance, $reflect, $vars);
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
             foreach ($middlewares as $key => $val) {
128 128
                 if (!is_int($key)) {
129
-                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) {
129
+                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) {
130 130
                             return strtolower($item);
131 131
                         }, $val['only']))) {
132 132
                         continue;
133
-                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) {
133
+                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) {
134 134
                             return strtolower($item);
135 135
                         }, $val['except']))) {
136 136
                         continue;
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         $controllerLayer = $this->rule->config('controller_layer') ?: 'controller';
159 159
         $emptyController = $this->rule->config('empty_controller') ?: 'Error';
160 160
 
161
-        $class = $this->app->parseClass($controllerLayer, $name . $suffix);
161
+        $class = $this->app->parseClass($controllerLayer, $name.$suffix);
162 162
 
163 163
         if (class_exists($class)) {
164 164
             return $this->app->make($class, [], true);
165
-        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) {
165
+        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) {
166 166
             return $this->app->make($emptyClass, [], true);
167 167
         }
168 168
 
169
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
169
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
170 170
     }
171 171
 }
Please login to merge, or discard this patch.
src/think/Pipeline.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $pipeline = array_reduce(
55 55
             array_reverse($this->pipes),
56 56
             $this->carry(),
57
-            function ($passable) use ($destination) {
57
+            function($passable) use ($destination) {
58 58
                 try {
59 59
                     return $destination($passable);
60 60
                 } catch (Throwable | Exception $e) {
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
     protected function carry()
80 80
     {
81
-        return function ($stack, $pipe) {
82
-            return function ($passable) use ($stack, $pipe) {
81
+        return function($stack, $pipe) {
82
+            return function($passable) use ($stack, $pipe) {
83 83
                 try {
84 84
                     return $pipe($passable, $stack);
85 85
                 } catch (Throwable | Exception $e) {
Please login to merge, or discard this patch.
src/think/Db.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
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function getConfig(string $name = '', $default = null)
69 69
     {
70 70
         if ('' !== $name) {
71
-            return $this->config->get('database.' . $name, $default);
71
+            return $this->config->get('database.'.$name, $default);
72 72
         }
73 73
 
74 74
         return $this->config->get('database', []);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     public function event(string $event, callable $callback): void
94 94
     {
95 95
         if ($this->event) {
96
-            $this->event->listen('db.' . $event, $callback);
96
+            $this->event->listen('db.'.$event, $callback);
97 97
         }
98 98
     }
99 99
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function trigger(string $event, $params = null, bool $once = false)
109 109
     {
110 110
         if ($this->event) {
111
-            return $this->event->trigger('db.' . $event, $params, $once);
111
+            return $this->event->trigger('db.'.$event, $params, $once);
112 112
         }
113 113
     }
114 114
 }
Please login to merge, or discard this patch.