Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tenzap opened this issue Sep 29, 2024 · 8 comments · Fixed by #657

Comments

@tenzap
Copy link

tenzap commented Sep 29, 2024

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
Copy link
Author

tenzap commented Sep 29, 2024

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
Copy link
Owner

giggsey commented Sep 30, 2024

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

@giggsey
Copy link
Owner

giggsey commented Oct 7, 2024

7.4 is now the minimum version, which allows us to do the necessary stuff for this.

However, the pipeline for 8.4 isn't reporting any issues? https://github.com/giggsey/libphonenumber-for-php/actions/runs/11179907839/job/31080518166

@tenzap
Copy link
Author

tenzap commented Oct 7, 2024

The issue was not revealed with your test suite actually.

@giggsey
Copy link
Owner

giggsey commented Oct 7, 2024

Can you share how the deprecations were displayed? PHPUnit has (now) been configured to convert deprecations to exceptions, but the pipeline is running 8.4-dev, so maybe it's not on the correct release yet.

@giggsey
Copy link
Owner

giggsey commented Oct 8, 2024

@giggsey
Copy link
Owner

giggsey commented Oct 8, 2024

This should now be fixed with the latest version. When running 8.4-rc via Docker locally, I was able to find the errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants