Many components or properties in the Yii2 framework are dynamically loaded through configuration files.
This results in many third-party components being unable to use the IDE's automatic completion and type checking.
For exampleYii::$app->user->getIdentity()
should return the User model I defined in the configuration file.
But there is no way for the IDE to identify this configuration. As a result, in many methods, if the parameter type is restricted like public function verify(User $user)
, the IDE will report an error.
The Laraverl framework has tools like ide-helper to help the IDE identify the framework. I wonder if there is any way to solve this problem in Yii2?
Many components or properties in the Yii2 framework are dynamically loaded through configuration files.
This results in many third-party components being unable to use the IDE's automatic completion and type checking.
For exampleYii::$app->user->getIdentity()
should return the User model I defined in the configuration file.
But the IDE has no way to identify this configuration, which leads to many methods like public function verify(User $user)
limiting the parameter type IDE will report an error.
The Laraverl framework has tools like ide-helper to help the IDE identify the framework. I wonder if there is any way to solve this problem in Yii2?
There is already a solution. The author can refer to this phpstorm yii2 tip