+
Skip to content

Type information lost when passing generic type of enum as argument #9084

@JoyceBabu

Description

@JoyceBabu

Bug report

When I pass an argument of type T, where T is T of EnumType::* to a function, the type of the changed parameter is changed to T<EnumType> instead of T<actual enum type>.

For example, if I pass Foo<Bar::Baz> as a function parameter to a function /** @param S $foo */ function foobar($foobar);, type of S is detected as Foo<Bar>, not Foo<Bar::Baz>. So, the parameter fails to match its own generic type. Instead an message about template covariance is reported.

Code snippet that reproduces the problem

https://phpstan.org/r/6056f0bd-2f52-456f-8bb1-bd746091fafb

Expected output

The generic type S is the type of the passed argument. So it should should always pass validation.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载