vimeo / psalm

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

Overlooks UndefinedPropertyFetch in untyped inline function #11065

Open thena-seer-sfg opened 1 month ago

thena-seer-sfg commented 1 month ago

Seems like lin 14 should get a UndefinedPropertyFetch similar to line 17 but doesnot: https://psalm.dev/r/169b4ab263

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

I found these snippets:

https://psalm.dev/r/169b4ab263 ```php whereHas('role', fn ($query) => $query->where('name', B::$AAA))) { return true; } if ((new J)->whereHas('role', fn (Query $query) => $query->where('name', B::$AAA))) { return true; } } } ``` ``` Psalm output (using commit 16b24bd): INFO: MixedMethodCall - 14:59 - Cannot determine the type of $query when calling method where INFO: MissingClosureParamType - 14:40 - Parameter $query has no provided type INFO: MissingClosureReturnType - 14:36 - Closure does not have a return type, expecting mixed ERROR: UndefinedPropertyFetch - 17:79 - Static property B::$AAA is not defined ERROR: TooManyArguments - 17:65 - Too many arguments for method Query::where - saw 2 INFO: PossiblyUnusedParam - 6:36 - Param #1 is never referenced in this method INFO: PossiblyUnusedParam - 6:49 - Param #2 is never referenced in this method INFO: UnusedClass - 8:7 - Class C is never used ```