-
Notifications
You must be signed in to change notification settings - Fork 532
Add DateIntervalFormatDynamicReturnTypeExtension #4165
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
base: 2.1.x
Are you sure you want to change the base?
Conversation
34d5241
to
ffb94a4
Compare
ffb94a4
to
e6490cd
Compare
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.
Please add regression test for https://phpstan.org/r/66bd52bc-2c1c-4b6e-ac27-57c2a7261982.
I'd like both a test in InvalidBinaryOperationRule, and assertType
for %a
.
This doesn't solve the InvalidBinaryOperationRule issue indeed, I just added a nsrt test to show why.
So this PR is still an improvement but doesn't solve the issue. |
This pull request has been marked as ready for review. |
$constantStrings = $arg->getConstantStrings(); | ||
if (count($constantStrings) === 0) { | ||
if ($arg->isNonEmptyString()->yes()) { | ||
return new IntersectionType([new StringType(), new AccessoryNonEmptyStringType()]); |
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.
TypeCombinator::intersect()
instead?
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.
We generally use directly IntersectionType for string type + accessories because it doesn't require any extra manipulation while intersect does lot of different things useless in this case
Related to phpstan/phpstan#1452
but does not close it unfortunately since the
%a
is complicated.