You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// according to https://www.w3.org/TR/xmlschema-2/#boolean, valid representations are "false", "true", "0" and "1"
270
277
if ('false' === $data || '0' === $data) {
271
278
$data = false;
272
279
} elseif ('true' === $data || '1' === $data) {
273
280
$data = true;
281
+
} else {
282
+
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be bool ("%s" given).', $attribute, $currentClass, $data));
274
283
}
275
284
break;
276
285
case Type::BUILTIN_TYPE_INT:
@@ -279,23 +288,23 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma
279
288
'-' == $data[0] && ctype_digit(substr($data, 1))
280
289
) {
281
290
$data = (int) $data;
291
+
} else {
292
+
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be int ("%s" given).', $attribute, $currentClass, $data));
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be float ("%s" given).', $attribute, $currentClass, $data));
299
308
}
300
309
301
310
break;
@@ -453,10 +462,10 @@ private function getCacheKey($format, array $context)
453
462
unset($context['cache_key']); // avoid artificially different keys
454
463
try {
455
464
returnmd5($format.serialize([
456
-
'context' => $context,
457
-
'ignored' => $this->ignoredAttributes,
458
-
'camelized' => $this->camelizedAttributes,
459
-
]));
465
+
'context' => $context,
466
+
'ignored' => $this->ignoredAttributes,
467
+
'camelized' => $this->camelizedAttributes,
468
+
]));
460
469
} catch (\Exception$exception) {
461
470
// The context cannot be serialized, skip the cache
0 commit comments