protected static function extractAjaxFormatter($form)
    {
        $form = static::getForm($form);
        $formatter = $form->getAttribute('select2', $form->getOption('select2'));
        $formatter = $formatter['ajax_formatter'];

        if (!$formatter instanceof AjaxChoiceListFormatterInterface) {
            throw new UnexpectedTypeException($formatter, 'Fxp\Component\FormExtensions\Form\ChoiceList\Formatter\AjaxChoiceListFormatterInterface');
        }

        return $formatter;
    }