N
N
Natalia2016-11-07 15:53:27
Yii
Natalia, 2016-11-07 15:53:27

How to change property type for PhpStorm project?

Foreword:
I am using Yii2, in the core of which, using PhpDoc, the property type is specified

/**
 * ....
 * @property IdentityInterface|null $identity The identity object associated with the currently logged-in
 * .....
 */
class User extends Component{
}

The Yii2 core is downloaded, lies in the project, and the storm considers this \Yii::$app->user->identity property, respectively, as an object of a class that implements IdentityInterface.
Problem:
The same Yii2 allows you to specify your class, the object of which will be returned when calling \Yii::$app->user->identity.
But my class has additional public methods besides those defined in IdentityInterface and I want the storm to prompt me for them.
Of course, you can change the core file, but when updating the packages on the server and downloading them, all my changes will be lost.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-11-07
@webinar

add hints where you want:

/**
 * @var $user /common/mydir/MyUserComponent
 */
$user = Yii::$app->user;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question