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
Add DatePeriod dynamic return type #958
Add DatePeriod dynamic return type #958
Conversation
Restore the original stub with |
89d17c7
to
1166c34
Compare
I rebase but some tests failed |
DatePeriod::getRecurrences() was added in PHP 7.2. You can run the test only on newer PHP versions if you put the yield in a condition. It's already done many times in NodeScopeResolverTest. |
]); | ||
} | ||
|
||
return new GenericObjectType(DatePeriod::class, [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic isn't sufficient. You also need to test scenarios like when the third argument is mixed
or DateTimeInterface|int
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a more explicit version
f3e0636
to
f0ad821
Compare
* @template TEnd of ?DateTimeInterface | ||
* @template TRecurrences of ?int | ||
*/ | ||
class DatePeriod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing - DatePeriod
needs to be added here in the config:
Line 25 in d92d616
skipCheckGenericClasses: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simiarly to what was done here: phpstan/phpstan-doctrine@8061e5f
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
f705fee
to
fad3849
Compare
fad3849
to
b1950fa
Compare
b1950fa
to
1676836
Compare
Thank you! |
Thank you for your support It was interesting to discover how PHPStan works |
Resolve phpstan/phpstan#5953
Previous PR : #762