From d710751520b699f227da3d44c4620299d94b6aea Mon Sep 17 00:00:00 2001 From: Ejeh Micheal Marvelous <49599133+marvelmikel@users.noreply.github.com> Date: Tue, 21 May 2024 12:25:00 +0100 Subject: [PATCH] Fix: Add array return type to jsonSerialize method for PHP 8.3+ compatibility --- src/Types/Point.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Types/Point.php b/src/Types/Point.php index d424ec5e..c95fcc09 100644 --- a/src/Types/Point.php +++ b/src/Types/Point.php @@ -5,8 +5,7 @@ use GeoJson\GeoJson; use GeoJson\Geometry\Point as GeoJsonPoint; use Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException; - -class Point extends Geometry +class Point extends Geometry implements \JsonSerializable { protected $lat; @@ -92,8 +91,14 @@ public static function fromJson($geoJson) * * @return \GeoJson\Geometry\Point */ - public function jsonSerialize() + public function jsonSerialize(): array { - return new GeoJsonPoint([$this->getLng(), $this->getLat()]); + return [ + 'type' => 'Point', + 'coordinates' => [ + $this->getLng(), + $this->getLat() + ] + ]; } }