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

Support deprecate implicitly nullable parameter types in PHP8.4 #7870

Open
dmnlk opened this issue Dec 3, 2024 · 2 comments
Open

Support deprecate implicitly nullable parameter types in PHP8.4 #7870

dmnlk opened this issue Dec 3, 2024 · 2 comments

Comments

@dmnlk
Copy link

dmnlk commented Dec 3, 2024

Google\Cloud\RecaptchaEnterprise\V1\Client\RecaptchaEnterpriseServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead

This deprecated warning was occurred in PHP8.4

The following code needs to be generated to prevent the warning below.

public static function parseName(string $formattedName, ?string $template = null): array
public static function parseName(string $formattedName, string|null $template = null): array

It seems that this part of the code needs to be modified.

https://github.com/googleapis/gapic-generator-php/blob/79460062cbb085e6c971919b54558bc46364790e/src/Generation/GapicClientGenerator.php#L274
https://github.com/googleapis/gapic-generator-php/blob/79460062cbb085e6c971919b54558bc46364790e/src/Ast/PhpParam.php#L44

When $this->default is null, it is necessary to generate a nullable ?string or a union type like string|null. However, I am not sure how to implement this using phpparam.

Could you provide some guidance or examples?

@bshaffer
Copy link
Contributor

bshaffer commented Dec 4, 2024

Thank you for reporting this! We have a fix in the works and we hope to have this resolved by end of next week at the latest. See the following PRs:

googleapis/gapic-generator-php#736
#7871

@dmnlk
Copy link
Author

dmnlk commented Dec 5, 2024

thank you!

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

No branches or pull requests

2 participants