discriminatorType) { $data[$this->discriminatorType] = $this->discriminatorValue; } foreach ($attributes as $key => $class) { if (is_numeric($key)) { $data[$class] = ''; } else { $data[$key] = match ($class) { 'array', 'bool', 'double', 'float', 'int', 'resource', 'string', 'null' => '', default => $this->normalizer->normalize(null, $format, \array_merge( $this->getContextForAttribute($key, $context, $classMetadata), ['docgen:expects' => $class] )), }; } } return $data; } private function getContextForAttribute(string $key, array $initialContext, ?ClassMetadataInterface $classMetadata): array { if (null === $classMetadata) { return $initialContext; } $attributeMetadata = $classMetadata->getAttributesMetadata()[$key] ?? null; if (null !== $attributeMetadata) { /** @var \Symfony\Component\Serializer\Mapping\AttributeMetadata $attributeMetadata */ $initialContext = \array_merge( $initialContext, $attributeMetadata->getNormalizationContextForGroups( \is_array($initialContext['groups']) ? $initialContext['groups'] : [$initialContext['groups']] ) ); } return $initialContext; } }