protected function addPluginTypeServiceDataYaml(&$data, $service, $discovery) {
    $service_reflection = new \ReflectionClass($service);
    $property = $service_reflection->getProperty('defaults');
    $property->setAccessible(TRUE);
    $defaults = $property->getValue($service);

    // YAML plugins don't specify their ID; it's generated automatically.
    unset($defaults['id']);

    $data['yaml_properties'] = $defaults;

    // The YAML discovery wraps another discovery object.
    $discovery_reflection = new \ReflectionClass($discovery);
    $property = $discovery_reflection->getProperty('discovery');
    $property->setAccessible(TRUE);
    $wrapped_discovery = $property->getValue($discovery);

    $wrapped_discovery_reflection = new \ReflectionClass($wrapped_discovery);
    $property = $wrapped_discovery_reflection->getProperty('name');
    $property->setAccessible(TRUE);
    $name = $property->getValue($wrapped_discovery);

    $data['yaml_file_suffix'] = $name;
  }