Passed
Pull Request — 6.0 (#2239)
by yun
12:47 queued 06:07
created
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
 
@@ -458,10 +458,10 @@  discard block
 block discarded – undo
458 458
     public function findNamespace(string $namespace): string
459 459
     {
460 460
         $allNamespaces = $this->getNamespaces();
461
-        $expr          = preg_replace_callback('{([^:]+|)}', function ($matches) {
462
-            return preg_quote($matches[1]) . '[^:]*';
461
+        $expr          = preg_replace_callback('{([^:]+|)}', function($matches) {
462
+            return preg_quote($matches[1]).'[^:]*';
463 463
         }, $namespace);
464
-        $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
464
+        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
465 465
 
466 466
         if (empty($namespaces)) {
467 467
             $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
     {
499 499
         $allCommands = array_keys($this->commands);
500 500
 
501
-        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
502
-            return preg_quote($matches[1]) . '[^:]*';
501
+        $expr = preg_replace_callback('{([^:]+|)}', function($matches) {
502
+            return preg_quote($matches[1]).'[^:]*';
503 503
         }, $name);
504 504
 
505
-        $commands = preg_grep('{^' . $expr . '}', $allCommands);
505
+        $commands = preg_grep('{^'.$expr.'}', $allCommands);
506 506
 
507
-        if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
507
+        if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
508 508
             if (false !== $pos = strrpos($name, ':')) {
509 509
                 $this->findNamespace(substr($name, 0, $pos));
510 510
             }
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
             }
699 699
         }
700 700
 
701
-        $alternatives = array_filter($alternatives, function ($lev) use ($threshold) {
701
+        $alternatives = array_filter($alternatives, function($lev) use ($threshold) {
702 702
             return $lev < 2 * $threshold;
703 703
         });
704 704
         asort($alternatives);
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
         foreach ($parts as $part) {
721 721
             if (count($namespaces)) {
722
-                $namespaces[] = end($namespaces) . ':' . $part;
722
+                $namespaces[] = end($namespaces).':'.$part;
723 723
             } else {
724 724
                 $namespaces[] = $part;
725 725
             }
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
     /**
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 
197 197
         return $this->app->middleware->pipeline()
198 198
             ->send($request)
199
-            ->then(function ($request) {
199
+            ->then(function($request) {
200 200
                 return $this->dispatchToRoute($request);
201 201
             });
202 202
     }
203 203
 
204 204
     protected function dispatchToRoute($request)
205 205
     {
206
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
206
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
207 207
             $this->loadRoutes();
208 208
         }
209 209
         : null;
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
      */
217 217
     protected function loadMiddleware(): void
218 218
     {
219
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
220
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
219
+        if (is_file($this->app->getBasePath().'middleware.php')) {
220
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
221 221
         }
222 222
     }
223 223
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $routePath = $this->getRoutePath();
233 233
 
234 234
         if (is_dir($routePath)) {
235
-            $files = glob($routePath . '*.php');
235
+            $files = glob($routePath.'*.php');
236 236
             foreach ($files as $file) {
237 237
                 include $file;
238 238
             }
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/console/Input.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         foreach ($this->tokens as $token) {
268 268
             foreach ($values as $value) {
269
-                if ($token === $value || 0 === strpos($token, $value . '=')) {
269
+                if ($token === $value || 0 === strpos($token, $value.'=')) {
270 270
                     return true;
271 271
                 }
272 272
             }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             $token = array_shift($tokens);
291 291
 
292 292
             foreach ($values as $value) {
293
-                if ($token === $value || 0 === strpos($token, $value . '=')) {
293
+                if ($token === $value || 0 === strpos($token, $value.'=')) {
294 294
                     if (false !== $pos = strpos($token, '=')) {
295 295
                         return substr($token, $pos + 1);
296 296
                     }
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
      */
448 448
     public function __toString()
449 449
     {
450
-        $tokens = array_map(function ($token) {
450
+        $tokens = array_map(function($token) {
451 451
             if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
452
-                return $match[1] . $this->escapeToken($match[2]);
452
+                return $match[1].$this->escapeToken($match[2]);
453 453
             }
454 454
 
455 455
             if ($token && '-' !== $token[0]) {
Please login to merge, or discard this patch.
src/think/console/Table.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             $array[] = str_repeat($style[1], $width + 2);
208 208
         }
209 209
 
210
-        return $style[0] . implode($style[2], $array) . $style[3] . PHP_EOL;
210
+        return $style[0].implode($style[2], $array).$style[3].PHP_EOL;
211 211
     }
212 212
 
213 213
     /**
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
         $content = $this->renderSeparator('top');
222 222
 
223 223
         foreach ($this->header as $key => $header) {
224
-            $array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
224
+            $array[] = ' '.str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
225 225
         }
226 226
 
227 227
         if (!empty($array)) {
228
-            $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
228
+            $content .= $style[0].implode(' '.$style[2], $array).' '.$style[3].PHP_EOL;
229 229
 
230 230
             if (!empty($this->rows)) {
231 231
                 $content .= $this->renderSeparator('middle');
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
                     $content .= $this->renderSeparator('middle');
269 269
                 } elseif (is_scalar($row)) {
270 270
                     $content .= $this->renderSeparator('cross-top');
271
-                    $width = 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) {
271
+                    $width = 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function($a, $b) {
272 272
                         return $a + $b;
273 273
                     });
274 274
                     $array = str_pad($row, $width);
275 275
 
276
-                    $content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL;
276
+                    $content .= $style[0].' '.$array.' '.$style[3].PHP_EOL;
277 277
                     $content .= $this->renderSeparator('cross-bottom');
278 278
                 } else {
279 279
                     $array = [];
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
                         if (false !== $encoding = mb_detect_encoding((string) $val, null, true)) {
286 286
                             $width += strlen((string) $val) - mb_strwidth((string) $val, $encoding);
287 287
                         }
288
-                        $array[] = ' ' . str_pad((string) $val, $width, ' ', $this->cellAlign);
288
+                        $array[] = ' '.str_pad((string) $val, $width, ' ', $this->cellAlign);
289 289
                     }
290 290
 
291
-                    $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
291
+                    $content .= $style[0].implode(' '.$style[2], $array).' '.$style[3].PHP_EOL;
292 292
                 }
293 293
             }
294 294
         }
Please login to merge, or discard this patch.
src/think/console/Output.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function __construct($driver = 'console')
76 76
     {
77
-        $class = '\\think\\console\\output\\driver\\' . ucwords($driver);
77
+        $class = '\\think\\console\\output\\driver\\'.ucwords($driver);
78 78
 
79 79
         $this->handle = new $class($this);
80 80
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         if ($this->handle && method_exists($this->handle, $method)) {
226 226
             return call_user_func_array([$this->handle, $method], $args);
227 227
         } else {
228
-            throw new Exception('method not exists:' . __CLASS__ . '->' . $method);
228
+            throw new Exception('method not exists:'.__CLASS__.'->'.$method);
229 229
         }
230 230
     }
231 231
 }
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() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR ;
49
+        $path = $this->app->getRootPath().($dir ? 'app'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR : '').'route'.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/Version.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\console\command;
14 14
 
@@ -27,6 +27,6 @@  discard block
 block discarded – undo
27 27
 
28 28
     protected function execute(Input $input, Output $output)
29 29
     {
30
-        $output->writeln('v' . $this->app->version());
30
+        $output->writeln('v'.$this->app->version());
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/think/console/command/ServiceDiscover.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console\command;
14 14
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function execute(Input $input, Output $output)
28 28
     {
29
-        if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) {
29
+        if (is_file($path = $this->app->getRootPath().'vendor/composer/installed.json')) {
30 30
             $packages = json_decode(@file_get_contents($path), true);
31 31
 
32 32
             $services = [];
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
                 }
37 37
             }
38 38
 
39
-            $header = '// This file is automatically generated at:' . date('Y-m-d H:i:s') . PHP_EOL . 'declare (strict_types = 1);' . PHP_EOL;
39
+            $header = '// This file is automatically generated at:'.date('Y-m-d H:i:s').PHP_EOL.'declare (strict_types = 1);'.PHP_EOL;
40 40
 
41
-            $content = '<?php ' . PHP_EOL . $header . "return " . var_export($services, true) . ';';
41
+            $content = '<?php '.PHP_EOL.$header."return ".var_export($services, true).';';
42 42
 
43
-            file_put_contents($this->app->getRootPath() . 'vendor/services.php', $content);
43
+            file_put_contents($this->app->getRootPath().'vendor/services.php', $content);
44 44
 
45 45
             $output->writeln('<info>Succeed!</info>');
46 46
         }
Please login to merge, or discard this patch.