File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -10,24 +10,33 @@ class GraphQLID extends GraphQLScalarType
1010 protected $ description = "Default GraphQL ID Type " ;
1111
1212 public function serialize ($ outputValue ){
13- if (!is_int ( $ outputValue ) and ! is_string ($ outputValue ) and $ outputValue !==null ){
13+ if (!is_string ($ outputValue ) and $ outputValue !==null ){
1414 throw new GraphQLError (
1515 "Value \"{$ outputValue }\" is not of type \"{$ this ->getName ()}\". "
1616 );
1717 }
18- return strval ( $ outputValue) ;
18+ return $ outputValue ;
1919 }
2020
2121 public function parseLiteral ($ valueNode , $ variables )
2222 {
23- if ($ valueNode ["kind " ] !== "StringValue " and $ valueNode [ " kind " ] !== " IntValue " ){
23+ if ($ valueNode ["kind " ] !== "StringValue " ){
2424 throw new GraphQLError (
25- "ID cannot represent a non-string and non-integer value: {$ valueNode ["value " ]}"
25+ "String cannot represent a non string value: {$ valueNode ["value " ]}"
2626 );
2727 }
2828
2929 return $ valueNode ["value " ];
3030 }
31+
32+ public function parseValue ($ value ){
33+ if (!is_string ($ value ) and $ value !==null ){
34+ throw new GraphQLError (
35+ "Value \"{$ value }\" is not of type \"{$ this ->getName ()}\". "
36+ );
37+ }
38+ return $ value ;
39+ }
3140}
3241
3342?>
You can’t perform that action at this time.
0 commit comments