diff --git a/library/think/Console.php b/library/think/Console.php index d0b86193..d0388864 100644 --- a/library/think/Console.php +++ b/library/think/Console.php @@ -16,7 +16,7 @@ use think\console\helper\Formatter as FormatterHelper; use think\console\helper\Process as ProcessHelper; use think\console\helper\Question as QuestionHelper; use think\console\helper\Set as HelperSet; -use think\console\Input as ConsoleInput; +use think\console\Input; use think\console\input\Argument as InputArgument; use think\console\input\Definition as InputDefinition; use think\console\input\Option as InputOption; @@ -102,7 +102,7 @@ class Console array_unshift($parameters, $command); - $input = new ConsoleInput($parameters); + $input = new Input($parameters); $console->find($command)->run($input, new Nothing()); } @@ -115,7 +115,7 @@ class Console */ public function run() { - $input = new ConsoleInput(); + $input = new Input(); $output = new Output(); $this->configureIO($input, $output); @@ -153,11 +153,11 @@ class Console /** * 执行指令 - * @param ConsoleInput $input + * @param Input $input * @param Output $output * @return int */ - public function doRun(ConsoleInput $input, Output $output) + public function doRun(Input $input, Output $output) { if (true === $input->hasParameterOption(['--version', '-V'])) { $output->writeln($this->getLongVersion()); @@ -170,7 +170,7 @@ class Console if (true === $input->hasParameterOption(['--help', '-h'])) { if (!$name) { $name = 'help'; - $input = new ConsoleInput(['help']); + $input = new Input(['help']); } else { $this->wantHelps = true; } @@ -178,7 +178,7 @@ class Console if (!$name) { $name = $this->defaultCommand; - $input = new ConsoleInput([$this->defaultCommand]); + $input = new Input([$this->defaultCommand]); } $command = $this->find($name); @@ -681,10 +681,10 @@ class Console /** * 配置基于用户的参数和选项的输入和输出实例。 - * @param ConsoleInput $input 输入实例 + * @param Input $input 输入实例 * @param Output $output 输出实例 */ - protected function configureIO(ConsoleInput $input, Output $output) + protected function configureIO(Input $input, Output $output) { if (true === $input->hasParameterOption(['--ansi'])) { $output->setDecorated(true); @@ -717,22 +717,22 @@ class Console /** * 执行指令 * @param Command $command 指令实例 - * @param ConsoleInput $input 输入实例 + * @param Input $input 输入实例 * @param Output $output 输出实例 * @return int * @throws \Exception */ - protected function doRunCommand(Command $command, ConsoleInput $input, Output $output) + protected function doRunCommand(Command $command, Input $input, Output $output) { return $command->run($input, $output); } /** * 获取指令的基础名称 - * @param ConsoleInput $input + * @param Input $input * @return string */ - protected function getCommandName(ConsoleInput $input) + protected function getCommandName(Input $input) { return $input->getFirstArgument(); } diff --git a/library/think/console/command/make/Controller.php b/library/think/console/command/make/Controller.php index 318fbcd9..08a792a2 100644 --- a/library/think/console/command/make/Controller.php +++ b/library/think/console/command/make/Controller.php @@ -11,12 +11,13 @@ namespace think\console\command\make; +use think\console\command\Make; use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; -class Controller extends \think\console\command\Make +class Controller extends Make { /** * {@inheritdoc} diff --git a/library/think/console/command/make/File.php b/library/think/console/command/make/File.php index 146e0b51..9b3b9b5f 100644 --- a/library/think/console/command/make/File.php +++ b/library/think/console/command/make/File.php @@ -11,12 +11,13 @@ namespace think\console\command\make; +use think\console\command\Make; use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; -class File extends \think\console\command\Make +class File extends Make { /** * {@inheritdoc} diff --git a/library/think/console/command/make/Model.php b/library/think/console/command/make/Model.php index e6e9afd1..7c7831aa 100644 --- a/library/think/console/command/make/Model.php +++ b/library/think/console/command/make/Model.php @@ -11,12 +11,13 @@ namespace think\console\command\make; +use think\console\command\Make; use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; -class Model extends \think\console\command\Make +class Model extends Make { /** * {@inheritdoc} diff --git a/library/think/console/output/Stream.php b/library/think/console/output/Stream.php index b97b582e..fec94bdf 100644 --- a/library/think/console/output/Stream.php +++ b/library/think/console/output/Stream.php @@ -32,6 +32,8 @@ class Stream /** * 构造方法 + * @param $stream + * @param Formatter $formatter */ public function __construct($stream, Formatter $formatter = null) { @@ -180,8 +182,12 @@ class Stream */ protected function hasColorSupport() { - if (DIRECTORY_SEPARATOR == '\\') { - return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + if (DIRECTORY_SEPARATOR === '\\') { + return + 0 >= version_compare('10.0.10586', PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD) + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); } return function_exists('posix_isatty') && @posix_isatty($this->stream);