Use isArray instead of array supertype checks#1634
Use isArray instead of array supertype checks#1634ondrejmirtes merged 2 commits intophpstan:1.8.xfrom
Conversation
|
I was not expecting that one additional failure. weird. needs some debugging.. |
|
one more here phpstan-src/src/Analyser/TypeSpecifier.php Line 529 in ed6548c |
1388797 to
ded6e19
Compare
ded6e19 to
bf929da
Compare
|
Please ping me once you mark this as ready, I'm looking forward to merge this. |
|
I think in order to be able to continue here I'd need #1644 to avoid weird behaviour or exceptions |
bf929da to
dc183ee
Compare
|
@ondrejmirtes this is ready now. I could create |
|
Yeah, you could be the guy who spends the next 6 months painstakingly creating methods on Type interface for all the use cases where we currently use instanceof *Type and TypeUtils methods :) That would be really awesome if it sounds interesting to you :) |
|
Thank you! |
you need to work on your sales pitch :D |
|
It's not my fault there's "pain" in "painstakingly" 🤣 |
|
Another easy one should be to replace stuff like |
|
AFAIK the problems with instanceof replacements are then that methods are not guaranteed to exist on the Type interface, right? E.g. it's not safe anymore to call ah and I misread "painstakingly" with "painfully" yesterday I guess. Both are fitting terms I think :D |
|
This is the problem I'm trying to solve - there needs to be methods for EVERYTHING directly on |
|
definitely, yeah. it would also surely help with some constantarray operations I think and then greatly simplify the code that currently needs conditionals to deal with them with the downside of blowing up the Type interface I guess. but for the array/constantarray methods there could be a trait that implements the array-specific methods once for all non-array types or so and then maybe it's not a big deal after all |
|
What we can do once the transformation is complete is to remove all specific We can also stop inheriting type classes from each other. And I guess we could also have a general |
another
small(got bigger over time..) refactor. I'll stop now.. :)UPDATE: added another commit that does the same for isString