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

Fix MixedType::hasOffsetValueType() for subtracted types #2135

Merged
merged 1 commit into from Dec 21, 2022

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Dec 21, 2022

just stumbled over this by luck. I don't expect it to have much of an influence because most of the code using hasOffsetValueType() does a isOffsetAccessible() before already. which kind of made me thinking - maybe we should look into how much of a performance impact it has that e.g. hasOffsetValueType() is not cached for big constant arrays, but maybe it doesn't matter any more now..

@@ -514,6 +514,10 @@ public function isOffsetAccessible(): TrinaryLogic

public function hasOffsetValueType(Type $offsetType): TrinaryLogic
{
if ($this->isOffsetAccessible()->no()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes we wonder whether the API is meant in a way that the caller is expected to check with isOffsetAccessible before calling hasOffsetValueType

@ondrejmirtes ondrejmirtes merged commit 506a4d9 into phpstan:1.9.x Dec 21, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the mixed-has-offset-value-type branch December 21, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants