Skip to content
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_reduce extension #1677

Merged

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Sep 1, 2022

This is only doing emptyness checks and for that optional keys don't need to be considered AFAIK.

@herndlm
Copy link
Contributor Author

herndlm commented Sep 1, 2022

What if I eventually manage to get rid of all getConstantArrays? Deprecate it? Not in favor of the internal getOldConstantArray I guess? 😅

One of my plans is to try to get rid of ConstantArrayType::powerSet as much as possible, preferable make it hard to use it indirectly. But there's still a bit of work needed for that. And a plan of what to use instead then for e.g. ConstantArrayType::getAllArrays, TypeUtils::flattenTypes, TypeUtils::getArrays, and of course TypeUtils::getConstantArrays. Good thing though is: some of them are rarely used yet.

@ondrejmirtes
Copy link
Member

I'd expect to deprecate both methods on TypeUtils and just introduce Type::getConstantArrays() that would basically behave the same way as getOldConstantArrays and would be a drop-in replacement.

Yeah, and deprecate places that call powerSet too.

@herndlm
Copy link
Contributor Author

herndlm commented Sep 1, 2022

sounds like a plan and I have a goal then :) sorry for jumping between things btw, but this here is bugging me also for a while already..

@ondrejmirtes ondrejmirtes merged commit 14da6b3 into phpstan:1.8.x Sep 1, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the array-reduce-get-old-constant-arrays branch September 1, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants