src/Error/Error.php
public function getLocations()
    {
        if ($this->locations === null) {
            $positions = $this->getPositions();
            $source    = $this->getSource();
            $nodes     = $this->nodes;

            if ($positions && $source) {
                $this->locations = array_map(
                    static function ($pos) use ($source) {
                        return $source->getLocation($pos);
                    },
                    $positions
                );
            } elseif ($nodes) {
                $locations       = array_filter(
                    array_map(
                        static function ($node) {
                            if ($node->loc && $node->loc->source) {
                                return $node->loc->source->getLocation($node->loc->start);
                            }
                        },
                        $nodes
                    )
                );
                $this->locations = array_values($locations);
            } else {
                $this->locations = [];
            }
        }

        return $this->locations;
    }
public function getLocations()
    {
        if ($this->locations === null) {
            $positions = $this->getPositions();
            $source    = $this->getSource();
            $nodes     = $this->nodes;

            if ($positions && $source) {
                $this->locations = array_map(
                    static function ($pos) use ($source) {
                        return $source->getLocation($pos);
                    },
                    $positions
                );
            } elseif ($nodes) {
                $locations       = array_filter(
                    array_map(
                        static function ($node) {
                            if ($node->loc && $node->loc->source) {
                                return $node->loc->source->getLocation($node->loc->start);
                            }
                        },
                        $nodes
                    )
                );
                $this->locations = array_values($locations);
            } else {
                $this->locations = [];
            }
        }

        return $this->locations;
    }
public function getLocations ( ) { if ( $ this -> locations === null ) { $ positions = $ this -> getPositions ( ) ; $ source = $ this -> getSource ( ) ; $ nodes = $ this -> nodes ; if ( $ positions && $ source ) { $ this -> locations = array_map ( static function ( $ pos ) use ( $ source ) { return $ source -> getLocation ( $ pos ) ; } , $ positions ) ; } elseif ( $ nodes ) { $ locations = array_filter ( array_map ( static function ( $ node ) { if ( $ node -> loc && $ node -> loc -> source ) { return $ node -> loc -> source -> getLocation ( $ node -> loc -> start ) ; } } , $ nodes ) ) ; $ this -> locations = array_values ( $ locations ) ; } else { $ this -> locations = [ ] ; } } return $ this -> locations ; }
An array of locations within the source GraphQL document which correspond to this error.

Each entry has information about `line` and `column` within source GraphQL document:
$location->line;
$location->column;

Errors during validation often contain multiple locations, for example to
point out to field mentioned in multiple fragments. Errors during execution include a
single location, the field which produced the error.

@return SourceLocation[]

@api
An array of locations within the source GraphQL document which correspond to this error .