Serialize only form child of type Form

In the latest symfony version forms could include also Symfony\Component\Form\SubmitButton field type.

Since is possible that someone uses the same form both for viewing and for serializing (ajax response) maybe it should be correct to convert form childs only when they are an instance of Form and ignore others instead of throwing and exception.