int count()
Returns the number of elements in the iterator.
Note that this is not the total number of errors, if the constructor parameter $deep was set to true! In that case, you should wrap the iterator into a {@link \RecursiveIteratorIterator} with the standard mode {@link \RecursiveIteratorIterator::LEAVES_ONLY} and count the result.
$iterator = new \RecursiveIteratorIterator($form->getErrors(true));
$count = count(iterator_to_array($iterator));
Alternatively, set the constructor argument $flatten to true as well.
$count = count($form->getErrors(true, true));
Please login to continue.