-
Notifications
You must be signed in to change notification settings - Fork 506
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 setting offset to a List #3382
Fix setting offset to a List #3382
Conversation
assertType('true', array_is_list($array)); | ||
|
||
$array[$key] = false; | ||
assertType('true', array_is_list($array)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to this PR, it was considered as false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I specifically asked for ConstantArrayTypeBuilderTest reproduction so please add that.
Sorry for the misunderstanding, it should be better now (?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise I couldn't find any problem with this edit 👍
$builder->setOffsetValueType(new ConstantIntegerType(2), new NullType()); | ||
$this->assertTrue($builder->isList()); | ||
|
||
$oneOrZero = TypeCombinator::union( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also write some counter-example test as well. Like when we're setting a union offset that does not exist yet, that will make the array be no longer a list. Thanks.
Thank you. |
Extracted from #3381