protected function denormalizeParameter(\ReflectionClass
$class, \ReflectionParameter
$parameter, string
$parameterName, mixed
$parameterData, array
$context, string
$format = null
): mixed
{ try { if (($parameterType =
$parameter->
getType()) instanceof \ReflectionNamedType && !
$parameterType->
isBuiltin()) { $parameterClass =
$parameterType->
getName();
new \
ReflectionClass($parameterClass); // throws a \ReflectionException if the class doesn't exist
if (!
$this->serializer instanceof DenormalizerInterface
) { throw new LogicException(sprintf('Cannot create an instance of "%s" from serialized data because the serializer inject in "%s" is not a denormalizer.',
$parameterClass,
static::
class));
} $parameterData =
$this->serializer->
denormalize($parameterData,
$parameterClass,
$format,
$this->
createChildContext($context,
$parameterName,
$format));
} } catch (\ReflectionException
$e) { throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".',
$parameterName), 0,
$e);
} catch (MissingConstructorArgumentsException
$e) { if (!
$parameter->
getType()->
allowsNull()) { throw $e;
} return null;
}