-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Is there a rule to convert implicitly nullable types to explict ones? #8520
Comments
That seems php 8.4 rfc, so I think we can wait until that got merged to master branch of php-src so we can add to |
It does not: <?php declare(strict_types=1);
interface I
{
public function m(?string $a = null): void;
}
class C implements I
{
public function m(string $a = null): void
{
}
} As you can see here, the above does not trigger a signature incompatibility error. This is because both |
@sebastianbergmann thank you for verify 👍 |
RFC was accepted https://externals.io/message/122534#122632 |
I created PR: for it. |
fwiw, I think this is already possible with PHP CS-Fixer and maybe ECS. not sure we need it also in rector. |
@staabm let make it possible with rector as well 👍 |
Nice, thank you 🙇🏼 |
Question
I learned about this via sebastianbergmann/phpunit#5719 which references https://wiki.php.net/rfc/deprecate-implicitly-nullable-types , and I was wondering if per chance there is already a rule covering this?
I went through all of them but couldn't find one where I had the feeling it was the correct one; but maybe I searched for the wrong keywords (nullable, implicitly).
Thanks
The text was updated successfully, but these errors were encountered: