if (null === $this->serializer) {
throw new BadMethodCallException('Please set a serializer before calling denormalize()!');
}
- if (!is_array($data)) {
- throw new InvalidArgumentException('Data expected to be an array, '.gettype($data).' given.');
+ if (!\is_array($data)) {
+ throw new InvalidArgumentException('Data expected to be an array, '.\gettype($data).' given.');
}
if ('[]' !== substr($class, -2)) {
throw new InvalidArgumentException('Unsupported class: '.$class);
$builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null;
foreach ($data as $key => $value) {
- if (null !== $builtinType && !call_user_func('is_'.$builtinType, $key)) {
- throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, gettype($key)));
+ if (null !== $builtinType && !\call_user_func('is_'.$builtinType, $key)) {
+ throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, \gettype($key)));
}
$data[$key] = $serializer->denormalize($value, $class, $format, $context);