-
Notifications
You must be signed in to change notification settings - Fork 561
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 deprecation "Implicitly marking parameter as nullable" #835
Comments
same issue |
Hey, guys. Any updates? |
Thanks, I hadn't seen that PR - would be great to get this committed. |
i see there are few PRs merged to fix this deprecation warning, but I think it's not fixed completely as I still get deprecation warning on version 8.3.12. for example, this line of code triggers deprecation: https://github.com/twilio/twilio-php/blob/main/src/Twilio/Rest/Chat/V1/ServiceList.php#L85 |
Yes, there are still generated files that don't properly type nullable parameters. This library is generated with https://openapi-generator.tech, and that will need to support PHP 8.4. So if we can that fixed, the generator will automatically fix this library. But the big issue here is https://openapi-generator.tech has LOTS of PRs, and still not one to support PHP 8.4 I am thinking running Rector on my version of the code base. I check in the source to me local repo so I don't reply on composer to install files. It may be possible to add a rector step to post process this library until https://openapi-generator.tech adds PHP 8.4 support. I will keep everyone posted. |
So no need for Rector. PHP-CS-Fixer will do the work needed. I will submit a PR for this next week to add this to the CI pipeline. Basically: $config = new PhpCsFixer\Config();
$config->setRules(['nullable_type_declaration_for_default_null_value' => true,]);
return $config->setFinder(PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__.'/src/Twilio')
); |
Issue Summary
There are several instances of this deprecation warning. Given that you still want to support PHP 7.2, the solution is to use the question mark solution rather than union types (which aren't supported until PHP 8).
eg:
Steps to Reproduce
Exception/Log
Technical details:
The text was updated successfully, but these errors were encountered: