Skip to content

Class with generic mixin gives unexpected results #8008

@erikgaal

Description

@erikgaal

Bug report

I'm trying to implement the types for Pagination in Laravel, but I'm running into some issues with mixins.
It seems that types aren't resolved when a concrete class with a generic has a mixin and passes the generic through.

I've attached an example on phpstan.org that explains the situation.

Not sure if this is a bug or a feature request. Would be happy to try and solve this issue with some directions though!

Code snippet that reproduces the problem

https://phpstan.org/r/6bc14eb5-a2ad-46be-923e-c33c7441317a

Expected output

Expected type array<MyObject>, actual: array<TValue of object (class Paginator, parameter)>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions