Fix: isLeafType should not return true for ListOfType and NonNull wrappers

This commit is contained in:
Vladimir Razuvaev 2017-07-04 13:17:09 +07:00
parent c5484ae6f9
commit 4c96193027
2 changed files with 2 additions and 3 deletions

View File

@ -138,8 +138,7 @@ abstract class Type implements \JsonSerializable
*/ */
public static function isLeafType($type) public static function isLeafType($type)
{ {
$nakedType = self::getNamedType($type); return $type instanceof LeafType;
return $nakedType instanceof LeafType;
} }
/** /**

View File

@ -25,7 +25,7 @@ class ScalarLeafs
NodeKind::FIELD => function(FieldNode $node) use ($context) { NodeKind::FIELD => function(FieldNode $node) use ($context) {
$type = $context->getType(); $type = $context->getType();
if ($type) { if ($type) {
if (Type::isLeafType($type)) { if (Type::isLeafType(Type::getNamedType($type))) {
if ($node->selectionSet) { if ($node->selectionSet) {
$context->reportError(new Error( $context->reportError(new Error(
self::noSubselectionAllowedMessage($node->name->value, $type), self::noSubselectionAllowedMessage($node->name->value, $type),