Add DateIntervalFormatDynamicReturnTypeExtension#4165
Add DateIntervalFormatDynamicReturnTypeExtension#4165ondrejmirtes merged 6 commits intophpstan:2.1.xfrom
Conversation
34d5241 to
ffb94a4
Compare
ffb94a4 to
e6490cd
Compare
ondrejmirtes
left a comment
There was a problem hiding this comment.
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.
TypeCombinator::intersect() instead?
There was a problem hiding this comment.
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
|
Thank you! |
Related to phpstan/phpstan#1452
but does not close it unfortunately since the
%ais complicated.