How dynamically instantiated classes implement code hints in PHPStorm

you can get an instance of a class through dependency injection in Yii2 in this way

        $test = \Yii::$container->get("\common\service\test");
        $test->aa();

clicking aa () will not jump to the corresponding function, and typing $test- > will not list the methods under the test class

.

there is no code hint in the following way of writing, and clicking aa () will not jump

.
        $testClass = "\common\service\test";
        $test = new $testClass;
        $test->aa();
Mar.23,2021

add comments to see if the line is OK

$testClass = '\common\service\test';
/** @var \common\service\test $test */
$test = new $testClass;
$test->aa();

the solution found so far, for the first case
https://confluence.jetbrains.


Hello, how to solve the first situation? Do I need to download any plug-ins?

Menu