8000 minor #9560 Add 2 solutions for the 'option with optional argument' p… · symfony/symfony-docs@8405282 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8405282

Browse files
committed
minor #9560 Add 2 solutions for the 'option with optional argument' problem (Jean85, javiereguiluz)
This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #9560). Discussion ---------- Add 2 solutions for the 'option with optional argument' problem While working on facile-it/paraunit#121, I discovered a tricky case with the Console component: using an option with an optional argument seemed impossible! The doc said: > There is nothing forbidding you to create a command with an option that optionally accepts a value. However, there is no way you can distinguish when the option was used without a value (command --language) or when it wasn't used at all (command). In both cases, the value retrieved for the option will be null. This is NOT TRUE. I've found two possible solutions to this issue (one myself, one in symfony/symfony#11572 (comment)) and this PR introduces them in the docs. I've also moved around the two tips/cautions which were at the end of the article, because with my reword it seemed nicer to me. Commits ------- 7be002b Add 2 solutions for the 'option with optional argument' problem
2 parents dc9ffa0 + 7be002b commit 8405282

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

console/input.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Now check the value of the option and keep in mind that ``false !== null``::
263263

264264
.. caution::
265265

266-
Due to a PHP limitation, passing an empty string is indistinguishable from
266+
Due to a PHP limitation, passing an empty string is indistinguishable from
267267
not passing any value at all. In ``command --prefix`` and ``command --prefix=''``
268268
cases, the value of the ``prefix`` option will be ``null``.
269269

0 commit comments

Comments
 (0)
0