src/Schema/Conversion/DefinitionNodeConverter.php
protected function convertWrappedDefinitionNode($node, array $wrappers = []): Type
    {
        // Recursively unwrap the type and save the wrappers
        if ($node->kind === NodeKind::NON_NULL_TYPE || $node->kind === NodeKind::LIST_TYPE) {
            $wrappers[] = $node->kind;

            return $this->convertWrappedDefinitionNode(
                $node->type,
                $wrappers
            );
        }

        // Re-wrap the type by applying the wrappers in the reversed order
        return (new Collection($wrappers))
            ->reverse()
            ->reduce(
                function (Type $type, string $kind): Type {
                    if ($kind === NodeKind::NON_NULL_TYPE) {
                        return Type::nonNull($type);
                    }

                    if ($kind === NodeKind::LIST_TYPE) {
                        return Type::listOf($type);
                    }

                    return $type;
                },
                $this->convertNamedTypeNode($node)
            );
    }
protected function convertWrappedDefinitionNode($node, array $wrappers = []): Type
    {
        // Recursively unwrap the type and save the wrappers
        if ($node->kind === NodeKind::NON_NULL_TYPE || $node->kind === NodeKind::LIST_TYPE) {
            $wrappers[] = $node->kind;

            return $this->convertWrappedDefinitionNode(
                $node->type,
                $wrappers
            );
        }

        // Re-wrap the type by applying the wrappers in the reversed order
        return (new Collection($wrappers))
            ->reverse()
            ->reduce(
                function (Type $type, string $kind): Type {
                    if ($kind === NodeKind::NON_NULL_TYPE) {
                        return Type::nonNull($type);
                    }

                    if ($kind === NodeKind::LIST_TYPE) {
                        return Type::listOf($type);
                    }

                    return $type;
                },
                $this->convertNamedTypeNode($node)
            );
    }
protected function convertWrappedDefinitionNode ( $ node , array $ wrappers = [ ] ) : Type { // Recursively unwrap the type and save the wrappers if ( $ node -> kind === NodeKind :: NON_NULL_TYPE || $ node -> kind === NodeKind :: LIST_TYPE ) { $ wrappers [ ] = $ node -> kind ; return $ this -> convertWrappedDefinitionNode ( $ node -> type , $ wrappers ) ; } // Re-wrap the type by applying the wrappers in the reversed order return ( new Collection ( $ wrappers ) ) -> reverse ( ) -> reduce ( function ( Type $ type , string $ kind ) : Type { if ( $ kind === NodeKind :: NON_NULL_TYPE ) { return Type :: nonNull ( $ type ) ; } if ( $ kind === NodeKind :: LIST_TYPE ) { return Type :: listOf ( $ type ) ; } return $ type ; } , $ this -> convertNamedTypeNode ( $ node ) ) ; }
Unwrap the node if needed and convert to type.

@param  mixed  $node
@param  string[]  $wrappers
@return \GraphQL\Type\Definition\Type
Unwrap the node if needed and convert to type .