-
Notifications
You must be signed in to change notification settings - Fork 481
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
Keep traversing type when we can contain lowercase/upercase strings #3792
Keep traversing type when we can contain lowercase/upercase strings #3792
Conversation
71d2836
to
36406a9
Compare
{ | ||
/** @var array{numeric-string} $b */ | ||
$b = $a; | ||
} |
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.
do we need more tests for different variants of this problem?
like
} | |
} | |
/** | |
* @param array{numeric-string&uppercase-string&lowercase-string} $a | |
*/ | |
public function sayUpper(array $a): void | |
{ | |
/** @var array{uppercase-string} $b */ | |
$b = $a; | |
} | |
/** | |
* @param array{numeric-string&uppercase-string&lowercase-string} $a | |
*/ | |
public function sayLower(array $a): void | |
{ | |
/** @var array{lowercase-string} $b */ | |
$b = $a; | |
} |
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 also variants with non-empty-string
, non-falsey-string
?
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 don't think so since it's not related to numeric-string directly.
The issue was because it was a ConstantArray with a lowercase-string or upercase-string inside.
Because of the early return $type
we didn't process the content of the array.
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.
But I added a test for the callable
case
ad97094
Thank you! |
Closes phpstan/phpstan#12457