unset($data[$element]);
} return $data;
} /**
* @return class-string
*/
private function getMappedClass(array
$data, string
$class, array
$context): string
{ if (null !==
$object =
$this->
extractObjectToPopulate($class,
$context, self::OBJECT_TO_POPULATE
)) { return $object::
class;
} if (!
$mapping =
$this->classDiscriminatorResolver?->
getMappingForClass($class)) { return $class;
} if (null ===
$type =
$data[$mapping->
getTypeProperty()] ?? null
) { throw NotNormalizableValueException::
createForUnexpectedDataType(sprintf('Type property "%s" not found for the abstract object "%s".',
$mapping->
getTypeProperty(),
$class), null,
['string'
],
isset($context['deserialization_path'
]) ?
$context['deserialization_path'
].'.'.
$mapping->
getTypeProperty() :
$mapping->
getTypeProperty(), false
);
}