-
-
Notifications
You must be signed in to change notification settings - Fork 568
Closed
Description
Hi, after upgrading my project from 0.10 to 0.11 version I get some weird behaviors with system scalar types when using inputs with variables. I don't really get why we have a differents between serialize/parseValue
methods.
Here an example IntType::parseValue
no more accepts string but IntType::serialize
does:
(new IntType())->serialize('9') !== (new IntType())->parseValue('9'); // 9 !== null
In JS implementation both methods has the same behavior so why in PHP we add these differents?
I override system scalar types to use 0.10 version right now but this is not the best solution... I'm just trying to understand the reason why...
How I override system scalar types without using reflection:
// Override scalar types
$overrideScalarTypes = \Closure::bind(function () {
self::$internalTypes = [
self::ID => new MyType\IDType(),
self::STRING => new MyType\StringType(),
self::FLOAT => new MyType\FloatType(),
self::INT => new MyType\IntType(),
self::BOOLEAN => new MyType\BooleanType()
];
}, null, \GraphQL\Type\Definition\Type::class);
$overrideScalarTypes();
This can maybe helps some people encountering same issue.
Metadata
Metadata
Assignees
Labels
No labels