<p dir="auto">Symfony\Component\Validator\Constraints\All have not protection from send array into it and throw php error.<br>
Also if I try use with<br>
Symfony\Component\Validator\Constraints\Choose(array('',<br>
new Symfony\Component\Validator\Constraints\All()))<br>
This nesting just not working if I send array into it.</p>
<p dir="auto">I've run into a problem while validating date value:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$errors = $validator-&gt;validateValue($date, new Constraints\Date());"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>errors</span> = <span class="pl-s1"><span class="pl-c1">$</span>validator</span>-&gt;<span class="pl-en">validateValue</span>(<span class="pl-s1"><span class="pl-c1">$</span>date</span>, <span class="pl-k">new</span> <span class="pl-v">Constraints</span>\<span class="pl-v">Date</span>());</pre></div>
<p dir="auto">If <code class="notranslate">$date</code> is not a string (or object with __toString() method), code above will throw <code class="notranslate">UnexpectedTypeException</code>.<br>
it's not what I expected to see, but I can understand the reasons laying behind this behaviour.</p>
<p dir="auto">But after further investigation, I've found out that <code class="notranslate">Constraints\Range</code> (and maybe others) in the same situation just adds violation ("This value should be a valid number") without throwing the exception. So what is the correct behaviour for such cases? Should they both throw <code class="notranslate">UnexpectedTypeException</code> or add violation?</p>