@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | //------------------------ |
14 | 14 | // ThinkPHP 助手函数 |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); |
222 | 222 | |
223 | 223 | if (PHP_SAPI == 'cli') { |
224 | - $output = PHP_EOL . $output . PHP_EOL; |
|
224 | + $output = PHP_EOL.$output.PHP_EOL; |
|
225 | 225 | } else { |
226 | 226 | if (!extension_loaded('xdebug')) { |
227 | 227 | $output = htmlspecialchars($output, ENT_SUBSTITUTE); |
228 | 228 | } |
229 | - $output = '<pre>' . $output . '</pre>'; |
|
229 | + $output = '<pre>'.$output.'</pre>'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | echo $output; |
@@ -305,8 +305,7 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | return isset($has) ? |
308 | - request()->has($key, $method) : |
|
309 | - request()->$method($key, $default, $filter); |
|
308 | + request()->has($key, $method) : request()->$method($key, $default, $filter); |
|
310 | 309 | } |
311 | 310 | } |
312 | 311 | |
@@ -383,7 +382,7 @@ discard block |
||
383 | 382 | function parse_name(string $name, int $type = 0, bool $ucfirst = true): string |
384 | 383 | { |
385 | 384 | if ($type) { |
386 | - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
|
385 | + $name = preg_replace_callback('/_([a-zA-Z])/', function($match) { |
|
387 | 386 | return strtoupper($match[1]); |
388 | 387 | }, $name); |
389 | 388 | |
@@ -488,7 +487,7 @@ discard block |
||
488 | 487 | { |
489 | 488 | $token = Request::buildToken($name, $type); |
490 | 489 | |
491 | - return '<input type="hidden" name="' . $name . '" value="' . $token . '" />'; |
|
490 | + return '<input type="hidden" name="'.$name.'" value="'.$token.'" />'; |
|
492 | 491 | } |
493 | 492 | } |
494 | 493 | |
@@ -503,7 +502,7 @@ discard block |
||
503 | 502 | { |
504 | 503 | $token = Request::buildToken($name, $type); |
505 | 504 | |
506 | - return '<meta name="csrf-token" content="' . $token . '">'; |
|
505 | + return '<meta name="csrf-token" content="'.$token.'">'; |
|
507 | 506 | } |
508 | 507 | } |
509 | 508 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function testConnect($config) |
24 | 24 | { |
25 | - $mysql = m::mock('overload:' . Mysql::class); |
|
25 | + $mysql = m::mock('overload:'.Mysql::class); |
|
26 | 26 | |
27 | 27 | $db = new Db($config); |
28 | 28 | } |
@@ -107,27 +107,27 @@ discard block |
||
107 | 107 | |
108 | 108 | public function testPath() |
109 | 109 | { |
110 | - $rootPath = __DIR__ . DIRECTORY_SEPARATOR; |
|
110 | + $rootPath = __DIR__.DIRECTORY_SEPARATOR; |
|
111 | 111 | |
112 | 112 | $app = new App($rootPath); |
113 | 113 | |
114 | 114 | $this->assertEquals($rootPath, $app->getRootPath()); |
115 | 115 | |
116 | - $this->assertEquals(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR, $app->getThinkPath()); |
|
116 | + $this->assertEquals(dirname(__DIR__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, $app->getThinkPath()); |
|
117 | 117 | |
118 | - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getAppPath()); |
|
118 | + $this->assertEquals($rootPath.'app'.DIRECTORY_SEPARATOR, $app->getAppPath()); |
|
119 | 119 | |
120 | - $appPath = $rootPath . 'app' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; |
|
120 | + $appPath = $rootPath.'app'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR; |
|
121 | 121 | $app->setAppPath($appPath); |
122 | 122 | $this->assertEquals($appPath, $app->getAppPath()); |
123 | 123 | |
124 | - $this->assertEquals($rootPath . 'app' . DIRECTORY_SEPARATOR, $app->getBasePath()); |
|
124 | + $this->assertEquals($rootPath.'app'.DIRECTORY_SEPARATOR, $app->getBasePath()); |
|
125 | 125 | |
126 | - $this->assertEquals($rootPath . 'config' . DIRECTORY_SEPARATOR, $app->getConfigPath()); |
|
126 | + $this->assertEquals($rootPath.'config'.DIRECTORY_SEPARATOR, $app->getConfigPath()); |
|
127 | 127 | |
128 | - $this->assertEquals($rootPath . 'runtime' . DIRECTORY_SEPARATOR, $app->getRuntimePath()); |
|
128 | + $this->assertEquals($rootPath.'runtime'.DIRECTORY_SEPARATOR, $app->getRuntimePath()); |
|
129 | 129 | |
130 | - $runtimePath = $rootPath . 'runtime' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; |
|
130 | + $runtimePath = $rootPath.'runtime'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR; |
|
131 | 131 | $app->setRuntimePath($runtimePath); |
132 | 132 | $this->assertEquals($runtimePath, $app->getRuntimePath()); |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function prepareAppForInitialize(vfsStreamDirectory $root, $debug = true) |
141 | 141 | { |
142 | - $rootPath = $root->url() . DIRECTORY_SEPARATOR; |
|
142 | + $rootPath = $root->url().DIRECTORY_SEPARATOR; |
|
143 | 143 | |
144 | 144 | $app = new App($rootPath); |
145 | 145 | |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | |
149 | 149 | $app->instance($initializer->mockery_getName(), $initializer); |
150 | 150 | |
151 | - (function () use ($initializer) { |
|
151 | + (function() use ($initializer) { |
|
152 | 152 | $this->initializers = [$initializer->mockery_getName()]; |
153 | 153 | })->call($app); |
154 | 154 | |
155 | 155 | $env = m::mock(Env::class); |
156 | - $env->shouldReceive('load')->once()->with($rootPath . '.env'); |
|
156 | + $env->shouldReceive('load')->once()->with($rootPath.'.env'); |
|
157 | 157 | $env->shouldReceive('get')->once()->with('config_ext', '.php')->andReturn('.php'); |
158 | 158 | $env->shouldReceive('get')->once()->with('app_debug')->andReturn($debug); |
159 | 159 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $route = m::mock(Route::class); |
50 | 50 | |
51 | - $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) { |
|
51 | + $route->shouldReceive('dispatch')->withArgs(function($req, $withRoute) use ($request) { |
|
52 | 52 | if ($withRoute) { |
53 | 53 | $withRoute(); |
54 | 54 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | |
81 | 81 | $this->http->multi(false); |
82 | 82 | |
83 | - $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); |
|
84 | - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); |
|
83 | + $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR); |
|
84 | + $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR); |
|
85 | 85 | |
86 | 86 | $request = m::mock(Request::class)->makePartial(); |
87 | 87 | $response = m::mock(Response::class)->makePartial(); |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | $this->app->shouldReceive('get')->with('config')->andReturn($config); |
142 | 142 | |
143 | - $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); |
|
144 | - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); |
|
145 | - $this->app->shouldReceive('getConfigPath')->andReturn($root->getChild('config')->url() . DIRECTORY_SEPARATOR); |
|
143 | + $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR); |
|
144 | + $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR); |
|
145 | + $this->app->shouldReceive('getConfigPath')->andReturn($root->getChild('config')->url().DIRECTORY_SEPARATOR); |
|
146 | 146 | |
147 | 147 | $response = m::mock(Response::class)->makePartial(); |
148 | 148 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->assertTrue($this->http->isBindDomain()); |
175 | 175 | } |
176 | 176 | if ($path) { |
177 | - $this->assertEquals(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $this->app->getAppPath()); |
|
177 | + $this->assertEquals(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $this->app->getAppPath()); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | Container::setInstance($container); |
59 | 59 | |
60 | - $container->bind('name', function () { |
|
60 | + $container->bind('name', function() { |
|
61 | 61 | return 'Taylor'; |
62 | 62 | }); |
63 | 63 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->expectExceptionMessage('class not exists: name'); |
75 | 75 | $container->get('name'); |
76 | 76 | |
77 | - $container->bind('name', function () { |
|
77 | + $container->bind('name', function() { |
|
78 | 78 | return 'Taylor'; |
79 | 79 | }); |
80 | 80 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $container = new Container; |
87 | 87 | |
88 | - $container->bind('name', function () { |
|
88 | + $container->bind('name', function() { |
|
89 | 89 | return 'Taylor'; |
90 | 90 | }); |
91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $container = new Container; |
102 | 102 | |
103 | - $container->bind('name', function () { |
|
103 | + $container->bind('name', function() { |
|
104 | 104 | return 'Taylor'; |
105 | 105 | }); |
106 | 106 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $this->assertSame($object, Container::getInstance()); |
194 | 194 | |
195 | - Container::setInstance(function () { |
|
195 | + Container::setInstance(function() { |
|
196 | 196 | return $this; |
197 | 197 | }); |
198 | 198 | |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | |
222 | 222 | $container->invokeMethod([$stub, 'some']); |
223 | 223 | |
224 | - $this->assertSame($container, $container->invokeMethod(Taylor::class . '::static')); |
|
224 | + $this->assertSame($container, $container->invokeMethod(Taylor::class.'::static')); |
|
225 | 225 | |
226 | 226 | $reflect = new ReflectionMethod($container, 'exists'); |
227 | 227 | |
228 | 228 | $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class])); |
229 | 229 | |
230 | - $this->assertSame($container, $container->invoke(function (Container $container) { |
|
230 | + $this->assertSame($container, $container->invoke(function(Container $container) { |
|
231 | 231 | return $container; |
232 | 232 | })); |
233 | 233 | |
234 | - $this->assertSame($container, $container->invoke(Taylor::class . '::static')); |
|
234 | + $this->assertSame($container, $container->invoke(Taylor::class.'::static')); |
|
235 | 235 | |
236 | 236 | $object = $container->invokeClass(SomeClass::class); |
237 | 237 | $this->assertInstanceOf(SomeClass::class, $object); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $stdClass = new stdClass(); |
241 | 241 | |
242 | - $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) { |
|
242 | + $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) { |
|
243 | 243 | $this->assertEquals('value1', $key1); |
244 | 244 | $this->assertEquals('default', $key2); |
245 | 245 | $this->assertEquals('value2', $lowKey); |
@@ -8,7 +8,7 @@ |
||
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\middleware; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\middleware; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |