public function toSerializableArray()
    {
        $arr = [
            'message' => $this->getMessage(),
        ];

        $locations = Utils::map(
            $this->getLocations(),
            static function (SourceLocation $loc) {
                return $loc->toSerializableArray();
            }
        );

        if (! empty($locations)) {
            $arr['locations'] = $locations;
        }
        if (! empty($this->path)) {
            $arr['path'] = $this->path;
        }
        if (! empty($this->extensions)) {
            $arr['extensions'] = $this->extensions;
        }

        return $arr;
    }
public function toSerializableArray()
    {
        $arr = [
            'message' => $this->getMessage(),
        ];

        $locations = Utils::map(
            $this->getLocations(),
            static function (SourceLocation $loc) {
                return $loc->toSerializableArray();
            }
        );

        if (! empty($locations)) {
            $arr['locations'] = $locations;
        }
        if (! empty($this->path)) {
            $arr['path'] = $this->path;
        }
        if (! empty($this->extensions)) {
            $arr['extensions'] = $this->extensions;
        }

        return $arr;
    }
Returns array representation of error suitable for serialization

@deprecated Use FormattedError::createFromException() instead

@return mixed[]