Skip to content

Fix count inferences #4149

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

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

# for free to join this conversation on GitHub. Already have an account? # 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
1 participant