vimeo / psalm

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

Nested mixins don't work #5719

Open SCIF opened 3 years ago

SCIF commented 3 years ago

https://psalm.dev/r/f31ffcdffb

Not sure if that's intended to be working but since there is no documentation about it, I want to ask that question.

psalm-github-bot[bot] commented 3 years ago

I found these snippets:

https://psalm.dev/r/f31ffcdffb ```php */ class A {} /** * @template T */ class B2 { /** @psalm-return T */ public function b2test() {} } /** * @template T * @mixin B2 */ class C { /** @return T */ public function get() {} } /** @var A $d */; $test = $d->b2test(); /** @psalm-trace $test */; ``` ``` Psalm output (using commit 27ea40e): ERROR: UndefinedMethod - 29:13 - Method A::b2test does not exist INFO: MixedAssignment - 29:1 - Unable to determine the type that $test is being assigned to INFO: Trace - 30:26 - $test: mixed INFO: UnusedVariable - 29:1 - $test is never referenced or the value is not used ERROR: InvalidReturnType - 14:23 - No return statements were found for method B2::b2test but return type 'T' was expected ERROR: InvalidReturnType - 23:17 - No return statements were found for method C::get but return type 'T' was expected ```
AlbinoDrought commented 1 year ago

Similarly: https://psalm.dev/r/1b9a1fb99a

(experiencing this when using https://github.com/laravel/framework/blob/9.x/src/Illuminate/Contracts/Database/Eloquent/Builder.php#L10 )

psalm-github-bot[bot] commented 1 year ago

I found these snippets:

https://psalm.dev/r/1b9a1fb99a ```php bar(); $builder->foo(); } ``` ``` Psalm output (using commit 653ad66): ERROR: UndefinedInterfaceMethod - 36:15 - Method BuilderContractB::foo does not exist ```