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.52k stars 2.67k forks source link

PHP 8.4 - implicit nulls are deprecated #960

Closed drbyte closed 1 month ago

drbyte commented 1 month 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 1 month 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 1 month ago

Checking this asap, thank you!