Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Narrow l/r/trim() arg on comparison to '' #4340

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

Merged
ondrejmirtes merged 4 commits into phpstan:2.1.x from staabm:trim
Sep 18, 2025
Merged

Conversation

Copy link
Contributor

@staabm staabm commented Sep 17, 2025

mickverm reacted with hooray emoji
) {
$argType = $scope->getType($exprNode->getArgs()[0]->value);

if ($argType->isString()->yes()) {
Copy link
Member

@ondrejmirtes ondrejmirtes Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that if you omit if ($argType->isString()->yes()) { and do new IntersectionType([new StringType(), new AccessoryNonEmptyStringType()]), we could also narrow mixed to non-empty-string.

@staabm staabm force-pushed the trim branch 2 times, most recently from b05b54b to 02f5b9f Compare September 18, 2025 05:00
@ondrejmirtes ondrejmirtes merged commit 0626464 into phpstan:2.1.x Sep 18, 2025
455 of 457 checks passed
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ondrejmirtes ondrejmirtes ondrejmirtes requested changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

False positive for return type non-empty-string|null when using trim to filter blank strings

AltStyle によって変換されたページ (->オリジナル) /