Skip to content

value-of<Enum1|Enum2> causes fatal error (possibile infinite recursion) #8983

@Jean85

Description

@Jean85

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/2bff6a23-9c9a-492f-a6d6-e34319e0e054

enum Enum1: string {};
enum Enum2: string {};

/** @var value-of<Enum1|Enum2> $bar */
$bar;

causes a fatal failure (probable infinite recursion)
Internal error: Internal error.

value-of of a union of enums seems to be the cause.
This may also be similar to #8835.

Expected output

No issues

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

Totally! I just stumbled on this due to a composer update, so I checked and this a regression introduced in 1.10.0

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