tomzx / php-semver-checker

Compares two source sets and determines the appropriate semantic versioning to apply.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InputMerger not merging options with defaults properly

tomzx opened this issue · comments

It appears that if an option with InputOption::VALUE_NONE is not set, its default value is false. This in turns, mean that when we merge the input into the configuration, the false value overrides whatever value was set for that option.

Edit: After thinking about this issue for a bit, I've realized that this can be generalized to the fact that we will be unable to properly merge the command line options if they have default values other than null since InputMerger relies on them being null by default to decide if they should take the value of the configuration (if any).

Probably comes down to this: How do you disable this on the CLI? Or rather how do you want it to behave?

A way around it could be --path-format <full|relative> with relative as default.

Edit: I mean, since CLI is supposed to have preference, how is it supposed to override a config true?

@nochso But that means that every time we modify a command, we'd have to be aware that InputOption::VALUE_NONE will not work as expected with configuration files. I don't like that.

After looking a bit at Symfony's InputInterface, it doesn't seem like there is any way to tell if an option was set or not since if it is not set, it will return us its default value... See symfony/symfony#8486