Completed
Pull Request — 6.0 (#1919)
by yun
09:27 queued 04:43
created
src/think/console/command/make/Middleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
     protected function getStub(): string
28 28
     {
29
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'middleware.stub';
29
+        return __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'middleware.stub';
30 30
     }
31 31
 
32 32
     protected function getNamespace(string $app): string
Please login to merge, or discard this patch.
src/think/console/command/make/Subscribe.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 
26 26
     protected function getStub(): string
27 27
     {
28
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'subscribe.stub';
28
+        return __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'subscribe.stub';
29 29
     }
30 30
 
31 31
     protected function getNamespace(string $app): string
32 32
     {
33
-        return parent::getNamespace($app) . '\\subscribe';
33
+        return parent::getNamespace($app).'\\subscribe';
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/think/console/command/make/Event.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 
26 26
     protected function getStub(): string
27 27
     {
28
-        return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'event.stub';
28
+        return __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'event.stub';
29 29
     }
30 30
 
31 31
     protected function getNamespace(string $app): string
32 32
     {
33
-        return parent::getNamespace($app) . '\\event';
33
+        return parent::getNamespace($app).'\\event';
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/think/console/command/make/Controller.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,27 +30,27 @@
 block discarded – undo
30 30
 
31 31
     protected function getStub(): string
32 32
     {
33
-        $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR;
33
+        $stubPath = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR;
34 34
 
35 35
         if ($this->input->getOption('api')) {
36
-            return $stubPath . 'controller.api.stub';
36
+            return $stubPath.'controller.api.stub';
37 37
         }
38 38
 
39 39
         if ($this->input->getOption('plain')) {
40
-            return $stubPath . 'controller.plain.stub';
40
+            return $stubPath.'controller.plain.stub';
41 41
         }
42 42
 
43
-        return $stubPath . 'controller.stub';
43
+        return $stubPath.'controller.stub';
44 44
     }
45 45
 
46 46
     protected function getClassName(string $name): string
47 47
     {
48
-        return parent::getClassName($name) . ($this->app->config->get('route.controller_suffix') ? 'Controller' : '');
48
+        return parent::getClassName($name).($this->app->config->get('route.controller_suffix') ? 'Controller' : '');
49 49
     }
50 50
 
51 51
     protected function getNamespace(string $app): string
52 52
     {
53
-        return parent::getNamespace($app) . '\\controller';
53
+        return parent::getNamespace($app).'\\controller';
54 54
     }
55 55
 
56 56
 }
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
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
             $this->app->cache->clear('route_cache');
39 39
         } else {
40 40
             $app         = $input->getArgument('app');
41
-            $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($app ? $app . DIRECTORY_SEPARATOR : '');
41
+            $runtimePath = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($app ? $app.DIRECTORY_SEPARATOR : '');
42 42
 
43 43
             if ($input->getOption('cache')) {
44
-                $path = $runtimePath . 'cache';
44
+                $path = $runtimePath.'cache';
45 45
             } elseif ($input->getOption('log')) {
46
-                $path = $runtimePath . 'log';
46
+                $path = $runtimePath.'log';
47 47
             } else {
48 48
                 $path = $input->getOption('path') ?: $runtimePath;
49 49
             }
50 50
 
51 51
             $rmdir = $input->getOption('dir') ? true : false;
52
-            $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir);
52
+            $this->clear(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $rmdir);
53 53
         }
54 54
 
55 55
         $output->writeln("<info>Clear Successed</info>");
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         $files = is_dir($path) ? scandir($path) : [];
61 61
 
62 62
         foreach ($files as $file) {
63
-            if ('.' != $file && '..' != $file && is_dir($path . $file)) {
64
-                array_map('unlink', glob($path . $file . DIRECTORY_SEPARATOR . '*.*'));
63
+            if ('.' != $file && '..' != $file && is_dir($path.$file)) {
64
+                array_map('unlink', glob($path.$file.DIRECTORY_SEPARATOR.'*.*'));
65 65
                 if ($rmdir) {
66
-                    rmdir($path . $file);
66
+                    rmdir($path.$file);
67 67
                 }
68
-            } elseif ('.gitignore' != $file && is_file($path . $file)) {
69
-                unlink($path . $file);
68
+            } elseif ('.gitignore' != $file && is_file($path.$file)) {
69
+                unlink($path.$file);
70 70
             }
71 71
         }
72 72
     }
Please login to merge, or discard this patch.
src/think/console/command/RunServer.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: Slince <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console\command;
14 14
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $port = $input->getOption('port');
38 38
         $root = $input->getOption('root');
39 39
         if (empty($root)) {
40
-            $root = $this->app->getRootPath() . 'public';
40
+            $root = $this->app->getRootPath().'public';
41 41
         }
42 42
 
43 43
         $command = sprintf(
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             $host,
46 46
             $port,
47 47
             escapeshellarg($root),
48
-            escapeshellarg($root . DIRECTORY_SEPARATOR . 'router.php')
48
+            escapeshellarg($root.DIRECTORY_SEPARATOR.'router.php')
49 49
         );
50 50
 
51 51
         $output->writeln(sprintf('ThinkPHP Development server is started On <http://%s:%s/>', '0.0.0.0' == $host ? '127.0.0.1' : $host, $port));
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,15 +36,15 @@  discard block
 block discarded – undo
36 36
                 }
37 37
             }
38 38
 
39
-            $header = '// This cache file is automatically generated at:' . date('Y-m-d H:i:s') . PHP_EOL . 'declare (strict_types = 1);' . PHP_EOL;
39
+            $header = '// This cache 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 43
             if (!is_dir($runtimePath = $this->app->getRuntimePath())) {
44 44
                 mkdir($runtimePath, 0755, true);
45 45
             }
46 46
 
47
-            file_put_contents($runtimePath . 'services.php', $content);
47
+            file_put_contents($runtimePath.'services.php', $content);
48 48
 
49 49
             $output->writeln('<info>Succeed!</info>');
50 50
         }
Please login to merge, or discard this patch.
src/think/console/command/optimize/Schema.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $app = $input->getArgument('app');
33 33
 
34
-        if (empty($app) && !is_dir($this->app->getBasePath() . 'controller')) {
34
+        if (empty($app) && !is_dir($this->app->getBasePath().'controller')) {
35 35
             $output->writeln('<error>Miss app name!</error>');
36 36
             return false;
37 37
         }
38 38
 
39 39
         if ($app) {
40
-            $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR;
41
-            $appPath     = $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR;
42
-            $namespace   = 'app\\' . $app;
40
+            $runtimePath = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR;
41
+            $appPath     = $this->app->getBasePath().$app.DIRECTORY_SEPARATOR;
42
+            $namespace   = 'app\\'.$app;
43 43
         } else {
44
-            $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR;
44
+            $runtimePath = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR;
45 45
             $appPath     = $this->app->getBasePath();
46 46
             $namespace   = 'app';
47 47
         }
48 48
 
49
-        $schemaPath = $runtimePath . 'schema' . DIRECTORY_SEPARATOR;
49
+        $schemaPath = $runtimePath.'schema'.DIRECTORY_SEPARATOR;
50 50
         if (!is_dir($schemaPath)) {
51 51
             mkdir($schemaPath, 0755, true);
52 52
         }
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
             $tables = $this->app->db->getConnection()->getTables($dbName);
64 64
         } else {
65 65
 
66
-            $path = $appPath . 'model';
66
+            $path = $appPath.'model';
67 67
             $list = is_dir($path) ? scandir($path) : [];
68 68
 
69 69
             foreach ($list as $file) {
70 70
                 if (0 === strpos($file, '.')) {
71 71
                     continue;
72 72
                 }
73
-                $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME);
73
+                $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME);
74 74
                 $this->buildModelSchema($schemaPath, $class);
75 75
             }
76 76
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             return;
79 79
         }
80 80
 
81
-        $db = isset($dbName) ? $dbName . '.' : '';
81
+        $db = isset($dbName) ? $dbName.'.' : '';
82 82
         $this->buildDataBaseSchema($schemaPath, $tables, $db);
83 83
 
84 84
         $output->writeln('<info>Succeed!</info>');
@@ -94,27 +94,27 @@  discard block
 block discarded – undo
94 94
 
95 95
             $table   = $model->getTable();
96 96
             $dbName  = $model->getConfig('database');
97
-            $content = '<?php ' . PHP_EOL . 'return ';
97
+            $content = '<?php '.PHP_EOL.'return ';
98 98
             $info    = $model->db()->getConnection()->getFields($table);
99
-            $content .= var_export($info, true) . ';';
99
+            $content .= var_export($info, true).';';
100 100
 
101
-            file_put_contents($path . $dbName . '.' . $table . '.php', $content);
101
+            file_put_contents($path.$dbName.'.'.$table.'.php', $content);
102 102
         }
103 103
     }
104 104
 
105 105
     protected function buildDataBaseSchema(string $path, array $tables, string $db): void
106 106
     {
107 107
         if ('' == $db) {
108
-            $dbName = $this->app->db->getConfig('database') . '.';
108
+            $dbName = $this->app->db->getConfig('database').'.';
109 109
         } else {
110 110
             $dbName = $db;
111 111
         }
112 112
 
113 113
         foreach ($tables as $table) {
114
-            $content = '<?php ' . PHP_EOL . 'return ';
115
-            $info    = $this->app->db->getConnection()->getFields($db . $table);
116
-            $content .= var_export($info, true) . ';';
117
-            file_put_contents($path . $dbName . $table . '.php', $content);
114
+            $content = '<?php '.PHP_EOL.'return ';
115
+            $info    = $this->app->db->getConnection()->getFields($db.$table);
116
+            $content .= var_export($info, true).';';
117
+            file_put_contents($path.$dbName.$table.'.php', $content);
118 118
         }
119 119
     }
120 120
 }
Please login to merge, or discard this patch.
src/think/console/command/VendorPublish.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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
         $force = $this->input->getOption('force');
31 31
 
32
-        if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) {
32
+        if (is_file($path = $this->app->getRootPath().'vendor/composer/installed.json')) {
33 33
             $packages = json_decode(@file_get_contents($path), true);
34 34
 
35 35
             foreach ($packages as $package) {
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 
39 39
                 if (!empty($package['extra']['think']['config'])) {
40 40
 
41
-                    $installPath = $this->app->getRootPath() . 'vendor/' . $package['name'] . DIRECTORY_SEPARATOR;
41
+                    $installPath = $this->app->getRootPath().'vendor/'.$package['name'].DIRECTORY_SEPARATOR;
42 42
 
43 43
                     foreach ((array) $package['extra']['think']['config'] as $name => $file) {
44 44
 
45
-                        $target = $configDir . $name . '.php';
46
-                        $source = $installPath . $file;
45
+                        $target = $configDir.$name.'.php';
46
+                        $source = $installPath.$file;
47 47
 
48 48
                         if (is_file($target) && !$force) {
49 49
                             $this->output->info("File {$target} exist!");
Please login to merge, or discard this patch.