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
DatePeriod::getEndDate can return null #6477
Comments
seems to be a duplicate will close it |
the jetbrains stubs are correct https://github.com/JetBrains/phpstorm-stubs/blob/363c7059fcfc9b45eb93c940455a565280106c3c/date/date_c.php#L991 bug is here: https://github.com/phpstan/phpstan-src/blob/a215b379130c7c5620636688b2d72931a7aff96f/resources/functionMap.php#L1593 feel free to send a fix |
@staabm seems a PR to resolve the issue has already been submitted see phpstan/phpstan-src#762 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
PHPStan believes that
DatePeriod::getEndDate
will always return aDateTimeInterface
object while it can also returnnull
if no end date can be computed from theDatePeriod
constructor input see https://www.php.net/manual/en/dateperiod.getenddate.phpCode snippet that reproduces the problem
https://phpstan.org/r/93804099-9892-4e17-a54e-6b9b8d18be62
and
https://3v4l.org/qBgdp
Expected output
Expect no error to be display
The text was updated successfully, but these errors were encountered: