Skip to content

Use TypeUtils::getOldConstantArrays in array_reduce extension#1677

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
herndlm:array-reduce-get-old-constant-arrays
Sep 1, 2022
Merged

Use TypeUtils::getOldConstantArrays in array_reduce extension#1677
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
herndlm:array-reduce-get-old-constant-arrays

Conversation

@herndlm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants