-
Notifications
You must be signed in to change notification settings - Fork 477
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
Improve count()
narrowing of constant arrays
#3709
base: 2.1.x
Are you sure you want to change the base?
Conversation
I know, I changed that narrow* method to return Type instead of SpecifiesTypes. Maybe I'll change this back again tomorrow. |
891412d
to
22ef97b
Compare
adapted. looks better now IMO. The master plan is to move more common things for both @staabm what do you think about this? |
this PR looks great, thanks for cleaning up after me :) |
5964211
to
75991d1
Compare
Should stuff like this be based on 1.12.x or latest dev branch? I sometimes have issues deciding 😅 |
Big changes to TypeSpecifier I prefer on 2.1.x, to avoid conflicts. |
8092d6b
to
f340663
Compare
Thx, makes sense. And good call, there was a conflict.. Rebased this and also other of my PRs on 2.1.x and dealt with conflicts 😊 |
fc54113
to
d92b6f0
Compare
d92b6f0
to
4b53a7f
Compare
4b53a7f
to
66a0ccd
Compare
I think this is ready, only that first issue bot response is confusing me slightly: https://github.com/phpstan/phpstan-src/actions/runs/12635127480. but at the same time it looks like those errors are already there now (https://phpstan.org/r/3cb22712-7994-4b1c-9946-3946083ddb27) or am I missing something? UPDATE: ah wait, it's line 109 of PHP 7.1 - 7.4 which seems to be loosing some generic info I think. I'll check again then.. |
3c0996a
to
ace9569
Compare
ok done, this was even simplified further, is now behaving as I expect it to and should be save :) |
This pull request has been marked as ready for review. |
Generalizes the already existing solution (wow, this is way more complicated than I thought!) and uses it outside of union types as well. I kind of had to make the "isNormalCount" determination a bit more dry, which unfortunately made the diff worse..
I did do a performance comparison with
hyperfine
runningmake phpstan
and didn't notice any changes, but my system is not the best.Closes phpstan/phpstan#12190
Closes phpstan/phpstan#3631