Skip to content

Commit

Permalink
Reorder FieldsBuilder nullable checks to put $forceNullable first, …
Browse files Browse the repository at this point in the history
…as it's the cheapest operation.
  • Loading branch information
DavidBennettUK committed Mar 30, 2021
1 parent bc9fd65 commit fce36db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GraphQl/Type/FieldsBuilder.php
Expand Up @@ -498,7 +498,7 @@ private function convertType(Type $type, bool $input, ?string $queryName, ?strin
return $this->pagination->isGraphQlEnabled($resourceClass, $operationName) && !$input ? $this->typeBuilder->getResourcePaginatedCollectionType($graphqlType, $resourceClass, $operationName) : GraphQLType::listOf($graphqlType);
}

return !$graphqlType instanceof NullableType || $type->isNullable() || (null !== $mutationName && 'update' === $mutationName) || $forceNullable
return $forceNullable || !$graphqlType instanceof NullableType || $type->isNullable() || (null !== $mutationName && 'update' === $mutationName)
? $graphqlType
: GraphQLType::nonNull($graphqlType);
}
Expand Down

0 comments on commit fce36db

Please sign in to comment.