-
Notifications
You must be signed in to change notification settings - Fork 541
Handle lowercase string in sprintf #3498
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
Conversation
This pull request has been marked as ready for review. |
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.
Does this case also need lowercase stuff?
b051b49
to
69a8b53
Compare
24ef8c3
to
86ddf78
Compare
if ($isLowercase) { | ||
$singlePlaceholderEarlyReturn = new IntersectionType([ | ||
new StringType(), | ||
new AccessoryLowercaseStringType(), | ||
new AccessoryNumericStringType(), | ||
]); | ||
} else { | ||
$singlePlaceholderEarlyReturn = new IntersectionType([ | ||
new StringType(), | ||
new AccessoryNumericStringType(), | ||
]); | ||
} |
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.
maybe it would make sense to extract this "if lowercase, add lowercase-type" into a separate method, so you don't need to repeat it over and over
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.
Tried b22c45b
This pull request has been marked as ready for review. |
continue; | ||
} | ||
|
||
$singlePlaceholderEarlyReturn = $checkArgType->toString(); |
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 wonder this line is also missing lowercase handling
maybe instead of fiddling with this complex loop and all its paths, just add it once here:
if ($singlePlaceholderEarlyReturn !== null) {
return $singlePlaceholderEarlyReturn;
}
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 shouldn't add lowercase handling here and just rely on toString
.
I'll open a PR to update IntegerType::toString
to fix https://phpstan.org/r/79f89e3e-f19f-4a44-bd58-63f3c77db487
Thank you! |
No description provided.