@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | // +---------------------------------------------------------------------- |
| 7 | 7 | // | Author: zhangyajun <[email protected]> |
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | -declare (strict_types = 1); |
|
| 9 | +declare(strict_types=1); |
|
| 10 | 10 | |
| 11 | 11 | namespace think; |
| 12 | 12 | |
@@ -461,10 +461,10 @@ discard block |
||
| 461 | 461 | public function findNamespace(string $namespace): string |
| 462 | 462 | { |
| 463 | 463 | $allNamespaces = $this->getNamespaces(); |
| 464 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
| 465 | - return preg_quote($matches[1]) . '[^:]*'; |
|
| 464 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
| 465 | + return preg_quote($matches[1]).'[^:]*'; |
|
| 466 | 466 | }, $namespace); |
| 467 | - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
| 467 | + $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
| 468 | 468 | |
| 469 | 469 | if (empty($namespaces)) { |
| 470 | 470 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -501,13 +501,13 @@ discard block |
||
| 501 | 501 | { |
| 502 | 502 | $allCommands = array_keys($this->commands); |
| 503 | 503 | |
| 504 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
| 505 | - return preg_quote($matches[1]) . '[^:]*'; |
|
| 504 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
| 505 | + return preg_quote($matches[1]).'[^:]*'; |
|
| 506 | 506 | }, $name); |
| 507 | 507 | |
| 508 | - $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
| 508 | + $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
| 509 | 509 | |
| 510 | - if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { |
|
| 510 | + if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { |
|
| 511 | 511 | if (false !== $pos = strrpos($name, ':')) { |
| 512 | 512 | $this->findNamespace(substr($name, 0, $pos)); |
| 513 | 513 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { |
|
| 704 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { |
|
| 705 | 705 | return $lev < 2 * $threshold; |
| 706 | 706 | }); |
| 707 | 707 | asort($alternatives); |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | foreach ($parts as $part) { |
| 724 | 724 | if (count($namespaces)) { |
| 725 | - $namespaces[] = end($namespaces) . ':' . $part; |
|
| 725 | + $namespaces[] = end($namespaces).':'.$part; |
|
| 726 | 726 | } else { |
| 727 | 727 | $namespaces[] = $part; |
| 728 | 728 | } |