-
Notifications
You must be signed in to change notification settings - Fork 495
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
Fix class-string<*>
being supertype of any string literal
#2707
base: 1.10.x
Are you sure you want to change the base?
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
c0c711b
to
428ba86
Compare
Hi, changes to isSuperTypeOf need to be verified in TypeCombinatorTest::testUnion and testIntersect. So please add some cases to the data providers there. You need to test expectations with different types that should hit different branches in that method. Thank you. |
This pull request has been marked as ready for review. |
Hi, thank you for such a quick reply :)
Are the tests that I've added sufficient, or do I need to add some for the branches that I didn't touch too? |
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.
After these changes it will be good to merge 👍
)), | ||
], | ||
ConstantStringType::class, | ||
"'Exception'", |
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.
Please test intersection with 'array'
too - should be NeverType.
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.
Fixing the test for phpstan/phpstan#6697 would make it 'array'&class-string<T (function foo(), parameter)>
instead of never
, because we would need to assume that 'array'
may be name of a class PHPStan doesn't know about. What should I do about that?
c038852
to
a293912
Compare
This broke the test for phpstan/phpstan#6697. Not sure what to do here. Fixing phpstan/phpstan#10076 requires assuming that constant string is not a class-string unless PHPStan knows about that class, while phpstan/phpstan#6697 relies on the assumption that constant string may be a name of a class that PHPStan doesn't know about. |
@ondrejmirtes Friendly ping, I need your decision here. |
Fixes phpstan/phpstan#10076.