protected static function toggleSerializeClosure(array &$options, $key)
    {
        if (!isset($options[$key])) {
            return;
        }
        $serializer = Util::getClosureSerializer();
        if (is_callable($options[$key])) {
            $options[$key] = (string) $serializer->serialize($options[$key]);
        } elseif (is_string($options[$key])) {
            $options[$key] = $serializer->unserialize($options[$key]);
        }
    }