Skip to content

IteratorAggregate with ArrayIterator on array property key type mismatch #10289

Description

@InvisibleSmiley

Bug report

When you implement IteratorAggregate with an ArrayIterator using a local array property, PHPStan does not understand that the ArrayIterator key type depends on the local array property key type. It complains that array key type string is returned when in fact the key type is non-empty-string and PHPStan should be able to infer that.

Code snippet that reproduces the problem

https://phpstan.org/r/fd46fa7a-e010-404d-95e1-72b562e2150f

Expected output

No errors

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

No response

Activity

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