vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.55k stars 660 forks source link

@psalm-require-extends does not consider generics #10900

Open alex-dev opened 6 months ago

alex-dev commented 6 months ago

https://psalm.dev/r/346857a814

psalm-github-bot[bot] commented 6 months ago

I found these snippets:

https://psalm.dev/r/346857a814 ```php */ trait C { /** @return T */ public function a() { return $this->a; } } /** * @template T * @extends A */ class B extends A { /** @use C */ use C; } /** @psalm-trace $_a */ $_a = (new B('ssss'))->a(); ``` ``` Psalm output (using commit ef3b018): INFO: Trace - 28:1 - $_a: mixed ERROR: ExtensionRequirementViolation - 24:6 - C requires using class to extend A, but B does not ```