Skip to content

Loss of information about iterable type after assigning to private property #12891

@aivchen

Description

@aivchen

Bug report

After upgrade to PHPStan 2.1.12 I started getting a new error.

PHPStan expands iterable type to array|iterable|Traversable after assigning to a private property.

Code snippet that reproduces the problem

https://phpstan.org/r/23a5a3a5-c614-4c43-b287-d4739cbe3e77

Expected output

Type of the private property must be the same as of a counstructor parameter

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions