Skip to content

Nonexistent offset detection on lists with count() -1 #14215

@staabm

Description

@staabm

Bug report

we sometimes get false positives for array access after conditions with count() - 1.

similar to phpstan/phpstan-src#5090

Code snippet that reproduces the problem

https://phpstan.org/r/6db0cf5d-3b20-48ea-ad8b-e457de8d311a

Expected output

as indicated in comments of the playground link

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions