-
Notifications
You must be signed in to change notification settings - Fork 525
Use TypeUtils::getOldConstantArrays in array_column extension #1683
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
Use TypeUtils::getOldConstantArrays in array_column extension #1683
Conversation
BTW if you don't plan to make more changes and if you're not just experimenting, you don't need to open the PR as a draft. The problem is that I don't get an email notification when you mark it as ready for review. if you're just waiting for CI results, you can open it as ready-to-merge from the start. If the CI looks green I can merge it sooner. |
Good to know. Yeah, just always anxious that ci might be red. Like here :) |
9e47876
to
dc4a54b
Compare
how do you wish to have the new Type::getConstantArrays() implemented? :) |
Yeah, ConstantArrayType should return IntersectionType I'm not sure about, you can have |
And please search and replace the usages programatically, either with a regex in PhpStorm, or write a script that uses PhpParser format-preserving printer and just switch those AST nodes around in a node visitor :) Here's an example: https://github.com/nikic/PHP-Parser/blob/master/doc/component/Pretty_printing.markdown#formatting-preserving-pretty-printing |
right, but I meant mostly how e.g. IntegerType should implement it. I wonder if I should create a new e.g. NotConstantArrayType trait or just implement it returning an empty array in most of the types |
Both are valid to me :) I don't like the traits too much but we already accepted that direction so it's fine for me. |
fyi I have the Type::getConstantArrays adaption ready and will open the PR after this one got merged :) |
Alright, thank you :) |
looks like it made it a tiny bit smarter.
testImprecise4
was converted totestConstantArray12