mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 00:25:17 +03:00
Allow objects with __toString in IDType
This commit is contained in:
parent
3536280fac
commit
25e341e9d9
@ -43,7 +43,7 @@ When expected as an input type, any string (such as `"4"`) or integer
|
|||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
return 'null';
|
return 'null';
|
||||||
}
|
}
|
||||||
if (!is_scalar($value)) {
|
if (!is_scalar($value) && (!is_object($value) || !method_exists($value, '__toString'))) {
|
||||||
throw new InvariantViolation("ID type cannot represent non scalar value: " . Utils::printSafe($value));
|
throw new InvariantViolation("ID type cannot represent non scalar value: " . Utils::printSafe($value));
|
||||||
}
|
}
|
||||||
return (string) $value;
|
return (string) $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user