mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-23 03:02:33 +01:00
Fix not provided --output-file argument translated into string instead of null (#4480)
* Fix not provided --output-file argument translated into string instead of null Fixes #4456 * [rector] Fix not provided --output-file argument translated into string instead of null Fixes #4456 * [cs] Fix not provided --output-file argument translated into string instead of null Fixes #4456 Co-authored-by: rector-bot <tomas@getrector.org>
This commit is contained in:
parent
bdf9464d25
commit
d864005904
@ -125,9 +125,9 @@ final class Configuration
|
||||
$this->showProgressBar = $this->canShowProgressBar($input);
|
||||
$this->isCacheDebug = (bool) $input->getOption(Option::CACHE_DEBUG);
|
||||
|
||||
/** @var string $outputFileOption */
|
||||
/** @var string|null $outputFileOption */
|
||||
$outputFileOption = $input->getOption(Option::OPTION_OUTPUT_FILE);
|
||||
$this->outputFile = $outputFileOption !== '' ? (string) $outputFileOption : null;
|
||||
$this->outputFile = $this->sanitizeOutputFileValue($outputFileOption);
|
||||
|
||||
$this->outputFormat = (string) $input->getOption(Option::OPTION_OUTPUT_FORMAT);
|
||||
|
||||
@ -308,6 +308,15 @@ final class Configuration
|
||||
return $input->getOption(Option::OPTION_OUTPUT_FORMAT) !== CheckstyleOutputFormatter::NAME;
|
||||
}
|
||||
|
||||
private function sanitizeOutputFileValue(?string $outputFileOption): ?string
|
||||
{
|
||||
if ($outputFileOption === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $outputFileOption;
|
||||
}
|
||||
|
||||
private function setOnlyRector(string $rector): void
|
||||
{
|
||||
$this->onlyRector = $this->onlyRuleResolver->resolve($rector);
|
||||
|
Loading…
x
Reference in New Issue
Block a user