用于魔术调用静态方法的PHPStorm代码完成(使用花括号语法)[Pendant]

Using the following code, the code completion works fine!

class FooClass
{
    public function run(){}
}

/**
 * @method static FooClass foo(bool $param1 = false)
 */

class Test
{
    public static function __callStatic($name, $arguments)
    {
        //Implementation code ..
    }
}

//Code completes fine for FooClass methods ..
Test::foo()->run();

But, its possible to IDE (PhpStorm) complete the code using the following php invocation method write style (Curly braces)?

//Code NOT completes fine ..
Test::{"foo"}();

If so, how? Thanks for the help!

PhpStorm doesn't support dynamic fields/methods. For a static tool, it's hard to track which field/method is actually accessed. Let's take a look at a more realistic example.

function foo($str) {
    //Code NOT completes fine ..
    Test::{$str}()->run();
}

This is how the dynamic invocation usually looks like. In a real code, $str is typically a combination of an external input (e.g. from a database) and business logic. Both are beyond the possibilities of a static analysis.