Skip to content

Conversation

@herndlm
Copy link
Contributor

@herndlm herndlm commented Apr 4, 2022

This is not needed because keyTypes is never modified directly inside the class. E.g. setOffsetValueType is using ConstantArrayTypeBuilder, which creates a new ConstantArrayType, which unions the keys again before passing them to the ArrayType parent. Meaning, parent::getKeyType is always save to use and contains the latest union already.

So this saves another union operation there and should, in theory, improve performance. But the problematic scenarios that I have lying around seem to be not affected by it and therefore I can't deliver a good-looking before/after comparison. But anyways, unnecessary code is unnecessary code :)

@ondrejmirtes ondrejmirtes merged commit f584311 into phpstan:1.5.x Apr 4, 2022
@ondrejmirtes
Copy link
Member

Thank you :)

@herndlm herndlm deleted the remove-unnecessary-get-key-type branch April 4, 2022 11:52
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