@@ -42,7 +42,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | $listener->shouldReceive('onBar')->once()->andReturnFalse(); |
| 86 | 86 | |
| 87 | 87 | $event->listenEvents(['SomeListener::onBar' => [[$listener, 'onBar']]]); |
@@ -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 助手函数 |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); |
| 191 | 191 | |
| 192 | 192 | if (PHP_SAPI == 'cli') { |
| 193 | - $output = PHP_EOL . $output . PHP_EOL; |
|
| 193 | + $output = PHP_EOL.$output.PHP_EOL; |
|
| 194 | 194 | } else { |
| 195 | 195 | if (!extension_loaded('xdebug')) { |
| 196 | 196 | $output = htmlspecialchars($output, ENT_SUBSTITUTE); |
| 197 | 197 | } |
| 198 | - $output = '<pre>' . $output . '</pre>'; |
|
| 198 | + $output = '<pre>'.$output.'</pre>'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | echo $output; |
@@ -274,8 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return isset($has) ? |
| 277 | - request()->has($key, $method) : |
|
| 278 | - request()->$method($key, $default, $filter); |
|
| 277 | + request()->has($key, $method) : request()->$method($key, $default, $filter); |
|
| 279 | 278 | } |
| 280 | 279 | } |
| 281 | 280 | |
@@ -352,7 +351,7 @@ discard block |
||
| 352 | 351 | function parse_name(string $name, int $type = 0, bool $ucfirst = true): string |
| 353 | 352 | { |
| 354 | 353 | if ($type) { |
| 355 | - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
|
| 354 | + $name = preg_replace_callback('/_([a-zA-Z])/', function($match) { |
|
| 356 | 355 | return strtoupper($match[1]); |
| 357 | 356 | }, $name); |
| 358 | 357 | |
@@ -453,7 +452,7 @@ discard block |
||
| 453 | 452 | { |
| 454 | 453 | $token = Request::buildToken($name, $type); |
| 455 | 454 | |
| 456 | - return '<input type="hidden" name="' . $name . '" value="' . $token . '" />'; |
|
| 455 | + return '<input type="hidden" name="'.$name.'" value="'.$token.'" />'; |
|
| 457 | 456 | } |
| 458 | 457 | } |
| 459 | 458 | |
@@ -468,7 +467,7 @@ discard block |
||
| 468 | 467 | { |
| 469 | 468 | $token = Request::buildToken($name, $type); |
| 470 | 469 | |
| 471 | - return '<meta name="csrf-token" content="' . $token . '">'; |
|
| 470 | + return '<meta name="csrf-token" content="'.$token.'">'; |
|
| 472 | 471 | } |
| 473 | 472 | } |
| 474 | 473 | |
@@ -593,7 +592,7 @@ discard block |
||
| 593 | 592 | */ |
| 594 | 593 | function app_path($path = '') |
| 595 | 594 | { |
| 596 | - return app()->getAppPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
| 595 | + return app()->getAppPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
| 597 | 596 | } |
| 598 | 597 | } |
| 599 | 598 | |
@@ -606,7 +605,7 @@ discard block |
||
| 606 | 605 | */ |
| 607 | 606 | function base_path($path = '') |
| 608 | 607 | { |
| 609 | - return app()->getBasePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
| 608 | + return app()->getBasePath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
| 610 | 609 | } |
| 611 | 610 | } |
| 612 | 611 | |
@@ -619,7 +618,7 @@ discard block |
||
| 619 | 618 | */ |
| 620 | 619 | function config_path($path = '') |
| 621 | 620 | { |
| 622 | - return app()->getConfigPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
| 621 | + return app()->getConfigPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
| 623 | 622 | } |
| 624 | 623 | } |
| 625 | 624 | |
@@ -632,7 +631,7 @@ discard block |
||
| 632 | 631 | */ |
| 633 | 632 | function public_path($path = '') |
| 634 | 633 | { |
| 635 | - return app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path); |
|
| 634 | + return app()->getRootPath().'public'.DIRECTORY_SEPARATOR.($path ? ltrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $path); |
|
| 636 | 635 | } |
| 637 | 636 | } |
| 638 | 637 | |
@@ -645,7 +644,7 @@ discard block |
||
| 645 | 644 | */ |
| 646 | 645 | function runtime_path($path = '') |
| 647 | 646 | { |
| 648 | - return app()->getRuntimePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
| 647 | + return app()->getRuntimePath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
| 649 | 648 | } |
| 650 | 649 | } |
| 651 | 650 | |
@@ -658,6 +657,6 @@ discard block |
||
| 658 | 657 | */ |
| 659 | 658 | function root_path($path = '') |
| 660 | 659 | { |
| 661 | - return app()->getRootPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
| 660 | + return app()->getRootPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
| 662 | 661 | } |
| 663 | 662 | } |
@@ -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 | namespace think; |
| 14 | 14 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function getConfig(string $name = null, $default = null) |
| 47 | 47 | { |
| 48 | 48 | if (!is_null($name)) { |
| 49 | - return $this->app->config->get('cache.' . $name, $default); |
|
| 49 | + return $this->app->config->get('cache.'.$name, $default); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | return $this->app->config->get('cache'); |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function getConfig(string $name = null, $default = null) |
| 57 | 57 | { |
| 58 | 58 | if (!is_null($name)) { |
| 59 | - return $this->app->config->get('filesystem.' . $name, $default); |
|
| 59 | + return $this->app->config->get('filesystem.'.$name, $default); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | return $this->app->config->get('filesystem'); |
@@ -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 | namespace think; |
| 14 | 14 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | return $this->make($abstract); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract); |
|
| 133 | + throw new ClassNotFoundException('class not exists: '.$abstract, $abstract); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $reflect = new ReflectionMethod($class, $method); |
| 316 | 316 | } catch (ReflectionException $e) { |
| 317 | 317 | $class = is_object($class) ? get_class($class) : $class; |
| 318 | - throw new FuncNotFoundException('method not exists: ' . $class . '::' . $method . '()', "{$class}::{$method}", $e); |
|
| 318 | + throw new FuncNotFoundException('method not exists: '.$class.'::'.$method.'()', "{$class}::{$method}", $e); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $args = $this->bindParams($reflect, $vars); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | try { |
| 374 | 374 | $reflect = new ReflectionClass($class); |
| 375 | 375 | } catch (ReflectionException $e) { |
| 376 | - throw new ClassNotFoundException('class not exists: ' . $class, $class, $e); |
|
| 376 | + throw new ClassNotFoundException('class not exists: '.$class, $class, $e); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | if ($reflect->hasMethod('__make')) { |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } elseif ($param->isDefaultValueAvailable()) { |
| 453 | 453 | $args[] = $param->getDefaultValue(); |
| 454 | 454 | } else { |
| 455 | - throw new InvalidArgumentException('method param miss:' . $name); |
|
| 455 | + throw new InvalidArgumentException('method param miss:'.$name); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | public static function factory(string $name, string $namespace = '', ...$args) |
| 472 | 472 | { |
| 473 | - $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name); |
|
| 473 | + $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name); |
|
| 474 | 474 | |
| 475 | 475 | return Container::getInstance()->invokeClass($class, $args); |
| 476 | 476 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: 麦当苗儿 <[email protected]> <http://zjzit.cn> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare(strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think; |
| 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\facade; |
| 14 | 14 | |
@@ -8,7 +8,7 @@ |
||
| 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\facade; |
| 14 | 14 | |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | public function pipeline(string $type = 'global') |
| 134 | 134 | { |
| 135 | 135 | return (new Pipeline()) |
| 136 | - ->through(array_map(function ($middleware) { |
|
| 137 | - return function ($request, $next) use ($middleware) { |
|
| 136 | + ->through(array_map(function($middleware) { |
|
| 137 | + return function($request, $next) use ($middleware) { |
|
| 138 | 138 | [$call, $params] = $middleware; |
| 139 | 139 | if (is_array($call) && is_string($call[0])) { |
| 140 | 140 | $call = [$this->app->make($call[0]), $call[1]]; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | protected function sortMiddleware(array $middlewares) |
| 230 | 230 | { |
| 231 | 231 | $priority = $this->app->config->get('middleware.priority', []); |
| 232 | - uasort($middlewares, function ($a, $b) use ($priority) { |
|
| 232 | + uasort($middlewares, function($a, $b) use ($priority) { |
|
| 233 | 233 | $aPriority = $this->getMiddlewarePriority($priority, $a); |
| 234 | 234 | $bPriority = $this->getMiddlewarePriority($priority, $b); |
| 235 | 235 | return $bPriority - $aPriority; |