Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlooks UndefinedPropertyFetch in untyped inline function #11065

Open
thena-seer-sfg opened this issue Aug 6, 2024 · 1 comment
Open

Overlooks UndefinedPropertyFetch in untyped inline function #11065

thena-seer-sfg opened this issue Aug 6, 2024 · 1 comment

Comments

@thena-seer-sfg
Copy link

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

Copy link

I found these snippets:

https://psalm.dev/r/169b4ab263
<?php
class B { }

class Query {function  where(): void {}}

class J {function whereHas(string  $s, callable $c): void {}}

class C
{
    /**
     * @return null|true
     */
    function test() { 
    	if ((new J)->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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant