Passed
Pull Request — 6.0 (#2238)
by yun
06:03
created
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.
tests/DbTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         $config->shouldReceive('get')->with('database', [])->andReturn([]);
33 33
         $this->assertEquals([], $db->getConfig());
34 34
 
35
-        $callback = function () {
35
+        $callback = function() {
36 36
         };
37 37
         $event->shouldReceive('listen')->with('db.some', $callback);
38 38
         $db->event('some', $callback);
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/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/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/exception/FuncNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(string $message, string $func = '', Throwable $previous = null)
14 14
     {
15 15
         $this->message = $message;
16
-        $this->func   = $func;
16
+        $this->func = $func;
17 17
 
18 18
         parent::__construct($message, 0, $previous);
19 19
     }
Please login to merge, or discard this patch.
tests/ContainerTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         Container::setInstance($container);
65 65
 
66
-        $container->bind('name', function () {
66
+        $container->bind('name', function() {
67 67
             return 'Taylor';
68 68
         });
69 69
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $this->expectExceptionMessage('class not exists: name');
81 81
         $container->get('name');
82 82
 
83
-        $container->bind('name', function () {
83
+        $container->bind('name', function() {
84 84
             return 'Taylor';
85 85
         });
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $container = new Container;
93 93
 
94
-        $container->bind('name', function () {
94
+        $container->bind('name', function() {
95 95
             return 'Taylor';
96 96
         });
97 97
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $container = new Container;
108 108
 
109
-        $container->bind('name', function () {
109
+        $container->bind('name', function() {
110 110
             return 'Taylor';
111 111
         });
112 112
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
         $this->assertSame($object, Container::getInstance());
200 200
 
201
-        Container::setInstance(function () {
201
+        Container::setInstance(function() {
202 202
             return $this;
203 203
         });
204 204
 
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
         $container = new Container();
211 211
         $container->bind(Container::class, $container);
212 212
 
213
-        $container->resolving(function (SomeClass $taylor, Container $container) {
213
+        $container->resolving(function(SomeClass $taylor, Container $container) {
214 214
             $taylor->count++;
215 215
         });
216
-        $container->resolving(SomeClass::class, function (SomeClass $taylor, Container $container) {
216
+        $container->resolving(SomeClass::class, function(SomeClass $taylor, Container $container) {
217 217
             $taylor->count++;
218 218
         });
219 219
 
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
 
253 253
         $this->assertEquals('48', $container->invoke('ord', ['0']));
254 254
 
255
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test', []));
255
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test', []));
256 256
 
257
-        $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test'));
257
+        $this->assertSame($container, $container->invokeMethod(Taylor::class.'::test'));
258 258
 
259 259
         $reflect = new ReflectionMethod($container, 'exists');
260 260
 
261 261
         $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class]));
262 262
 
263
-        $this->assertSame($container, $container->invoke(function (Container $container) {
263
+        $this->assertSame($container, $container->invoke(function(Container $container) {
264 264
             return $container;
265 265
         }));
266 266
 
267
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test'));
267
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test'));
268 268
 
269 269
         $object = $container->invokeClass(SomeClass::class);
270 270
         $this->assertInstanceOf(SomeClass::class, $object);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $stdClass = new stdClass();
274 274
 
275
-        $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
275
+        $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
276 276
             $this->assertEquals('value1', $key1);
277 277
             $this->assertEquals('default', $key2);
278 278
             $this->assertEquals('value2', $lowKey);
Please login to merge, or discard this patch.
tests/CacheTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,10 +126,10 @@
 block discarded – undo
126 126
         $redis->shouldReceive("del")->once()->with('baz')->andReturnTrue();
127 127
         $redis->shouldReceive("flushDB")->once()->andReturnTrue();
128 128
         $redis->shouldReceive("set")->once()->with('bar', serialize('foobar'))->andReturnTrue();
129
-        $redis->shouldReceive("sAdd")->once()->with('tag:' . md5('foo'), 'bar')->andReturnTrue();
130
-        $redis->shouldReceive("sMembers")->once()->with('tag:' . md5('foo'))->andReturn(['bar']);
129
+        $redis->shouldReceive("sAdd")->once()->with('tag:'.md5('foo'), 'bar')->andReturnTrue();
130
+        $redis->shouldReceive("sMembers")->once()->with('tag:'.md5('foo'))->andReturn(['bar']);
131 131
         $redis->shouldReceive("del")->once()->with(['bar'])->andReturnTrue();
132
-        $redis->shouldReceive("del")->once()->with('tag:' . md5('foo'))->andReturnTrue();
132
+        $redis->shouldReceive("del")->once()->with('tag:'.md5('foo'))->andReturnTrue();
133 133
 
134 134
         $this->cache->set('foo', 5);
135 135
         $this->cache->inc('foo');
Please login to merge, or discard this patch.