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"
401
+
if ('false' === $data || '0' === $data) {
402
+
$data = false;
403
+
} elseif ('true' === $data || '1' === $data) {
404
+
$data = true;
405
+
} else {
406
+
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be bool ("%s" given).', $attribute, $currentClass, $data));
407
+
}
408
+
break;
409
+
case Type::BUILTIN_TYPE_INT:
410
+
if (
411
+
ctype_digit($data) ||
412
+
'-' === $data[0] && ctype_digit(substr($data, 1))
413
+
) {
414
+
$data = (int) $data;
415
+
} else {
416
+
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be int ("%s" given).', $attribute, $currentClass, $data));
417
+
}
418
+
break;
419
+
case Type::BUILTIN_TYPE_FLOAT:
420
+
if (is_numeric($data)) {
421
+
return (float) $data;
422
+
}
423
+
424
+
switch ($data) {
425
+
case'NaN':
426
+
returnNAN;
427
+
case'INF':
428
+
returnINF;
429
+
case'-INF':
430
+
return -INF;
431
+
default:
432
+
thrownewNotNormalizableValueException(sprintf('The type of the "%s" attribute for class "%s" must be float ("%s" given).', $attribute, $currentClass, $data));
433
+
}
434
+
435
+
break;
436
+
}
437
+
}
438
+
382
439
if (null !== $collectionValueType && Type::BUILTIN_TYPE_OBJECT === $collectionValueType->getBuiltinType()) {
0 commit comments