src/Utils/SchemaExtender.php
protected static function extendFieldMap($type) : array
    {
        $newFieldMap = [];
        $oldFieldMap = $type->getFields();

        foreach (array_keys($oldFieldMap) as $fieldName) {
            $field = $oldFieldMap[$fieldName];

            $newFieldMap[$fieldName] = [
                'name' => $fieldName,
                'description' => $field->description,
                'deprecationReason' => $field->deprecationReason,
                'type' => static::extendType($field->getType()),
                'args' => static::extendArgs($field->args),
                'astNode' => $field->astNode,
                'resolve' => $field->resolveFn,
            ];
        }

        $extensions = static::$typeExtensionsMap[$type->name] ?? null;
        if ($extensions !== null) {
            foreach ($extensions as $extension) {
                foreach ($extension->fields as $field) {
                    $fieldName = $field->name->value;
                    if (isset($oldFieldMap[$fieldName])) {
                        throw new Error('Field "' . $type->name . '.' . $fieldName . '" already exists in the schema. It cannot also be defined in this type extension.', [$field]);
                    }

                    $newFieldMap[$fieldName] = static::$astBuilder->buildField($field);
                }
            }
        }

        return $newFieldMap;
    }
protected static function extendFieldMap($type) : array
    {
        $newFieldMap = [];
        $oldFieldMap = $type->getFields();

        foreach (array_keys($oldFieldMap) as $fieldName) {
            $field = $oldFieldMap[$fieldName];

            $newFieldMap[$fieldName] = [
                'name' => $fieldName,
                'description' => $field->description,
                'deprecationReason' => $field->deprecationReason,
                'type' => static::extendType($field->getType()),
                'args' => static::extendArgs($field->args),
                'astNode' => $field->astNode,
                'resolve' => $field->resolveFn,
            ];
        }

        $extensions = static::$typeExtensionsMap[$type->name] ?? null;
        if ($extensions !== null) {
            foreach ($extensions as $extension) {
                foreach ($extension->fields as $field) {
                    $fieldName = $field->name->value;
                    if (isset($oldFieldMap[$fieldName])) {
                        throw new Error('Field "' . $type->name . '.' . $fieldName . '" already exists in the schema. It cannot also be defined in this type extension.', [$field]);
                    }

                    $newFieldMap[$fieldName] = static::$astBuilder->buildField($field);
                }
            }
        }

        return $newFieldMap;
    }
protected static function extendFieldMap ( $ type ) : array { $ newFieldMap = [ ] ; $ oldFieldMap = $ type -> getFields ( ) ; foreach ( array_keys ( $ oldFieldMap ) as $ fieldName ) { $ field = $ oldFieldMap [ $ fieldName ] ; $ newFieldMap [ $ fieldName ] = [ 'name' => $ fieldName , 'description' => $ field -> description , 'deprecationReason' => $ field -> deprecationReason , 'type' => static :: extendType ( $ field -> getType ( ) ) , 'args' => static :: extendArgs ( $ field -> args ) , 'astNode' => $ field -> astNode , 'resolve' => $ field -> resolveFn , ] ; } $ extensions = static :: $ typeExtensionsMap [ $ type -> name ] ?? null ; if ( $ extensions !== null ) { foreach ( $ extensions as $ extension ) { foreach ( $ extension -> fields as $ field ) { $ fieldName = $ field -> name -> value ; if ( isset ( $ oldFieldMap [ $ fieldName ] ) ) { throw new Error ( 'Field "' . $ type -> name . '.' . $ fieldName . '" already exists in the schema. It cannot also be defined in this type extension.' , [ $ field ] ) ; } $ newFieldMap [ $ fieldName ] = static :: $ astBuilder -> buildField ( $ field ) ; } } } return $ newFieldMap ; }
@param InterfaceType|ObjectType $type

@return mixed[]

@throws Error
@param InterfaceType|ObjectType $type