@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
30 | - * @param $className |
|
30 | + * @param string $className |
|
31 | 31 | * @throws \Exception |
32 | 32 | */ |
33 | 33 | public function loadCommandsFromClass($className) |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use PhpBoot\Console\ConsoleContainer; |
12 | 12 | use PhpBoot\Console\ConsoleContainerBuilder; |
13 | 13 | use PhpBoot\DI\Traits\EnableDIAnnotations; |
14 | -use Symfony\Component\Console\Command\Command; |
|
15 | 14 | use Symfony\Component\Console\Input\InputInterface; |
16 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
17 | 16 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $container = $this->consoleContainerBuilder->build($className); |
39 | 39 | /**@var ConsoleContainer $container*/ |
40 | 40 | foreach ($container->getCommands() as $name => $command) { |
41 | - $command->setCode(function (InputInterface $input, OutputInterface $output)use ($container, $command){ |
|
41 | + $command->setCode(function(InputInterface $input, OutputInterface $output)use ($container, $command){ |
|
42 | 42 | return $command->invoke($container, $input, $output); |
43 | 43 | }); |
44 | 44 | $this->add($command); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $dir = @dir($fromPath) or abort("dir $fromPath not exist"); |
56 | 56 | |
57 | - $getEach = function () use ($dir) { |
|
57 | + $getEach = function() use ($dir) { |
|
58 | 58 | $name = $dir->read(); |
59 | 59 | if (!$name) { |
60 | 60 | return $name; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | if ($entry == '.' || $entry == '..') { |
67 | 67 | continue; |
68 | 68 | } |
69 | - $path = $fromPath . '/' . str_replace('\\', '/', $entry); |
|
69 | + $path = $fromPath.'/'.str_replace('\\', '/', $entry); |
|
70 | 70 | if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) { |
71 | - $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4); |
|
71 | + $class_name = $namespace.'\\'.substr($entry, 0, strlen($entry) - 4); |
|
72 | 72 | $this->loadCommandsFromClass($class_name); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | //\Log::debug($path.' ignored'); |
75 | 75 | } |
76 | 76 | } |
@@ -2,17 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace PhpBoot\Console\Annotations; |
4 | 4 | |
5 | -use DI\InvokerInterface; |
|
6 | -use FastRoute\RouteParser\Std; |
|
7 | 5 | use PhpBoot\Console\Command; |
8 | 6 | use PhpBoot\Console\ConsoleContainer; |
9 | 7 | use PhpBoot\Entity\ContainerFactory; |
10 | 8 | use PhpBoot\Entity\EntityContainerBuilder; |
11 | -use PhpBoot\Metas\ReturnMeta; |
|
12 | -use PhpBoot\Annotation\AnnotationBlock; |
|
13 | -use PhpBoot\Annotation\AnnotationTag; |
|
14 | -use PhpBoot\Entity\MixedTypeContainer; |
|
15 | -use PhpBoot\Exceptions\AnnotationSyntaxException; |
|
16 | 9 | use PhpBoot\Metas\ParamMeta; |
17 | 10 | use PhpBoot\Utils\AnnotationParams; |
18 | 11 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $name = $params->getParam(0, $target); |
26 | 26 | |
27 | 27 | //获取方法参数信息 |
28 | - $rfl = new \ReflectionClass($container->getClassName()); |
|
28 | + $rfl = new \ReflectionClass($container->getClassName()); |
|
29 | 29 | $method = $rfl->getMethod($target); |
30 | 30 | $methodParams = $method->getParameters(); |
31 | 31 | |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | //设置参数列表 |
37 | 37 | $paramsMeta = []; |
38 | - foreach ($methodParams as $param){ |
|
38 | + foreach ($methodParams as $param) { |
|
39 | 39 | $paramName = $param->getName(); |
40 | 40 | $source = "argv.$paramName"; |
41 | 41 | $paramClass = $param->getClass(); |
42 | - if($paramClass){ |
|
42 | + if ($paramClass) { |
|
43 | 43 | $paramClass = $paramClass->getName(); |
44 | 44 | } |
45 | 45 | $entityContainer = ContainerFactory::create($entityBuilder, $paramClass); |
46 | 46 | $meta = new ParamMeta($paramName, |
47 | 47 | $source, |
48 | - $paramClass?:'mixed', |
|
48 | + $paramClass ?: 'mixed', |
|
49 | 49 | $param->isOptional(), |
50 | - $param->isOptional()?$param->getDefaultValue():null, |
|
50 | + $param->isOptional() ? $param->getDefaultValue() : null, |
|
51 | 51 | $param->isPassedByReference(), |
52 | 52 | null, |
53 | 53 | '', |
@@ -64,6 +64,9 @@ |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | + /** |
|
68 | + * @param string|null $name |
|
69 | + */ |
|
67 | 70 | public function getParamMeta($name) |
68 | 71 | { |
69 | 72 | foreach ($this->paramMetas as $meta){ |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct($actionName, $name) |
36 | 36 | { |
37 | - parent::__construct($name?:$actionName); |
|
37 | + parent::__construct($name ?: $actionName); |
|
38 | 38 | $this->actionName = $actionName; |
39 | 39 | } |
40 | 40 | /** |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | |
48 | 48 | public function postCreate(ConsoleContainer $container) |
49 | 49 | { |
50 | - if($container->getModuleName()){ |
|
50 | + if ($container->getModuleName()) { |
|
51 | 51 | $this->setName($container->getModuleName().'.'.$this->getName()); |
52 | 52 | } |
53 | 53 | |
54 | - foreach ($this->paramMetas as $paramMeta){ |
|
55 | - $mode = $paramMeta->isOptional?InputArgument::OPTIONAL:InputArgument::REQUIRED; |
|
56 | - if($paramMeta->container instanceof ArrayContainer || $paramMeta->container instanceof EntityContainer){ |
|
57 | - $mode = $mode|InputArgument::IS_ARRAY; |
|
54 | + foreach ($this->paramMetas as $paramMeta) { |
|
55 | + $mode = $paramMeta->isOptional ?InputArgument::OPTIONAL : InputArgument::REQUIRED; |
|
56 | + if ($paramMeta->container instanceof ArrayContainer || $paramMeta->container instanceof EntityContainer) { |
|
57 | + $mode = $mode | InputArgument::IS_ARRAY; |
|
58 | 58 | } |
59 | 59 | $this->addArgument($paramMeta->name, |
60 | 60 | $mode, |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | public function getParamMeta($name) |
68 | 68 | { |
69 | - foreach ($this->paramMetas as $meta){ |
|
70 | - if($meta->name == $name){ |
|
69 | + foreach ($this->paramMetas as $meta) { |
|
70 | + if ($meta->name == $name) { |
|
71 | 71 | return $meta; |
72 | 72 | } |
73 | 73 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $params = []; |
80 | 80 | $reference = []; |
81 | - $this->bindInput($input, $params,$reference); |
|
81 | + $this->bindInput($input, $params, $reference); |
|
82 | 82 | ob_start(); |
83 | 83 | $code = call_user_func_array([$container->getInstance(), $this->actionName], $params); |
84 | 84 | $out = ob_get_contents(); |
@@ -87,31 +87,31 @@ discard block |
||
87 | 87 | return $code; |
88 | 88 | } |
89 | 89 | |
90 | - public function bindInput(InputInterface $input, array &$params, array &$reference){ |
|
90 | + public function bindInput(InputInterface $input, array &$params, array &$reference) { |
|
91 | 91 | $vld = new Validator(); |
92 | 92 | $req = ['argv'=>$input->getArguments()]; |
93 | 93 | $requestArray = new ArrayAdaptor($req); |
94 | 94 | $inputs = []; |
95 | - foreach ($this->paramMetas as $k=>$meta){ |
|
96 | - if($meta->isPassedByReference){ |
|
95 | + foreach ($this->paramMetas as $k=>$meta) { |
|
96 | + if ($meta->isPassedByReference) { |
|
97 | 97 | // param PassedByReference is used to output |
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | $source = \JmesPath\search($meta->source, $requestArray); |
101 | - if ($source !== null){ |
|
101 | + if ($source !== null) { |
|
102 | 102 | $source = ArrayAdaptor::strip($source); |
103 | - if($source instanceof ParameterBag){ |
|
103 | + if ($source instanceof ParameterBag) { |
|
104 | 104 | $source = $source->all(); |
105 | 105 | } |
106 | - if($meta->container){ |
|
106 | + if ($meta->container) { |
|
107 | 107 | $inputs[$meta->name] = $meta->container->make($source); |
108 | - }else{ |
|
108 | + }else { |
|
109 | 109 | $inputs[$meta->name] = $source; |
110 | 110 | } |
111 | - if($meta->validation){ |
|
111 | + if ($meta->validation) { |
|
112 | 112 | $vld->rule($meta->validation, $meta->name); |
113 | 113 | } |
114 | - }else{ |
|
114 | + }else { |
|
115 | 115 | $meta->isOptional or \PhpBoot\abort(new \InvalidArgumentException("the parameter \"{$meta->source}\" is missing")); |
116 | 116 | $inputs[$meta->name] = $meta->default; |
117 | 117 | } |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | ); |
128 | 128 | |
129 | 129 | $pos = 0; |
130 | - foreach ($this->paramMetas as $meta){ |
|
131 | - if($meta->isPassedByReference){ |
|
130 | + foreach ($this->paramMetas as $meta) { |
|
131 | + if ($meta->isPassedByReference) { |
|
132 | 132 | $params[$pos] = null; |
133 | - }else{ |
|
133 | + }else { |
|
134 | 134 | $params[$pos] = $inputs[$meta->name]; |
135 | 135 | } |
136 | 136 | $pos++; |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | } |
106 | 106 | if($meta->container){ |
107 | 107 | $inputs[$meta->name] = $meta->container->make($source); |
108 | - }else{ |
|
108 | + } else{ |
|
109 | 109 | $inputs[$meta->name] = $source; |
110 | 110 | } |
111 | 111 | if($meta->validation){ |
112 | 112 | $vld->rule($meta->validation, $meta->name); |
113 | 113 | } |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | $meta->isOptional or \PhpBoot\abort(new \InvalidArgumentException("the parameter \"{$meta->source}\" is missing")); |
116 | 116 | $inputs[$meta->name] = $meta->default; |
117 | 117 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | foreach ($this->paramMetas as $meta){ |
131 | 131 | if($meta->isPassedByReference){ |
132 | 132 | $params[$pos] = null; |
133 | - }else{ |
|
133 | + } else{ |
|
134 | 134 | $params[$pos] = $inputs[$meta->name]; |
135 | 135 | } |
136 | 136 | $pos++; |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | //TODO【重要】 使用全局的缓存版本号, 而不是针对每个文件判断缓存过期与否 |
42 | 42 | $rfl = new \ReflectionClass($className) or \PhpBoot\abort("load class $className failed"); |
43 | 43 | $fileName = $rfl->getFileName(); |
44 | - $key = str_replace('\\','.',get_class($this)).md5(serialize($this->annotations).$fileName.$className); |
|
44 | + $key = str_replace('\\', '.', get_class($this)).md5(serialize($this->annotations).$fileName.$className); |
|
45 | 45 | $cache = new CheckableCache($this->cache); |
46 | 46 | $res = $cache->get($key, $this); |
47 | - if($res === $this){ |
|
48 | - try{ |
|
47 | + if ($res === $this) { |
|
48 | + try { |
|
49 | 49 | $meta = $this->buildWithoutCache($className); |
50 | - $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null); |
|
50 | + $cache->set($key, $meta, 0, $fileName ? new ClassModifiedChecker($className) : null); |
|
51 | 51 | return $meta; |
52 | - }catch (\Exception $e){ |
|
52 | + }catch (\Exception $e) { |
|
53 | 53 | Logger::warning(__METHOD__.' failed with '.$e->getMessage()); |
54 | - $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null); |
|
54 | + $cache->set($key, $e->getMessage(), 0, $fileName ? new ClassModifiedChecker($className) : null); |
|
55 | 55 | throw $e; |
56 | 56 | } |
57 | - }elseif(is_string($res)){ |
|
57 | + }elseif (is_string($res)) { |
|
58 | 58 | \PhpBoot\abort($res); |
59 | - }else{ |
|
59 | + }else { |
|
60 | 60 | return $res; |
61 | 61 | } |
62 | 62 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | |
73 | 73 | } |
74 | - protected function handleAnnotation($handlerName, $container, $ann){ |
|
74 | + protected function handleAnnotation($handlerName, $container, $ann) { |
|
75 | 75 | $handler = new $handlerName(); |
76 | 76 | return $handler($container, $ann); |
77 | 77 | } |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | { |
84 | 84 | $container = $this->createContainer($className); |
85 | 85 | $anns = AnnotationReader::read($className, $this->cache); |
86 | - foreach ($this->annotations as $i){ |
|
86 | + foreach ($this->annotations as $i) { |
|
87 | 87 | list($class, $target) = $i; |
88 | 88 | |
89 | 89 | $found = \JmesPath\search($target, $anns); |
90 | - if(is_array($found)){ |
|
91 | - foreach ($found as $f){ |
|
92 | - $this->handleAnnotation($class, $container,$f); //TODO 支持 |
|
90 | + if (is_array($found)) { |
|
91 | + foreach ($found as $f) { |
|
92 | + $this->handleAnnotation($class, $container, $f); //TODO 支持 |
|
93 | 93 | } |
94 | - }else{ |
|
94 | + }else { |
|
95 | 95 | $this->handleAnnotation($class, $container, $found); |
96 | 96 | } |
97 | 97 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @var array |
104 | 104 | */ |
105 | - private $annotations=[]; |
|
105 | + private $annotations = []; |
|
106 | 106 | /** |
107 | 107 | * @var Cache |
108 | 108 | */ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | class ConsoleContainerBuilder extends ContainerBuilder |
23 | 23 | { |
24 | - static $DEFAULT_ANNOTATIONS=[ |
|
24 | + static $DEFAULT_ANNOTATIONS = [ |
|
25 | 25 | [ClassAnnotationHandler::class, 'class'], |
26 | 26 | [CommandNameAnnotationHandler::class, "class.children[?name=='command']"], |
27 | 27 | [CommandAnnotationHandler::class, "methods.*.children[?name=='command'][]"], |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | array $annotations = null |
44 | 44 | ) |
45 | 45 | { |
46 | - if($annotations){ |
|
46 | + if ($annotations) { |
|
47 | 47 | parent::__construct($annotations, $cache); |
48 | - }else{ |
|
48 | + }else { |
|
49 | 49 | parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache); |
50 | 50 | } |
51 | 51 | $this->factory = $factory; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | { |
37 | 37 | if($annotations){ |
38 | 38 | parent::__construct($annotations, $cache); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache); |
41 | 41 | } |
42 | 42 | $this->factory = $factory; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function getCommand($target) |
65 | 65 | { |
66 | - return isset($this->commands[$target])?$this->commands[$target]:null; |
|
66 | + return isset($this->commands[$target]) ? $this->commands[$target] : null; |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * @return string |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | public function postCreate() |
104 | 104 | { |
105 | - foreach ($this->commands as $command){ |
|
105 | + foreach ($this->commands as $command) { |
|
106 | 106 | $command->postCreate($this); |
107 | 107 | } |
108 | 108 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getInstance() |
120 | 120 | { |
121 | - if(!$this->instance ){ |
|
122 | - $this->instance = $this->factory->make($this->getClassName()); |
|
121 | + if (!$this->instance) { |
|
122 | + $this->instance = $this->factory->make($this->getClassName()); |
|
123 | 123 | } |
124 | 124 | return $this->instance; |
125 | 125 | } |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $paramType = null; |
23 | 23 | $paramName = null; |
24 | 24 | $paramDoc = ''; |
25 | - if(substr($text, 0, 1) == '$'){ //带$前缀的是变量 |
|
25 | + if (substr($text, 0, 1) == '$') { //带$前缀的是变量 |
|
26 | 26 | $params = new AnnotationParams($text, 2); |
27 | 27 | $paramName = substr($params->getParam(0), 1); |
28 | 28 | $paramDoc = $params->getRawParam(1, ''); |
29 | - }else{ |
|
29 | + }else { |
|
30 | 30 | $params = new AnnotationParams($text, 3); |
31 | - if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){ |
|
31 | + if ($params->count()>=2 && substr($params->getParam(1), 0, 1) == '$') { |
|
32 | 32 | $paramType = $params->getParam(0); //TODO 检测类型是否合法 |
33 | 33 | $paramName = substr($params->getParam(1), 1); |
34 | 34 | $paramDoc = $params->getRawParam(2, ''); |
35 | - }else{ |
|
35 | + }else { |
|
36 | 36 | \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error")); |
37 | 37 | } |
38 | 38 | } |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function __invoke(ConsoleContainer $container, $ann, EntityContainerBuilder $entityBuilder) |
47 | 47 | { |
48 | - if(!$ann->parent){ |
|
48 | + if (!$ann->parent) { |
|
49 | 49 | //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route"); |
50 | 50 | return; |
51 | 51 | } |
52 | 52 | $target = $ann->parent->name; |
53 | 53 | $command = $container->getCommand($target); |
54 | - if(!$command){ |
|
54 | + if (!$command) { |
|
55 | 55 | //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route"); |
56 | - return ; |
|
56 | + return; |
|
57 | 57 | } |
58 | 58 | $className = $container->getClassName(); |
59 | 59 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $paramMeta = $command->getParamMeta($paramName); |
63 | 63 | $paramMeta or \PhpBoot\abort(new AnnotationSyntaxException("$className::$target param $paramName not exist ")); |
64 | 64 | //TODO 检测声明的类型和注释的类型是否匹配 |
65 | - if($paramType){ |
|
66 | - $paramMeta->type = TypeHint::normalize($paramType, $className);//or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType ")); |
|
65 | + if ($paramType) { |
|
66 | + $paramMeta->type = TypeHint::normalize($paramType, $className); //or \PhpBoot\abort(new AnnotationSyntaxException("{$container->getClassName()}::{$ann->parent->name} @{$ann->name} syntax error, param $paramName unknown type:$paramType ")); |
|
67 | 67 | $container = ContainerFactory::create($entityBuilder, $paramMeta->type); |
68 | 68 | $paramMeta->container = $container; |
69 | 69 | } |
@@ -25,13 +25,13 @@ |
||
25 | 25 | $params = new AnnotationParams($text, 2); |
26 | 26 | $paramName = substr($params->getParam(0), 1); |
27 | 27 | $paramDoc = $params->getRawParam(1, ''); |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $params = new AnnotationParams($text, 3); |
30 | 30 | if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){ |
31 | 31 | $paramType = $params->getParam(0); //TODO 检测类型是否合法 |
32 | 32 | $paramName = substr($params->getParam(1), 1); |
33 | 33 | $paramDoc = $params->getRawParam(2, ''); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error")); |
36 | 36 | } |
37 | 37 | } |
@@ -18,29 +18,29 @@ |
||
18 | 18 | */ |
19 | 19 | public function __invoke(ConsoleContainer $container, $ann) |
20 | 20 | { |
21 | - if(!$ann->parent || !$ann->parent->parent){ |
|
21 | + if (!$ann->parent || !$ann->parent->parent) { |
|
22 | 22 | Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent parent"); |
23 | 23 | return; |
24 | 24 | } |
25 | 25 | $target = $ann->parent->parent->name; |
26 | 26 | $command = $container->getCommand($target); |
27 | - if(!$command){ |
|
27 | + if (!$command) { |
|
28 | 28 | Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent parent"); |
29 | - return ; |
|
29 | + return; |
|
30 | 30 | } |
31 | 31 | $params = new AnnotationParams($ann->description, 2); |
32 | 32 | |
33 | 33 | count($params)>0 or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target require 1 param, {$params->count()} given")); |
34 | 34 | |
35 | - if($ann->parent->name == 'param'){ |
|
35 | + if ($ann->parent->name == 'param') { |
|
36 | 36 | list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description); |
37 | 37 | |
38 | 38 | $paramMeta = $command->getParamMeta($paramName); |
39 | - if($params->count()>1){ |
|
39 | + if ($params->count()>1) { |
|
40 | 40 | $paramMeta->validation = [$params[0], $params[1]]; |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | $paramMeta->validation = $params[0]; |
43 | - if($paramMeta->validation) { |
|
43 | + if ($paramMeta->validation) { |
|
44 | 44 | $v = new Validator(); |
45 | 45 | $v->rule($paramMeta->validation, $paramMeta->name); |
46 | 46 | if ($v->hasRule('optional', $paramMeta->name)) { |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $paramMeta = $command->getParamMeta($paramName); |
39 | 39 | if($params->count()>1){ |
40 | 40 | $paramMeta->validation = [$params[0], $params[1]]; |
41 | - }else{ |
|
41 | + } else{ |
|
42 | 42 | $paramMeta->validation = $params[0]; |
43 | 43 | if($paramMeta->validation) { |
44 | 44 | $v = new Validator(); |