Skip to content

Another case of incorrect type narrowing with dependent types #14595

@claudepache

Description

@claudepache

Bug report

See code snippet. It is the most reduced case I could find; in particular:

  • If I replace $options['multiple'] and $options['total'] with $multiple and $total, the issue disappears.
  • If I remove $instructions[] = "foo"; on line 12, the issue disappears.

Code snippet that reproduces the problem

https://phpstan.org/r/2d69a19b-88c5-44f0-aa08-1e145257995e

Expected output

On line 21: Dumped type: 0|1|2

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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions