giggsey / libphonenumber-for-php

PHP version of Google's phone number handling library
https://giggsey.com/libphonenumber/
Apache License 2.0
4.74k stars 465 forks source link

php 8.4: Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead #653

Open tenzap opened 6 days ago

tenzap commented 6 days ago

While trying to use your library with php-8.4-rc I have the following deprecation warnings.

Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $countryCallingCodeToRegionCodeMap as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 418

Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $metadataLoader as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 418

Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $metadataSource as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 418

Deprecated: libphonenumber\PhoneNumberUtil::parseAndKeepRawInput(): Implicitly marking parameter $phoneNumber as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 1558

Deprecated: libphonenumber\PhoneNumberUtil::findNumbers(): Implicitly marking parameter $leniency as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 1576

Deprecated: libphonenumber\PhoneNumberUtil::maybeExtractCountryCode(): Implicitly marking parameter $defaultRegionMetadata as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 1959

Deprecated: libphonenumber\PhoneNumberUtil::parse(): Implicitly marking parameter $phoneNumber as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 3103
tenzap commented 6 days ago

Line numbers above are with 8.12.43 Below, it is with 8.13.46


Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $countryCallingCodeToRegionCodeMap as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 436

Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $metadataLoader as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 436

Deprecated: libphonenumber\PhoneNumberUtil::getInstance(): Implicitly marking parameter $metadataSource as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 436

Deprecated: libphonenumber\PhoneNumberUtil::parseAndKeepRawInput(): Implicitly marking parameter $phoneNumber as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 1595

Deprecated: libphonenumber\PhoneNumberUtil::findNumbers(): Implicitly marking parameter $leniency as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 1613

Deprecated: libphonenumber\PhoneNumberUtil::maybeExtractCountryCode(): Implicitly marking parameter $defaultRegionMetadata as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 2050

Deprecated: libphonenumber\PhoneNumberUtil::parse(): Implicitly marking parameter $phoneNumber as nullable is deprecated, the explicit nullable type must be used instead in .../vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php on line 3191
giggsey commented 5 days ago

Thanks. Now that PHP 8.4 is in RC, I'll add it to the pipeline here, and get any issues sorted.

Just looking at this error, this might be tricky, as we can't use the nullable type with PHP 5.

Now might be the time to drop older PHP versions image