From 5f5c8118c034a43d4a93238afbe165f23d8d499c Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Wed, 20 Sep 2017 16:38:02 +0700 Subject: [PATCH] Fixed `parseValue` of StringType and IDType: (it should return null on invalid value, not throw) --- src/Type/Definition/IDType.php | 3 --- src/Type/Definition/StringType.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Type/Definition/IDType.php b/src/Type/Definition/IDType.php index 49cf7c3..1e3deb5 100644 --- a/src/Type/Definition/IDType.php +++ b/src/Type/Definition/IDType.php @@ -55,9 +55,6 @@ When expected as an input type, any string (such as `"4"`) or integer */ public function parseValue($value) { - if (!is_scalar($value)) { - throw new Error("ID type cannot represent non scalar value: " . Utils::printSafeJson($value)); - } return (is_string($value) || is_int($value)) ? (string) $value : null; } diff --git a/src/Type/Definition/StringType.php b/src/Type/Definition/StringType.php index 4cd3815..0e0784b 100644 --- a/src/Type/Definition/StringType.php +++ b/src/Type/Definition/StringType.php @@ -52,9 +52,6 @@ represent free-form human-readable text.'; */ public function parseValue($value) { - if (!is_scalar($value)) { - throw new Error("String cannot represent non scalar value: " . Utils::printSafe($value)); - } return is_string($value) ? $value : null; }