Skip to content

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 22, 2025

This https://phpstan.org/r/ed2e2eec-bb85-48b8-8f8c-8ffad4719790 shows the issue.

The constant array shouldnt be narrowed.
Currently the code is narrowing list and constant array which looks like a list.

But one think we can do is telling the array is non empty.

Closes phpstan/phpstan#13111

@ondrejmirtes ondrejmirtes merged commit 15cda6e into phpstan:2.1.x Sep 7, 2025
449 of 454 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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.

False negative accessing array gap index guarded by count

2 participants