src/AbstractMessage.php
final public function toYaml(array $options = [])
    {
        try {
            if (null === self::$yamlSerializer) {
                self::$yamlSerializer = new YamlSerializer();
            }
            return self::$yamlSerializer->serialize($this, $options);
        } catch (\Exception $e) {
            return sprintf(
                'Failed to render [%s] as a yaml string with error: %s',
                self::schema()->toString(),
                $e->getMessage()
            );
        }
    }
final public function toYaml(array $options = [])
    {
        try {
            if (null === self::$yamlSerializer) {
                self::$yamlSerializer = new YamlSerializer();
            }
            return self::$yamlSerializer->serialize($this, $options);
        } catch (\Exception $e) {
            return sprintf(
                'Failed to render [%s] as a yaml string with error: %s',
                self::schema()->toString(),
                $e->getMessage()
            );
        }
    }
{@inheritdoc}