Transformer/ConvertValueTransformer.php
public function transform($value, array $options = [])
    {
        if (null === $value) {
            return $value;
        }

        $resolver = new OptionsResolver();
        $this->configureOptions($resolver);
        $options = $resolver->resolve($options);

        if (!is_string($value) && !is_int($value)) { // If not a valid array index
            if (!$options['auto_cast']) {
                $type = gettype($value);
                throw new \UnexpectedValueException(
                    "Value of type {$type} is not a valid array index, set auto_cast to true to cast it to a string"
                );
            }
            $value = (string) $value; // Let's cast it to string
        }

        if (!array_key_exists($value, $options['map'])) {
            if ($options['keep_missing']) {
                return $value;
            }
            if (!$options['ignore_missing']) {
                throw new \UnexpectedValueException("Missing value in map '{$value}'");
            }

            return null;
        }

        return $options['map'][$value];
    }
public function transform($value, array $options = [])
    {
        if (null === $value) {
            return $value;
        }

        $resolver = new OptionsResolver();
        $this->configureOptions($resolver);
        $options = $resolver->resolve($options);

        if (!is_string($value) && !is_int($value)) { // If not a valid array index
            if (!$options['auto_cast']) {
                $type = gettype($value);
                throw new \UnexpectedValueException(
                    "Value of type {$type} is not a valid array index, set auto_cast to true to cast it to a string"
                );
            }
            $value = (string) $value; // Let's cast it to string
        }

        if (!array_key_exists($value, $options['map'])) {
            if ($options['keep_missing']) {
                return $value;
            }
            if (!$options['ignore_missing']) {
                throw new \UnexpectedValueException("Missing value in map '{$value}'");
            }

            return null;
        }

        return $options['map'][$value];
    }
Must return the transformed $value

@param mixed $value
@param array $options

@throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface
@throws \UnexpectedValueException

@return mixed $value