Skip to content

Issue with template of template and covariance/contravariance #7103

@ondrejmirtes

Description

@ondrejmirtes

Discussed in #7102

Originally posted by VincentLanglet April 24, 2022
Hi @ondrejmirtes, I have trouble to understand why I get an error from the following snippet
https://phpstan.org/r/2adcc3bb-8d05-4d79-91e1-78e282855229
Psalm doesn't report an error https://psalm.dev/r/ae8f5c32ff

I'd like to define a method with a template that I can scope by the class template.
This way
Manager<Foo|Bar>::find(Baz) is invalid.
Manager<Foo|Bar>::find(Foo) will return Foo (and not Foo|Baz).

Is it a bug ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions