grimzy / laravel-mysql-spatial

MySQL Spatial Data Extension integration with Laravel.
Other
792 stars 312 forks source link

Does it work with PHP8.1 ? #185

Open smknstd opened 2 years ago

smknstd commented 2 years ago

Hello ! I'm trying this package with PHP8.1 and everything seems to work so far even if it doesn't look updated since PHP7.4 https://github.com/grimzy/laravel-mysql-spatial/blob/master/.travis.yml#L5

It seems there are some deprecations notices though. Ex:

PHP Deprecated: Return type of Grimzy\LaravelMysqlSpatial\Types\Point::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /vendor/grimzy/laravel-mysql-spatial/src/Types/Point.php on line 95

vesper8 commented 2 years ago

@grimzy It would be great if you tagged a small update taking care of these deprecations before jumping on to the Laravel 9 release, which you already have a PR for. This is because a lot of users will be using Laravel 8 with PHP 8.1 for a long time still before upgrading to Laravel 9.

smknstd commented 2 years ago

https://github.com/grimzy/laravel-mysql-spatial/blob/master/composer.json#L18

I think it would be good practice to change for bound php version ; something like :

"require": {
   "php": "^7.4|^8.0",
}

https://getcomposer.org/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md

macbookandrew commented 2 years ago

There’s a PR open for this: #189

jangaraev commented 2 years ago

Have the same issue after switching to PHP8.1.

Return type of Grimzy\LaravelMysqlSpatial\Types\Point::jsonSerialize() should either be compatible with 
JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to
temporarily suppress the notice in vendor/grimzy/laravel-mysql-spatial/src/Types/Point.php on line 95