<p dir="auto">Example: <a href="https://github.com/symfony/symfony/blob/v3.1.3/src/Symfony/Component/Security/Core/Authentication/AuthenticationProviderManager.php#L33">https://github.com/symfony/symfony/blob/v3.1.3/src/Symfony/Component/Security/Core/Authentication/AuthenticationProviderManager.php#L33</a></p>
<p dir="auto">Could be like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/**
 * @var AuthenticationProviderInterface[]
 */
private $providers;"><pre class="notranslate"><code class="notranslate">/**
 * @var AuthenticationProviderInterface[]
 */
private $providers;
</code></pre></div>
<p dir="auto">Or at least:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/**
 * @var array
 */
private $providers;"><pre class="notranslate"><code class="notranslate">/**
 * @var array
 */
private $providers;
</code></pre></div>
<p dir="auto">Adding PhpDocs would ease up reading the code, as one could just see the type of data stored in a field, instead of reading all the class' code, to reason what it contains. And of course, it would make IDE autocompletion better supported.</p>
<p dir="auto">I volunteer to add them and submit a PR.</p>
<p dir="auto">Hi,</p>
<p dir="auto">I recently upgrade from sf 2.3.9 to 2.3.10 and i'm surprised that elements cannot be removed from collections in forms.</p>
<p dir="auto">But after i debugged the symfony form's core, i found that there's a problem with the method onSubmit in class Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener.</p>
<p dir="auto">This is the source of problem:</p>
<p dir="auto">// The data mapper only adds, but does not remove items, so do this<br>
// here<br>
if ($this-&gt;allowDelete) {<br>
if ($data instanceof \IteratorAggregate) {<br>
$iter = $data-&gt;getIterator();<br>
while ($iter-&gt;valid()) {<br>
$name = $iter-&gt;key();<br>
if ($form-&gt;has($name)) {<br>
$iter-&gt;next();<br>
} else {<br>
$iter-&gt;offsetUnset($name);<br>
}<br>
}<br>
} else {<br>
foreach ($data as $name =&gt; $child) {<br>
if (!$form-&gt;has($name)) {<br>
unset($data[$name]);<br>
}<br>
}<br>
}<br>
}</p>
<p dir="auto">I fixed this problem by converting ArrayCollection to array in the getter of my form's model.</p>