Skip to content

Commit b3666a6

Browse files
committed
[Configuration] Make --only to force clear cache to ensure next normal run strat from fresh state
1 parent b31f801 commit b3666a6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Configuration/ConfigurationFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ public function createFromInput(InputInterface $input): Configuration
5454
$isDryRun = (bool) $input->getOption(Option::DRY_RUN);
5555
$shouldClearCache = (bool) $input->getOption(Option::CLEAR_CACHE);
5656

57+
if (! $shouldClearCache) {
58+
// hasOption() always returns true
59+
// so we use getOption() instead
60+
$onlyRule = $input->getOption(Option::ONLY);
61+
// when --only used, clear cache to ensure next normal run start from fresh state
62+
if ($onlyRule !== null) {
63+
$shouldClearCache = true;
64+
}
65+
}
66+
5767
$outputFormat = (string) $input->getOption(Option::OUTPUT_FORMAT);
5868
$showProgressBar = $this->shouldShowProgressBar($input, $outputFormat);
5969

0 commit comments

Comments
 (0)