Code Duplication    Length = 7-8 lines in 2 locations

src/Execution/Processor.php 1 location

@@ 303-310 (lines=8) @@
300
        $currentType  = $queryType->getNullableType();
301
302
303
        if ($currentType->getKind() == TypeMap::KIND_SCALAR) {
304
            if (!$query->hasFields()) {
305
                return $this->getOutputValue($currentType, $resolvedValue);
306
            } else {
307
                $this->executionContext->addError(new ResolveException(sprintf('Fields are not found in query "%s"', $query->getName())));
308
309
                return null;
310
            }
311
        }
312
313
        foreach ($query->getFields() as $fieldAst) {

src/Validator/ResolveValidator/ResolveValidator.php 1 location

@@ 193-199 (lines=7) @@
190
    public function isValidValueForField(FieldInterface $field, $value)
191
    {
192
        $fieldType = $field->getType();
193
        if ($fieldType->getKind() == TypeMap::KIND_NON_NULL && is_null($value)) {
194
            $this->executionContext->addError(new ResolveException(sprintf('Cannot return null for non-nullable field %s', $field->getName())));
195
196
            return null;
197
        } else {
198
            $fieldType = $this->resolveTypeIfAbstract($fieldType->getNullableType(), $value);
199
        }
200
201
        if (!is_null($value) && !$fieldType->isValidValue($value)) {
202
            $this->executionContext->addError(new ResolveException(sprintf('Not valid value for %s field %s', $fieldType->getNullableType()->getKind(), $field->getName())));