My code was working fine and all of the sudden I’m getting a real strange error. (really all of the sudden! I didn’t change a line of code! Only my mac got updated to latest version which I honestly don’t see how that could be an issue!)
When I try to save or retrieve any entity that has a point data type in it I get this exception:
PHP Fatal error: During inheritance of JsonSerializable: Uncaught ErrorException: Return type of GrimzyLaravelMysqlSpatialTypesPoint::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/amirpeivandi/Projects/nwrewards/vendor/grimzy/laravel-mysql-spatial/src/Types/Point.php:93
Any idea what this could be?
Amir
2
Answers
You should ask Package Developer to fix this error, and update your package to new version
I believe this error is caused by failing to add the spatial trait and protected spatial field to the model.
You can read about this requirement on GitHub here.