Form/FormErrorHandler.php
protected function getErrorFormLabel(FormInterface $form):array
    {
        $vars = $form->createView()->vars;

        $label = $vars['label'];
        $translationDomain = $vars['translation_domain'];

        $result = array(
            'label' => $label,
            'domain' => $translationDomain,
        );

        if (empty($label)) {
            if ($form->getParent() !== null) {
                $result = $this->getErrorFormLabel($form->getParent());
            }
        }

        return $result;
    }
protected function getErrorFormLabel(FormInterface $form):array
    {
        $vars = $form->createView()->vars;

        $label = $vars['label'];
        $translationDomain = $vars['translation_domain'];

        $result = array(
            'label' => $label,
            'domain' => $translationDomain,
        );

        if (empty($label)) {
            if ($form->getParent() !== null) {
                $result = $this->getErrorFormLabel($form->getParent());
            }
        }

        return $result;
    }
protected function getErrorFormLabel ( FormInterface $ form ) : array { $ vars = $ form -> createView ( ) -> vars ; $ label = $ vars [ 'label' ] ; $ translationDomain = $ vars [ 'translation_domain' ] ; $ result = array ( 'label' => $ label , 'domain' => $ translationDomain , ) ; if ( empty ( $ label ) ) { if ( $ form -> getParent ( ) !== null ) { $ result = $ this -> getErrorFormLabel ( $ form -> getParent ( ) ) ; } } return $ result ; }
Returns first label for field with error

@param  FormInterface $form
@return array
Returns first label for field with error