Skip to content

Commit b8ff914

Browse files
authored
fix: use choice instead of confirmation question (#380)
1 parent 9df0777 commit b8ff914

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/FilesGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use PhpCsFixer\RuleSet\RuleSet;
2626
use PhpCsFixer\Runner\Runner;
2727
use Psr\Log\LoggerAwareTrait;
28-
use Symfony\Component\Console\Question\ConfirmationQuestion;
28+
use Symfony\Component\Console\Question\ChoiceQuestion;
2929
use Symfony\Component\Console\Style\SymfonyStyle;
3030
use Symfony\Component\Filesystem\Filesystem;
3131
use Symfony\Component\String\Inflector\InflectorInterface;
@@ -69,8 +69,8 @@ public function generate(array $classes, array $config): void
6969

7070
$file = null;
7171
if (file_exists($path) && is_file($path) && is_readable($path) && $fileContent = file_get_contents($path)) {
72-
$confirmation = $this->io->askQuestion(new ConfirmationQuestion(sprintf('File "%s" already exists, use it (if no it will be overwritten)?', $path)));
73-
if ($confirmation) {
72+
$choice = $this->io->askQuestion(new ChoiceQuestion(sprintf('File "%s" already exists, keep your changes and update it (use) or overwrite it (overwrite)?', $path), ['use', 'overwrite'], 0));
73+
if ('use' === $choice) {
7474
$file = PhpFile::fromCode($fileContent);
7575
$this->logger ? $this->logger->info(sprintf('Using "%s" as base file.', $path)) : null;
7676
}

0 commit comments

Comments
 (0)