diff --git a/src/StaticPHP/Command/ResetCommand.php b/src/StaticPHP/Command/ResetCommand.php index ee81c82a..ce22e7a9 100644 --- a/src/StaticPHP/Command/ResetCommand.php +++ b/src/StaticPHP/Command/ResetCommand.php @@ -4,10 +4,12 @@ declare(strict_types=1); namespace StaticPHP\Command; +use StaticPHP\Exception\SPCInternalException; use StaticPHP\Runtime\Shell\Shell; use StaticPHP\Util\FileSystem; use StaticPHP\Util\InteractiveTerm; use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Question\ConfirmationQuestion; @@ -46,6 +48,9 @@ class ResetCommand extends BaseCommand // Confirm with user unless --yes is specified if (!$this->input->getOption('yes')) { $helper = $this->getHelper('question'); + if (!$helper instanceof QuestionHelper) { + throw new SPCInternalException('Question helper not provided'); + } if (!$helper->ask($this->input, $this->output, new ConfirmationQuestion('Are you sure you want to continue? [y/N] ', false))) { InteractiveTerm::error(message: 'Reset operation cancelled.'); return static::SUCCESS;