serbanghita / Mobile-Detect

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
http://mobiledetect.net
MIT License
10.55k stars 2.68k forks source link

PHP 8.4 - implicit nulls are deprecated #960

Closed drbyte closed 3 months ago

drbyte commented 3 months ago

Use explicit nullable type.

MobileDetect::__construct(): Implicitly marking parameter $cache as nullable is deprecated, the explicit nullable type must be used instead

CacheException::__construct(): Implicitly marking parameter $previous as nullable is deprecated, the explicit nullable type must be used instead

Also updated Github Actions workflow to include PHP 8.4

Fixes #956 Replaces #957

drbyte commented 3 months ago

Note: phpstan hasn't yet fixed this same issue within their package. Therefore the composer.json in this PR includes a dev version of phpstan. The .x-dev suffix can be dropped once phpstan officially releases the 1.12 version. Or whatever other changes might be more ideal after phpstan officially fixes the same in their package.

Fortunately it's backward compatible back to at least PHP 8.0, so all the tests are passing fine.

serbanghita commented 3 months ago

Checking this asap, thank you!

acelaya commented 1 month ago

I see this has been merged, but not released. Is there any plans to release a new version including this any time soon?

acelaya commented 1 week ago

I hate to be that person, but PHP 8.4 is releasing tomorrow. Would be great to have this released.

crynobone commented 6 days ago

@serbanghita Can we get a release ASAP since PHP 8.4 has been released?