Passed
Pull Request — 6.0 (#2039)
by
unknown
05:17
created
src/think/console/Command.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         ];
405 405
         $replacements = [
406 406
             $name,
407
-            $_SERVER['PHP_SELF'] . ' ' . $name,
407
+            $_SERVER['PHP_SELF'].' '.$name,
408 408
         ];
409 409
 
410 410
         return str_replace($placeholders, $replacements, $this->getHelp());
Please login to merge, or discard this patch.
src/think/view/driver/Php.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\view\driver;
14 14
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
         // 模板不存在 抛出异常
80 80
         if (!is_file($template)) {
81
-            throw new RuntimeException('template not exists:' . $template);
81
+            throw new RuntimeException('template not exists:'.$template);
82 82
         }
83 83
 
84 84
         $this->template = $template;
85 85
 
86 86
         // 记录视图信息
87 87
         $this->app->log
88
-            ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
88
+            ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
89 89
 
90 90
         extract($data, EXTR_OVERWRITE);
91 91
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->content = $content;
105 105
 
106 106
         extract($data, EXTR_OVERWRITE);
107
-        eval('?>' . $this->content);
107
+        eval('?>'.$this->content);
108 108
     }
109 109
 
110 110
     /**
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
             $appName = isset($app) ? $app : $this->app->http->getName();
130 130
             $view    = $this->config['view_dir_name'];
131 131
 
132
-            if (is_dir($this->app->getAppPath() . $view)) {
133
-                $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR;
132
+            if (is_dir($this->app->getAppPath().$view)) {
133
+                $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR;
134 134
             } else {
135
-                $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : '');
135
+                $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : '');
136 136
             }
137 137
         }
138 138
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $controller = $request->controller();
144 144
             if (strpos($controller, '.')) {
145 145
                 $pos        = strrpos($controller, '.');
146
-                $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1));
146
+                $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1));
147 147
             } else {
148 148
                 $controller = Str::snake($controller);
149 149
             }
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
                         $template = Str::snake($request->action());
160 160
                     }
161 161
 
162
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
162
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
163 163
                 } elseif (false === strpos($template, $depr)) {
164
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
164
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
165 165
                 }
166 166
             }
167 167
         } else {
168 168
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
169 169
         }
170 170
 
171
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
171
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
172 172
     }
173 173
 
174 174
     /**
Please login to merge, or discard this patch.
src/think/console/command/optimize/Schema.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,21 +48,21 @@  discard block
 block discarded – undo
48 48
             $tables = $this->app->db->getConnection()->getTables($dbName);
49 49
         } else {
50 50
             if ($dir) {
51
-                $appPath   = $this->app->getBasePath() . $dir . DIRECTORY_SEPARATOR;
52
-                $namespace = 'app\\' . $dir;
51
+                $appPath   = $this->app->getBasePath().$dir.DIRECTORY_SEPARATOR;
52
+                $namespace = 'app\\'.$dir;
53 53
             } else {
54 54
                 $appPath   = $this->app->getBasePath();
55 55
                 $namespace = 'app';
56 56
             }
57 57
 
58
-            $path = $appPath . 'model';
58
+            $path = $appPath.'model';
59 59
             $list = is_dir($path) ? scandir($path) : [];
60 60
 
61 61
             foreach ($list as $file) {
62 62
                 if (0 === strpos($file, '.')) {
63 63
                     continue;
64 64
                 }
65
-                $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME);
65
+                $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME);
66 66
                 $this->buildModelSchema($class);
67 67
             }
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             return;
71 71
         }
72 72
 
73
-        $db = isset($dbName) ? $dbName . '.' : '';
73
+        $db = isset($dbName) ? $dbName.'.' : '';
74 74
         $this->buildDataBaseSchema($schemaPath, $tables, $db);
75 75
 
76 76
         $output->writeln('<info>Succeed!</info>');
@@ -89,27 +89,27 @@  discard block
 block discarded – undo
89 89
             if (!is_dir($path)) {
90 90
                 mkdir($path, 0755, true);
91 91
             }
92
-            $content = '<?php ' . PHP_EOL . 'return ';
92
+            $content = '<?php '.PHP_EOL.'return ';
93 93
             $info    = $model->db()->getConnection()->getTableFieldsInfo($table);
94
-            $content .= var_export($info, true) . ';';
94
+            $content .= var_export($info, true).';';
95 95
 
96
-            file_put_contents($path . $dbName . '.' . $table . '.php', $content);
96
+            file_put_contents($path.$dbName.'.'.$table.'.php', $content);
97 97
         }
98 98
     }
99 99
 
100 100
     protected function buildDataBaseSchema(string $path, array $tables, string $db): void
101 101
     {
102 102
         if ('' == $db) {
103
-            $dbName = $this->app->db->getConnection()->getConfig('database') . '.';
103
+            $dbName = $this->app->db->getConnection()->getConfig('database').'.';
104 104
         } else {
105 105
             $dbName = $db;
106 106
         }
107 107
 
108 108
         foreach ($tables as $table) {
109
-            $content = '<?php ' . PHP_EOL . 'return ';
110
-            $info    = $this->app->db->getConnection()->getTableFieldsInfo($db . $table);
111
-            $content .= var_export($info, true) . ';';
112
-            file_put_contents($path . $dbName . $table . '.php', $content);
109
+            $content = '<?php '.PHP_EOL.'return ';
110
+            $info    = $this->app->db->getConnection()->getTableFieldsInfo($db.$table);
111
+            $content .= var_export($info, true).';';
112
+            file_put_contents($path.$dbName.$table.'.php', $content);
113 113
         }
114 114
     }
115 115
 }
Please login to merge, or discard this patch.
src/think/console/command/Clear.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
         if ($input->getOption('route')) {
36 36
             $this->app->cache->clear('route_cache');
37 37
         } else {
38
-            $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR;
38
+            $runtimePath = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR;
39 39
 
40 40
             if ($input->getOption('cache')) {
41
-                $path = $runtimePath . 'cache';
41
+                $path = $runtimePath.'cache';
42 42
             } elseif ($input->getOption('log')) {
43
-                $path = $runtimePath . 'log';
43
+                $path = $runtimePath.'log';
44 44
             } else {
45 45
                 $path = $input->getOption('path') ?: $runtimePath;
46 46
             }
47 47
 
48 48
             $rmdir = $input->getOption('dir') ? true : false;
49
-            $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir);
49
+            $this->clear(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $rmdir);
50 50
         }
51 51
 
52 52
         $output->writeln("<info>Clear Successed</info>");
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
         $files = is_dir($path) ? scandir($path) : [];
58 58
 
59 59
         foreach ($files as $file) {
60
-            if ('.' != $file && '..' != $file && is_dir($path . $file)) {
61
-                array_map('unlink', glob($path . $file . DIRECTORY_SEPARATOR . '*.*'));
60
+            if ('.' != $file && '..' != $file && is_dir($path.$file)) {
61
+                array_map('unlink', glob($path.$file.DIRECTORY_SEPARATOR.'*.*'));
62 62
                 if ($rmdir) {
63
-                    rmdir($path . $file);
63
+                    rmdir($path.$file);
64 64
                 }
65
-            } elseif ('.gitignore' != $file && is_file($path . $file)) {
66
-                unlink($path . $file);
65
+            } elseif ('.gitignore' != $file && is_file($path.$file)) {
66
+                unlink($path.$file);
67 67
             }
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
src/think/console/command/Build.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $this->basePath = $this->app->getBasePath();
41 41
         $dir            = $input->getArgument('dir') ?: '';
42 42
 
43
-        $list = include $this->basePath . 'build.php';
43
+        $list = include $this->basePath.'build.php';
44 44
 
45 45
         if (empty($list)) {
46 46
             $output->writeln("Build file Is Empty");
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected function buildApp(string $dir, array $list = []): void
63 63
     {
64
-        if (!is_dir($this->basePath . $dir)) {
64
+        if (!is_dir($this->basePath.$dir)) {
65 65
             // 创建应用目录
66
-            mkdir($this->basePath . $dir);
66
+            mkdir($this->basePath.$dir);
67 67
         }
68 68
 
69
-        $appPath   = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
70
-        $namespace = 'app' . ($dir ? '\\' . $dir : '');
69
+        $appPath   = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '');
70
+        $namespace = 'app'.($dir ? '\\'.$dir : '');
71 71
 
72 72
         // 创建配置文件和公共文件
73 73
         $this->buildCommon($dir);
@@ -78,41 +78,41 @@  discard block
 block discarded – undo
78 78
             if ('__dir__' == $path) {
79 79
                 // 生成子目录
80 80
                 foreach ($file as $dir) {
81
-                    $this->checkDirBuild($appPath . $dir);
81
+                    $this->checkDirBuild($appPath.$dir);
82 82
                 }
83 83
             } elseif ('__file__' == $path) {
84 84
                 // 生成(空白)文件
85 85
                 foreach ($file as $name) {
86
-                    if (!is_file($appPath . $name)) {
87
-                        file_put_contents($appPath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php' . PHP_EOL : '');
86
+                    if (!is_file($appPath.$name)) {
87
+                        file_put_contents($appPath.$name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php'.PHP_EOL : '');
88 88
                     }
89 89
                 }
90 90
             } else {
91 91
                 // 生成相关MVC文件
92 92
                 foreach ($file as $val) {
93 93
                     $val      = trim($val);
94
-                    $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.php';
95
-                    $space    = $namespace . '\\' . $path;
94
+                    $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.php';
95
+                    $space    = $namespace.'\\'.$path;
96 96
                     $class    = $val;
97 97
                     switch ($path) {
98 98
                         case 'controller': // 控制器
99 99
                             if ($this->app->config->get('route.controller_suffix')) {
100
-                                $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . 'Controller.php';
101
-                                $class    = $val . 'Controller';
100
+                                $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'Controller.php';
101
+                                $class    = $val.'Controller';
102 102
                             }
103
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
103
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
104 104
                             break;
105 105
                         case 'model': // 模型
106
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "use think\Model;" . PHP_EOL . PHP_EOL . "class {$class} extends Model" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
106
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."use think\Model;".PHP_EOL.PHP_EOL."class {$class} extends Model".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
107 107
                             break;
108 108
                         case 'view': // 视图
109
-                            $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.html';
109
+                            $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.html';
110 110
                             $this->checkDirBuild(dirname($filename));
111 111
                             $content = '';
112 112
                             break;
113 113
                         default:
114 114
                             // 其他文件
115
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
115
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
116 116
                     }
117 117
 
118 118
                     if (!is_file($filename)) {
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
     protected function buildHello(string $dir, string $namespace): void
134 134
     {
135 135
         $suffix   = $this->app->config->get('route.controller_suffix') ? 'Controller' : '';
136
-        $filename = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'controller' . DIRECTORY_SEPARATOR . 'Index' . $suffix . '.php';
136
+        $filename = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '').'controller'.DIRECTORY_SEPARATOR.'Index'.$suffix.'.php';
137 137
 
138 138
         if (!is_file($filename)) {
139
-            $content = file_get_contents($this->app->getThinkPath() . 'tpl' . DIRECTORY_SEPARATOR . 'default_index.tpl');
139
+            $content = file_get_contents($this->app->getThinkPath().'tpl'.DIRECTORY_SEPARATOR.'default_index.tpl');
140 140
             $content = str_replace(['{%name%}', '{%app%}', '{%layer%}', '{%suffix%}'], [$dir, $namespace, 'controller', $suffix], $content);
141 141
             $this->checkDirBuild(dirname($filename));
142 142
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
      */
153 153
     protected function buildCommon(string $dir): void
154 154
     {
155
-        $appPath = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
155
+        $appPath = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '');
156 156
 
157
-        if (!is_file($appPath . 'common.php')) {
158
-            file_put_contents($appPath . 'common.php', "<?php" . PHP_EOL . "// 这是系统自动生成的公共文件" . PHP_EOL);
157
+        if (!is_file($appPath.'common.php')) {
158
+            file_put_contents($appPath.'common.php', "<?php".PHP_EOL."// 这是系统自动生成的公共文件".PHP_EOL);
159 159
         }
160 160
 
161 161
         foreach (['event', 'middleware', 'provider'] as $name) {
162
-            if (!is_file($appPath . $name . '.php')) {
163
-                file_put_contents($appPath . $name . '.php', "<?php" . PHP_EOL . "// 这是系统自动生成的{$name}定义文件" . PHP_EOL . "return [" . PHP_EOL . PHP_EOL . "];" . PHP_EOL);
162
+            if (!is_file($appPath.$name.'.php')) {
163
+                file_put_contents($appPath.$name.'.php', "<?php".PHP_EOL."// 这是系统自动生成的{$name}定义文件".PHP_EOL."return [".PHP_EOL.PHP_EOL."];".PHP_EOL);
164 164
             }
165 165
         }
166 166
     }
Please login to merge, or discard this patch.
src/think/console/command/optimize/Route.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $dir = $input->getArgument('dir') ?: '';
31 31
 
32
-        $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
32
+        $path = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '');
33 33
 
34
-        $filename = $path . 'route.php';
34
+        $filename = $path.'route.php';
35 35
         if (is_file($filename)) {
36 36
             unlink($filename);
37 37
         }
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
         $this->app->route->lazy(false);
47 47
 
48 48
         // 路由检测
49
-        $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
49
+        $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '');
50 50
 
51 51
         $files = is_dir($path) ? scandir($path) : [];
52 52
 
53 53
         foreach ($files as $file) {
54 54
             if (strpos($file, '.php')) {
55
-                include $path . $file;
55
+                include $path.$file;
56 56
             }
57 57
         }
58 58
 
59 59
         //触发路由载入完成事件
60 60
         $this->app->event->trigger(RouteLoaded::class);
61 61
 
62
-        $content = '<?php ' . PHP_EOL . 'return ';
63
-        $content .= '\Opis\Closure\unserialize(\'' . \Opis\Closure\serialize($this->app->route->getName()) . '\');';
62
+        $content = '<?php '.PHP_EOL.'return ';
63
+        $content .= '\Opis\Closure\unserialize(\''.\Opis\Closure\serialize($this->app->route->getName()).'\');';
64 64
         return $content;
65 65
     }
66 66
 
Please login to merge, or discard this patch.
src/think/console/command/RouteList.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $dir = $input->getArgument('dir') ?: '';
44 44
 
45
-        $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'route_list.php';
45
+        $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '').'route_list.php';
46 46
 
47 47
         if (is_file($filename)) {
48 48
             unlink($filename);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         }
52 52
 
53 53
         $content = $this->getRouteList($dir);
54
-        file_put_contents($filename, 'Route List' . PHP_EOL . $content);
54
+        file_put_contents($filename, 'Route List'.PHP_EOL.$content);
55 55
     }
56 56
 
57 57
     protected function getRouteList(string $dir = null): string
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
         $this->app->route->clear();
61 61
 
62 62
         if ($dir) {
63
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
63
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR;
64 64
         } else {
65
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
65
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
66 66
         }
67 67
 
68 68
         $files = is_dir($path) ? scandir($path) : [];
69 69
 
70 70
         foreach ($files as $file) {
71 71
             if (strpos($file, '.php')) {
72
-                include $path . $file;
72
+                include $path.$file;
73 73
             }
74 74
         }
75 75
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $sort = $this->sortBy[$sort];
109 109
             }
110 110
 
111
-            uasort($rows, function ($a, $b) use ($sort) {
111
+            uasort($rows, function($a, $b) use ($sort) {
112 112
                 $itemA = $a[$sort] ?? null;
113 113
                 $itemB = $b[$sort] ?? null;
114 114
 
Please login to merge, or discard this patch.
tests/MiddlewareTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
         $this->middleware->add('foo');
66 66
         $this->assertEquals(3, count($this->middleware->all()));
67
-        $this->middleware->add(function () {
67
+        $this->middleware->add(function() {
68 68
         });
69
-        $this->middleware->add(function () {
69
+        $this->middleware->add(function() {
70 70
         });
71 71
         $this->assertEquals(5, count($this->middleware->all()));
72 72
     }
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         $handle->shouldReceive('report')->with($e)->andReturnNull();
86 86
         $handle->shouldReceive('render')->with($request, $e)->andReturn($response);
87 87
 
88
-        $foo->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) {
88
+        $foo->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) {
89 89
             return $next($request);
90 90
         });
91
-        $bar->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) use ($e) {
91
+        $bar->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) use ($e) {
92 92
             $next($request);
93 93
             throw  $e;
94 94
         });
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 
100 100
         $this->config->shouldReceive('get')->once()->with('middleware.priority', [])->andReturn(['FooMiddleware', 'BarMiddleware']);
101 101
 
102
-        $this->middleware->import([function ($request, $next) {
102
+        $this->middleware->import([function($request, $next) {
103 103
             return $next($request);
104 104
         }, 'BarMiddleware', 'FooMiddleware']);
105 105
 
106 106
         $this->assertInstanceOf(Pipeline::class, $pipeline = $this->middleware->pipeline());
107 107
 
108
-        $pipeline->send($request)->then(function ($request) use ($e, $response) {
108
+        $pipeline->send($request)->then(function($request) use ($e, $response) {
109 109
             throw $e;
110 110
         });
111 111
 
Please login to merge, or discard this patch.
src/think/route/Url.php 1 patch
Spacing   +19 added lines, -19 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
     /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             $action     = array_pop($path);
249 249
             $controller = empty($path) ? $controller : array_pop($path);
250 250
 
251
-            $url = $controller . '/' . $action;
251
+            $url = $controller.'/'.$action;
252 252
         }
253 253
 
254 254
         return $url;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     {
296 296
         $request = $this->app->request;
297 297
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
298
-            $allowDomain .= '.' . $request->rootDomain();
298
+            $allowDomain .= '.'.$request->rootDomain();
299 299
         }
300 300
 
301 301
         foreach ($rule as $item) {
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             }
314 314
 
315 315
             if (!in_array($request->port(), [80, 443])) {
316
-                $domain .= ':' . $request->port();
316
+                $domain .= ':'.$request->port();
317 317
             }
318 318
 
319 319
             if (empty($pattern)) {
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
 
325 325
             foreach ($pattern as $key => $val) {
326 326
                 if (isset($vars[$key])) {
327
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
327
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
328 328
                     unset($vars[$key]);
329 329
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
330 330
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
331 331
                 } elseif (2 == $val) {
332
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
332
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
333 333
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
334 334
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
335 335
                 } else {
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
358 358
             // [name] 表示使用路由命名标识生成URL
359 359
             $name = substr($url, 1, $pos - 1);
360
-            $url  = 'name' . substr($url, $pos + 1);
360
+            $url  = 'name'.substr($url, $pos + 1);
361 361
         }
362 362
 
363 363
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         }
385 385
 
386 386
         if ($url) {
387
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
387
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
388 388
             $checkDomain = $domain && is_string($domain) ? $domain : null;
389 389
 
390 390
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                 $suffix = $match[2];
411 411
             }
412 412
         } elseif (!empty($rule) && isset($name)) {
413
-            throw new \InvalidArgumentException('route name not exists:' . $name);
413
+            throw new \InvalidArgumentException('route name not exists:'.$name);
414 414
         } else {
415 415
             // 检测URL绑定
416 416
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             $file = str_replace('\\', '/', dirname($file));
449 449
         }
450 450
 
451
-        $url = rtrim($file, '/') . '/' . $url;
451
+        $url = rtrim($file, '/').'/'.$url;
452 452
 
453 453
         // URL后缀
454 454
         if ('/' == substr($url, -1) || '' == $url) {
@@ -458,32 +458,32 @@  discard block
 block discarded – undo
458 458
         }
459 459
 
460 460
         // 锚点
461
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
461
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
462 462
 
463 463
         // 参数组装
464 464
         if (!empty($vars)) {
465 465
             // 添加参数
466 466
             if ($this->route->config('url_common_param')) {
467 467
                 $vars = http_build_query($vars);
468
-                $url .= $suffix . '?' . $vars . $anchor;
468
+                $url .= $suffix.'?'.$vars.$anchor;
469 469
             } else {
470 470
                 foreach ($vars as $var => $val) {
471 471
                     if ('' !== $val) {
472
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
472
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
473 473
                     }
474 474
                 }
475 475
 
476
-                $url .= $suffix . $anchor;
476
+                $url .= $suffix.$anchor;
477 477
             }
478 478
         } else {
479
-            $url .= $suffix . $anchor;
479
+            $url .= $suffix.$anchor;
480 480
         }
481 481
 
482 482
         // 检测域名
483 483
         $domain = $this->parseDomain($url, $domain);
484 484
 
485 485
         // URL组装
486
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
486
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
487 487
     }
488 488
 
489 489
     public function __toString()
Please login to merge, or discard this patch.