Skip to content

Type parameter not inferred in a function call with class-string<T> as an argument #4552

@oprypkhantc

Description

@oprypkhantc

Bug report

Type parameter of a function is not automatically inferred from a parameter if a class-string is used instead of an instance.

Code snippet that reproduces the problem

https://phpstan.org/r/66a6ffdd-c9f9-4f97-b952-3728df3a47a4

Expected output

T type should be automatically inferred from the OptionDefinition implementing class, the same way it does without class-string<>: https://phpstan.org/r/2dc465eb-f7cc-404a-8057-bf751ca4173b

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