修正命令行hasOption方法

This commit is contained in:
yunwuxin
2016-05-09 18:25:50 +08:00
parent 4600c3179e
commit bd8d09d8e8
2 changed files with 6 additions and 4 deletions

View File

@@ -361,7 +361,7 @@ class Input
}
return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)
->getDefault();
->getDefault();
}
/**
@@ -435,7 +435,7 @@ class Input
*/
public function hasOption($name)
{
return $this->definition->hasOption($name);
return $this->definition->hasOption($name) && isset($this->options[$name]);
}
/**

View File

@@ -24,8 +24,10 @@ class Build extends Command
protected function configure()
{
$this->setName('build')
->setDefinition([new Option('config', null, Option::VALUE_OPTIONAL, "build.php path")])
->setDefinition([new Option('module', null, Option::VALUE_OPTIONAL, "module name")])
->setDefinition([
new Option('config', null, Option::VALUE_OPTIONAL, "build.php path"),
new Option('module', null, Option::VALUE_OPTIONAL, "module name")
])
->setDescription('Build Application Dirs');
}