Skip to content

List is wrongly inferred as non empty #10085

Closed

Description

@Griffon-Weglot

Bug report

In the following example
https://phpstan.org/r/3ac09ec1-e62e-42b0-b853-06a1450c238f

The array $foo is considered as non empty but shouldn't.
If I pass [], [] to the method, the final array is empty.

As soon as I change the typehint from list to array, the array is correctly inferred as array (and not non-empty-array)
https://phpstan.org/r/1b3c3201-730a-488e-988d-8e7ec87bad30

Code snippet that reproduces the problem

https://phpstan.org/r/3ac09ec1-e62e-42b0-b853-06a1450c238f

Expected output

No error

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

No response

Activity

  1. added this to the Dependent types milestone on Nov 2, 2023
  2. phpstan-bot commented on Apr 1, 2026

    @phpstan-bot
    Collaborator

    Closed via merging phpstan/phpstan-src#5373

  3. github-actions commented on May 3, 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.

  4. locked as resolved and limited conversation to collaborators on May 3, 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