@@ -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 @@ |
||
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\cache; |
14 | 14 |
@@ -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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $target = $this->getTargetFile($directory, $name); |
88 | 88 | |
89 | - set_error_handler(function ($type, $msg) use (&$error) { |
|
89 | + set_error_handler(function($type, $msg) use (&$error) { |
|
90 | 90 | $error = $msg; |
91 | 91 | }); |
92 | 92 | $renamed = rename($this->getPathname(), $target); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); |
117 | 117 | } |
118 | 118 | |
119 | - $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); |
|
119 | + $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); |
|
120 | 120 | |
121 | 121 | return new self($target, false); |
122 | 122 | } |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | switch (true) { |
160 | 160 | case in_array($rule, hash_algos()): |
161 | 161 | $hash = $this->hash($rule); |
162 | - $this->hashName = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2); |
|
162 | + $this->hashName = substr($hash, 0, 2).DIRECTORY_SEPARATOR.substr($hash, 2); |
|
163 | 163 | break; |
164 | 164 | case is_callable($rule): |
165 | 165 | $this->hashName = call_user_func($rule); |
166 | 166 | break; |
167 | 167 | default: |
168 | - $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)); |
|
168 | + $this->hashName = date('Ymd').DIRECTORY_SEPARATOR.md5((string) microtime(true)); |
|
169 | 169 | break; |
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | - return $this->hashName . '.' . $this->extension(); |
|
174 | + return $this->hashName.'.'.$this->extension(); |
|
175 | 175 | } |
176 | 176 | } |
@@ -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\route; |
14 | 14 |
@@ -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\route; |
14 | 14 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | { |
603 | 603 | if (is_string($route) && isset($option['prefix'])) { |
604 | 604 | // 路由地址前缀 |
605 | - $route = $option['prefix'] . $route; |
|
605 | + $route = $option['prefix'].$route; |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | // 替换路由地址中的变量 |
@@ -610,10 +610,10 @@ discard block |
||
610 | 610 | $search = $replace = []; |
611 | 611 | |
612 | 612 | foreach ($matches as $key => $value) { |
613 | - $search[] = '<' . $key . '>'; |
|
613 | + $search[] = '<'.$key.'>'; |
|
614 | 614 | $replace[] = $value; |
615 | 615 | |
616 | - $search[] = ':' . $key; |
|
616 | + $search[] = ':'.$key; |
|
617 | 617 | $replace[] = $value; |
618 | 618 | } |
619 | 619 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | // AJAX PJAX 请求检查 |
719 | 719 | foreach (['ajax', 'pjax', 'json'] as $item) { |
720 | 720 | if (isset($option[$item])) { |
721 | - $call = 'is' . $item; |
|
721 | + $call = 'is'.$item; |
|
722 | 722 | if ($option[$item] && !$request->$call() || !$option[$item] && $request->$call()) { |
723 | 723 | return false; |
724 | 724 | } |
@@ -726,8 +726,8 @@ discard block |
||
726 | 726 | } |
727 | 727 | |
728 | 728 | // 伪静态后缀检测 |
729 | - if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|' . $option['ext'] . '|', '|' . $request->ext() . '|')) |
|
730 | - || (isset($option['deny_ext']) && false !== stripos('|' . $option['deny_ext'] . '|', '|' . $request->ext() . '|')))) { |
|
729 | + if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|'.$option['ext'].'|', '|'.$request->ext().'|')) |
|
730 | + || (isset($option['deny_ext']) && false !== stripos('|'.$option['deny_ext'].'|', '|'.$request->ext().'|')))) { |
|
731 | 731 | return false; |
732 | 732 | } |
733 | 733 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | protected function parseUrlParams(string $url, array &$var = []): void |
765 | 765 | { |
766 | 766 | if ($url) { |
767 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
767 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
768 | 768 | $var[$match[1]] = strip_tags($match[2]); |
769 | 769 | }, $url); |
770 | 770 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | $regex .= '\/'; |
827 | 827 | } |
828 | 828 | |
829 | - return $regex . ($completeMatch ? '$' : ''); |
|
829 | + return $regex.($completeMatch ? '$' : ''); |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | /** |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $slash = substr($name, 0, 1); |
844 | 844 | |
845 | 845 | if (in_array($slash, ['/', '-'])) { |
846 | - $prefix = '\\' . $slash; |
|
846 | + $prefix = '\\'.$slash; |
|
847 | 847 | $name = substr($name, 1); |
848 | 848 | $slash = substr($name, 0, 1); |
849 | 849 | } else { |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | if ('<' != $slash) { |
854 | - return $prefix . preg_quote($name, '/'); |
|
854 | + return $prefix.preg_quote($name, '/'); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | if (strpos($name, '?')) { |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $nameRule = $this->router->config('default_route_pattern'); |
871 | 871 | } |
872 | 872 | |
873 | - return '(' . $prefix . '(?<' . $name . $suffix . '>' . $nameRule . '))' . $optional; |
|
873 | + return '('.$prefix.'(?<'.$name.$suffix.'>'.$nameRule.'))'.$optional; |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -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\route; |
14 | 14 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $val = []; |
133 | 133 | |
134 | 134 | foreach (['method', 'rule', 'name', 'route', 'domain', 'pattern', 'option'] as $param) { |
135 | - $call = 'get' . $param; |
|
135 | + $call = 'get'.$param; |
|
136 | 136 | $val[$param] = $item->$call(); |
137 | 137 | } |
138 | 138 |
@@ -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\service; |
14 | 14 | |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | |
31 | 31 | public function boot() |
32 | 32 | { |
33 | - Paginator::maker(function (...$args) { |
|
33 | + Paginator::maker(function(...$args) { |
|
34 | 34 | return $this->app->make(Paginator::class, $args, true); |
35 | 35 | }); |
36 | 36 | |
37 | - Paginator::currentPathResolver(function () { |
|
37 | + Paginator::currentPathResolver(function() { |
|
38 | 38 | return $this->app->request->baseUrl(); |
39 | 39 | }); |
40 | 40 | |
41 | - Paginator::currentPageResolver(function ($varPage = 'page') { |
|
41 | + Paginator::currentPageResolver(function($varPage = 'page') { |
|
42 | 42 | |
43 | 43 | $page = $this->app->request->param($varPage); |
44 | 44 |
@@ -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\service; |
14 | 14 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function boot() |
24 | 24 | { |
25 | - Validate::maker(function (Validate $validate) { |
|
25 | + Validate::maker(function(Validate $validate) { |
|
26 | 26 | $validate->setLang($this->app->lang); |
27 | 27 | $validate->setDb($this->app->db); |
28 | 28 | $validate->setRequest($this->app->request); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | proc_close($process); |
232 | 232 | |
233 | 233 | if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { |
234 | - return $matches[2] . 'x' . $matches[1]; |
|
234 | + return $matches[2].'x'.$matches[1]; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | return; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $lines = []; |
265 | 265 | $line = ''; |
266 | 266 | foreach (preg_split('//u', $utf8String) as $char) { |
267 | - if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
267 | + if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
268 | 268 | $line .= $char; |
269 | 269 | continue; |
270 | 270 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if (null === $stream) { |
341 | 341 | $stream = $this->stdout; |
342 | 342 | } |
343 | - if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) { |
|
343 | + if (false === @fwrite($stream, $message.($newline ? PHP_EOL : ''))) { |
|
344 | 344 | throw new \RuntimeException('Unable to write output.'); |
345 | 345 | } |
346 | 346 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | { |
357 | 357 | if (DIRECTORY_SEPARATOR === '\\') { |
358 | 358 | return |
359 | - '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD |
|
359 | + '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD |
|
360 | 360 | || false !== getenv('ANSICON') |
361 | 361 | || 'ON' === getenv('ConEmuANSI') |
362 | 362 | || 'xterm' === getenv('TERM'); |