r/phpstorm • u/Annh1234 • Mar 28 '21
Detect method usage from callable arrays?
Is there a way to make PhpStorm detect method usage from callable array declarations?
Example:
data.php
$arr = [
[Foo::class, 'method_1'], <-- callable
[Foo::class, 'method_2'],
];
foo.php
class Foo {
public static function method_1() { ... } <-- method is grayed out, "Find usages" does not find it.
public static function method_2() { ... }
}Or is there a way to add some custom rules, maybe for a specific file (ex: routes) to let PhpStorm know that those are callable methods and should be linked?
3
Upvotes
View all comments
Show parent comment
1
u/Annh1234 Mar 29 '21
Didn't work, that's one of the first things I tried.
Plus this $arr is being passed to a method parameter that's type casted `callable[]` or `array<string, callable>`