Skip to content

Fix array_is_list call after unset #3400

Closed
VincentLanglet wants to merge 2 commits intophpstan:1.12.xfrom
VincentLanglet:arrayIsList
Closed

Fix array_is_list call after unset #3400
VincentLanglet wants to merge 2 commits intophpstan:1.12.xfrom
VincentLanglet:arrayIsList

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

@VincentLanglet VincentLanglet commented Sep 4, 2024

Extracted from #3381

It may be surprising but the code

$a = [1, 2, 3];
unset($a[2]);

var_dump(array_is_list($a));

display TRUE.

As shown in the example https://3v4l.org/0HFeL

So I updated ConstantArrayType::unsetOffsetType()
and ConstantArrayTypeBuilder::setOffsetValueType()

Edit: But I feel like this bugfix might not enough like shown by the latest added test 61b6160
=> See https://3v4l.org/XX2fU for the PHP behavior.

So maybe the fix should be done differently

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.

1 participant