Skip to content

[Generics] Union bounds issue since migrating from 1.2.0 to 1.4.2 #6437

@gnutix

Description

@gnutix

Bug report

Basically, I have a service that can return data for different types of "persons' contracts" (and stores them in a cache). So I have a repository for each contracts' types (indexed by FQCN), and a method that takes T (being a type of contract) and properly returns a Doctrine collection of contracts objects of type T.

Code snippet that reproduces the problem

https://phpstan.org/r/3104f4e8-b813-443f-b0cc-1d73ecc552dd

Expected output

Since migrating to PHPStan 1.4.2 from 1.2.0, it reports errors while it did not before. I'm not sure yet if it should not, or if there's a better way for me to type this scenario...

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

It does every working day! <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions