From b3666a60a720186b7ff0b42eb5236f5dc5d4fc4a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 20 Nov 2025 01:49:15 +0700 Subject: [PATCH] [Configuration] Make --only to force clear cache to ensure next normal run strat from fresh state --- src/Configuration/ConfigurationFactory.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index ee256294bcb..1b4bf9d1254 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -54,6 +54,16 @@ public function createFromInput(InputInterface $input): Configuration $isDryRun = (bool) $input->getOption(Option::DRY_RUN); $shouldClearCache = (bool) $input->getOption(Option::CLEAR_CACHE); + if (! $shouldClearCache) { + // hasOption() always returns true + // so we use getOption() instead + $onlyRule = $input->getOption(Option::ONLY); + // when --only used, clear cache to ensure next normal run start from fresh state + if ($onlyRule !== null) { + $shouldClearCache = true; + } + } + $outputFormat = (string) $input->getOption(Option::OUTPUT_FORMAT); $showProgressBar = $this->shouldShowProgressBar($input, $outputFormat);