Skip to content

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

Closed

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

Activity

  1. added this to the Easy fixes milestone on Mar 1, 2026
  2. added a commit that references this issue on Mar 1, 2026
    1cb72b1
  3. phpstan-bot commented on Mar 6, 2026

    @phpstan-bot
    Contributor

    Closed via merging phpstan/phpstan-src#5137

  4. github-actions commented on Apr 7, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  5. locked as resolved and limited conversation to collaborators on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions