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

DatePeriod::getEndDate can return null #6477

Closed
nyamsprod opened this issue Jan 28, 2022 · 4 comments
Closed

DatePeriod::getEndDate can return null #6477

nyamsprod opened this issue Jan 28, 2022 · 4 comments

Comments

@nyamsprod
Copy link

nyamsprod commented Jan 28, 2022

Bug report

PHPStan believes that DatePeriod::getEndDate will always return a DateTimeInterface object while it can also return null if no end date can be computed from the DatePeriod constructor input see https://www.php.net/manual/en/dateperiod.getenddate.php

Code 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

@nyamsprod
Copy link
Author

seems to be a duplicate will close it

@nyamsprod
Copy link
Author

@staabm seems a PR to resolve the issue has already been submitted see phpstan/phpstan-src#762

@github-actions
Copy link

github-actions bot commented Mar 1, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants