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)
{
$nakedType = self::getNamedType($type);
return $nakedType instanceof LeafType;
return $type instanceof LeafType;
}
/**

View File

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