Support deprecate implicitly nullable parameter types in PHP8.4
dmnlk opened this issue · 2 comments
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?
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:
thank you!