Skip to content

Conditional return type using class-specified template warns but is actually supported #8408

@mad-briller

Description

@mad-briller

Bug report

When using a template that is specified on the class as part of a method conditional return type, a warning is displayed, but the code works as anticipated.
this is a bit confusing as it might lead the user to believe it's not supported when in fact it is.

Code snippet that reproduces the problem

https://phpstan.org/r/ff6b7660-746a-464e-98b7-c1543d181060

Expected output

No error except the unreachable one.

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

every day!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions