Skip to content

Array type incorrectly adjusted in loop scenario #13663

@bobvandevijver

Description

@bobvandevijver

Bug report

When running loops where you insert default values for a map when a key does not exists, and the loop contains another loop that loops and touches the same map by setting something, the typing is incorrect adjusted where the initial properties are made optional, while they are guaranteed to be there.

Code snippet that reproduces the problem

https://phpstan.org/r/6b4b38e7-3aa0-46b0-b3f1-57ffa28613ca

Expected output

The two dumped types should be equal, and the error should not be there.

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

Using PHPStan with a lot of different projects and it keeps finding new code quality issues I need to solve, which is awesome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions