@@ -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 | |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | public function findNamespace(string $namespace): string |
470 | 470 | { |
471 | 471 | $allNamespaces = $this->getNamespaces(); |
472 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
473 | - return preg_quote($matches[1]) . '[^:]*'; |
|
472 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
473 | + return preg_quote($matches[1]).'[^:]*'; |
|
474 | 474 | }, $namespace); |
475 | - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
475 | + $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
476 | 476 | |
477 | 477 | if (empty($namespaces)) { |
478 | 478 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -509,13 +509,13 @@ discard block |
||
509 | 509 | { |
510 | 510 | $allCommands = array_keys($this->commands); |
511 | 511 | |
512 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
513 | - return preg_quote($matches[1]) . '[^:]*'; |
|
512 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
513 | + return preg_quote($matches[1]).'[^:]*'; |
|
514 | 514 | }, $name); |
515 | 515 | |
516 | - $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
516 | + $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
517 | 517 | |
518 | - if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { |
|
518 | + if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { |
|
519 | 519 | if (false !== $pos = strrpos($name, ':')) { |
520 | 520 | $this->findNamespace(substr($name, 0, $pos)); |
521 | 521 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { |
|
712 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { |
|
713 | 713 | return $lev < 2 * $threshold; |
714 | 714 | }); |
715 | 715 | asort($alternatives); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | foreach ($parts as $part) { |
732 | 732 | if (count($namespaces)) { |
733 | - $namespaces[] = end($namespaces) . ':' . $part; |
|
733 | + $namespaces[] = end($namespaces).':'.$part; |
|
734 | 734 | } else { |
735 | 735 | $namespaces[] = $part; |
736 | 736 | } |