<p dir="auto">Normalizer gets executed for optional parameters when it is not passed.</p>
<p dir="auto">This can cause several issues, eg.: Have an optional array option, and you want to do some normalization (filter out values, etc). Now I need to check in the normalizer closure, whether an array is passed and return an empty array if not, or I get an excpetion of invalid type.</p>
<p dir="auto">So I think normalizers SHOULD NOT be executed on not passed optional options.</p>
<p dir="auto">See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="9061680" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/6215" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/6215/hovercard" href="https://github.com/symfony/symfony/issues/6215">#6215</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="9093183" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/6233" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/6233/hovercard" href="https://github.com/symfony/symfony/pull/6233">#6233</a>.</p>
<p dir="auto">When running</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$resolver-&gt;setOptional(array('foo'));
$resolver-&gt;setNormalizers(array(
    'foo' =&gt; function (Options $options, $previousValue) {
        return doSomethingWith($previousValue);
    },
));

$options = $resolver-&gt;resolve(array());"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>resolver</span>-&gt;<span class="pl-en">setOptional</span>(<span class="pl-en">array</span>(<span class="pl-s">'foo'</span>));
<span class="pl-s1"><span class="pl-c1">$</span>resolver</span>-&gt;<span class="pl-en">setNormalizers</span>(<span class="pl-en">array</span>(
    <span class="pl-s">'foo'</span> =&gt; <span class="pl-k">function</span> (<span class="pl-smi"><span class="pl-smi">Options</span></span> <span class="pl-s1"><span class="pl-c1">$</span>options</span>, <span class="pl-s1"><span class="pl-c1">$</span>previousValue</span>) {
        <span class="pl-k">return</span> doSomethingWith(<span class="pl-s1"><span class="pl-c1">$</span>previousValue</span>);
    },
));

<span class="pl-s1"><span class="pl-c1">$</span>options</span> = <span class="pl-s1"><span class="pl-c1">$</span>resolver</span>-&gt;<span class="pl-en">resolve</span>(<span class="pl-en">array</span>());</pre></div>
<p dir="auto">then the normalizer is currently executed even though the option is missing. Since there is a test that asserts this behavior, we can't change it without breaking BC.</p>
<p dir="auto">In Symfony 3.0, normalizers should not be executed for missing options.</p>