public static function isTypeOf(FormInterface $form, $typeName)
    {
        $typeNames = (array) $typeName;
        $type = $form->getConfig()->getType();
        
        while ($type) {
            $actualTypeName = $type->getName();
            
            if (in_array($actualTypeName, $typeNames, true)) {
                return true;
            }
            
            $type = $type->getParent();
        }
        
        return false;
    }