Passed
Pull Request — 6.0 (#2093)
by
unknown
06:29
created
tests/EventTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $this->event->bind(['foo' => 'baz']);
44 44
 
45
-        $this->event->listen('foo', function ($bar) {
45
+        $this->event->listen('foo', function($bar) {
46 46
             $this->assertEquals('bar', $bar);
47 47
         });
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function testOnceEvent()
59 59
     {
60
-        $this->event->listen('AppInit', function ($bar) {
60
+        $this->event->listen('AppInit', function($bar) {
61 61
             $this->assertEquals('bar', $bar);
62 62
             return 'foo';
63 63
         });
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $listener = m::mock("overload:SomeListener", TestListener::class);
83 83
 
84
-        $listener->shouldReceive('subscribe')->andReturnUsing(function (Event $event) use ($listener) {
84
+        $listener->shouldReceive('subscribe')->andReturnUsing(function(Event $event) use ($listener) {
85 85
 
86 86
             $listener->shouldReceive('onBar')->once()->andReturnFalse();
87 87
 
Please login to merge, or discard this patch.
src/think/Event.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
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         foreach ($methods as $method) {
222 222
             $name = $method->getName();
223 223
             if (0 === strpos($name, 'on')) {
224
-                $this->listen($prefix . substr($name, 2), [$observer, $name]);
224
+                $this->listen($prefix.substr($name, 2), [$observer, $name]);
225 225
             }
226 226
         }
227 227
 
Please login to merge, or discard this patch.
src/think/filesystem/Driver.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\filesystem;
14 14
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function putFileAs(string $path, File $file, string $name, array $options = [])
116 116
     {
117 117
         $stream = fopen($file->getRealPath(), 'r');
118
-        $path = trim($path . '/' . $name, '/');
118
+        $path = trim($path.'/'.$name, '/');
119 119
 
120 120
         $result = $this->putStream($path, $stream, $options);
121 121
 
Please login to merge, or discard this patch.
tests/HttpTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         $route = m::mock(Route::class);
49 49
 
50
-        $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) {
50
+        $route->shouldReceive('dispatch')->withArgs(function($req, $withRoute) use ($request) {
51 51
             if ($withRoute) {
52 52
                 $withRoute();
53 53
             }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
             ],
78 78
         ]);
79 79
 
80
-        $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR);
81
-        $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR);
80
+        $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR);
81
+        $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR);
82 82
 
83 83
         $request  = m::mock(Request::class)->makePartial();
84 84
         $response = m::mock(Response::class)->makePartial();
Please login to merge, or discard this patch.
src/think/Http.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;
14 14
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $this->app = $app;
54 54
 
55
-        $this->routePath = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
55
+        $this->routePath = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
56 56
     }
57 57
 
58 58
     /**
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 
200 200
         return $this->app->middleware->pipeline()
201 201
             ->send($request)
202
-            ->then(function ($request) {
202
+            ->then(function($request) {
203 203
                 return $this->dispatchToRoute($request);
204 204
             });
205 205
     }
206 206
 
207 207
     protected function dispatchToRoute($request)
208 208
     {
209
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
209
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
210 210
             $this->loadRoutes();
211 211
         } : null;
212 212
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function loadMiddleware(): void
220 220
     {
221
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
222
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
221
+        if (is_file($this->app->getBasePath().'middleware.php')) {
222
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
223 223
         }
224 224
     }
225 225
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $routePath = $this->getRoutePath();
235 235
 
236 236
         if (is_dir($routePath)) {
237
-            $files = glob($routePath . '*.php');
237
+            $files = glob($routePath.'*.php');
238 238
             foreach ($files as $file) {
239 239
                 include $file;
240 240
             }
Please login to merge, or discard this patch.
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/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.