Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #17707 Remove InputOption::VALUE_REQUIRED mode from $default pa…
…rameter description (tomasliubinas) This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #17707). Discussion ---------- Remove InputOption::VALUE_REQUIRED mode from $default parameter description Reopening previous PR, providing more information | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Remove InputOption::VALUE_REQUIRED mode from $default parameter description as InputOption::setDefault() throws an exception only when called with InputOption::VALUE_NONE mode. In practice the $default not null value could be still used in VALUE_REQUIRED mode in case InputOption was never set but accessed from InputDefinition::getOption() method. There is an important difference between 2 concepts. Not required Option AND not required option Value. When the not required Option is not provided the default value still could be taken from required option Value instance. Relevant (correct) test case: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php#L136 Commits ------- 3c06151 Remove InputOption::VALUE_REQUIRED mode from $default parameter description as InputOption::setDefault() throws an exception only when called in InputOption::VALUE_NONE mode. In practice the $default value could still be accessed in InputOption::VALUE_REQUIRED mode in case InputOption was never set but accessed from InputDefinition::getOption() method
- Loading branch information