Code Duplication    Length = 7-8 lines in 2 locations

src/Execution/Processor.php 1 location

@@ 311-318 (lines=8) @@
308
        $currentType  = $queryType->getNullableType()->getNullableType();
309
310
311
        if ($currentType->getKind() == TypeMap::KIND_SCALAR) {
312
            if (!$query->hasFields()) {
313
                return $this->getOutputValue($currentType, $resolvedValue);
314
            } else {
315
                $this->executionContext->addError(new ResolveException(sprintf('Fields are not found in query "%s"', $query->getName())));
316
317
                return null;
318
            }
319
        }
320
321
        foreach ($query->getFields() as $fieldAst) {

src/Validator/ResolveValidator/ResolveValidator.php 1 location

@@ 243-249 (lines=7) @@
240
    public function isValidValueForField(FieldInterface $field, $value)
241
    {
242
        $fieldType = $field->getType();
243
        if ($fieldType->getKind() == TypeMap::KIND_NON_NULL && is_null($value)) {
244
            $this->executionContext->addError(new ResolveException(sprintf('Cannot return null for non-nullable field %s', $field->getName())));
245
246
            return null;
247
        } else {
248
            $fieldType = $this->resolveTypeIfAbstract($fieldType->getNullableType(), $value);
249
        }
250
251
        if (!is_null($value) && !$fieldType->isValidValue($value)) {
252
            $this->executionContext->addError(new ResolveException(sprintf('Not valid value for %s field %s', $fieldType->getNullableType()->getKind(), $field->getName())));