From e637cce6f26e320c58b1846afb26e3ce93288270 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 31 Oct 2023 01:48:49 +0800 Subject: [PATCH] use prompts to ask --- src/SPC/command/DoctorCommand.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SPC/command/DoctorCommand.php b/src/SPC/command/DoctorCommand.php index b184fa21..9aabdeca 100644 --- a/src/SPC/command/DoctorCommand.php +++ b/src/SPC/command/DoctorCommand.php @@ -8,8 +8,8 @@ use SPC\doctor\CheckListHandler; use SPC\doctor\CheckResult; use SPC\exception\RuntimeException; use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Question\ConfirmationQuestion; + +use function Laravel\Prompts\confirm; #[AsCommand('doctor', 'Diagnose whether the current environment can compile normally')] class DoctorCommand extends BaseCommand @@ -49,9 +49,8 @@ class DoctorCommand extends BaseCommand throw new RuntimeException('Some check items can not be fixed !'); case FIX_POLICY_PROMPT: if ($result->getFixItem() !== '') { - $helper = new QuestionHelper(); - $question = new ConfirmationQuestion('Do you want to fix it? [Y/n] ', true); - if ($helper->ask($this->input, $this->output, $question)) { + $question = confirm('Do you want to fix it?'); + if ($question) { $checker->emitFix($this->output, $result); } else { throw new RuntimeException('You cancelled fix');