Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Since 2.1.52 foreach over non-empty-list with finite literal-string key produces possibly-empty array shape #14552

@janedbal

Description

@janedbal

Bug report

See snippet.

Version Dumped type
2.1.51 non-empty-array<'a'|'b', 1>
2.1.52 array{a?: 1, b?: 1}

Code snippet that reproduces the problem

https://phpstan.org/r/6aac8479-7d25-4317-942c-b90deff7841b

Expected output

  • non-empty-array{a?: 1, b?: 1} (is that even a thing? array-shape, but non-empty?)
  • or the previous type non-empty-array<'a'|'b', 1>

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

No response

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