-
-
Notifications
You must be signed in to change notification settings - Fork 946
Description
Bug report
If more-specific type information is provided on a trait's abstract method, that information isn't making it to classes which use that trait and implement that method. It's reliant on local annotations as if the abstract method weren't even present.
Code snippet that reproduces the problem
https://phpstan.org/r/9d8e2274-8c5b-4fe7-acd8-e5144567e14c
Dumped type should be class-string<MyEntity>. Other errors should not be present, as the annotation on the abstract method on L35 should flow through the useing class.
In fact, the abstract method's signature is completely ignored; the invalid generic here isn't caught either:
https://phpstan.org/r/b5595058-99b5-4a80-9d81-e63cef6e08fe (L35: using <Entity> instead of <T>)
Expected output
No errors, using type info that's functionally equivalent to this: https://phpstan.org/r/c2b182ac-257b-4f2d-972d-e5ba24459de9
Similarly, this works as expected when instead written as an abstract class: https://phpstan.org/r/b089be27-deed-4de2-ab11-93070df8943c