Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 17, 2025

) {
$argType = $scope->getType($exprNode->getArgs()[0]->value);

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

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
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
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
2 participants