From 7340e30753586115cc18043f9fc4a29718b630fa Mon Sep 17 00:00:00 2001 From: vladar Date: Sat, 19 Nov 2016 17:25:34 +0700 Subject: [PATCH] Types are now serializable to JSON (output their name) --- src/Type/Definition/Type.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Type/Definition/Type.php b/src/Type/Definition/Type.php index 02908b0..04a0e69 100644 --- a/src/Type/Definition/Type.php +++ b/src/Type/Definition/Type.php @@ -16,7 +16,7 @@ GraphQLInputObjectType | GraphQLList | GraphQLNonNull; */ -abstract class Type +abstract class Type implements \JsonSerializable { const STRING = 'String'; const INT = 'Int'; @@ -250,6 +250,14 @@ abstract class Type return $this->name; } + /** + * @return string + */ + public function jsonSerialize() + { + return $this->toString(); + } + /** * @return string */