<p dir="auto">I'd like to have console option behaving in this way:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#1. The option is not used at all, so don't use any value of it
./app.php command
#2. Use default value of the option
./app.php command --myoption
#3. Use custom value of the option
./app.php command --myoption=myvalue"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span>1. The option is not used at all, so don't use any value of it</span>
./app.php <span class="pl-c1">command</span>
<span class="pl-c"><span class="pl-c">#</span>2. Use default value of the option</span>
./app.php <span class="pl-c1">command</span> --myoption
<span class="pl-c"><span class="pl-c">#</span>3. Use custom value of the option</span>
./app.php <span class="pl-c1">command</span> --myoption=myvalue</pre></div>
<p dir="auto">However, as far as I know, there is currently not a clean way how to do it - because if you define default value for your option, then using <code class="notranslate">$input-&gt;getOption('myoption')</code> you will get the default value even for the case 1. (= even if the option was not passed at all).</p>
<p dir="auto">The real-world use case is that I have an option, that is not always needed,  but when you use it, you need in 95% of cases the same value (smart default), but for the remaining edge cases you must have an ability how to override the default.</p>
<p dir="auto">This was already suggested with some workaround in issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="14755487" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/8135" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/8135/hovercard?comment_id=49789298&amp;comment_type=issue_comment" href="https://github.com/symfony/symfony/issues/8135#issuecomment-49789298">#8135 (comment)</a>, but this issue was primarily about different topic, so I am creating a separate issue for this.</p>
<p dir="auto">This issue was already reported for Twig (<a href="https://github.com/fabpot/Twig/issues/792#issuecomment-7393946">https://github.com/fabpot/Twig/issues/792#issuecomment-7393946</a>), but since other users may be having problems with this:</p>
<p dir="auto">When I render a form using the Twig function <code class="notranslate">form_widget(form)</code> I get:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;An exception has been thrown during the rendering of a template (&quot;Notice: Undefined index: parent ...&quot;"><pre class="notranslate"><code class="notranslate">"An exception has been thrown during the rendering of a template ("Notice: Undefined index: parent ..."
</code></pre></div>
<p dir="auto">This happens because one of the Twig templates for rendering a form tries to access <code class="notranslate">form.parent</code>, which should retrieve the public property <code class="notranslate">FormView::$parent</code>. Instead, it calls <code class="notranslate">FormView::offsetGet('parent')</code>, which results in the above-mentioned exception being thrown. The cause for this misbehavior is a bug in the Twig PHP extension.</p>
<p dir="auto">The solution would be to (temporarily) disable the Twig PHP extension by removing it from the list of extensions in your php.ini file.</p>
<p dir="auto">A question to the maintainer of the Form Component: are unit tests run with <em>and</em> without the Twig PHP extension?</p>