PHPStorm autocomplete for results of ActiveQuery queries

I’m developing for Yii2 using PHPStorm. I’ve set up autocomplete for application components using and for variables in views using PHPDoc comments at the top of each view file. However, so far I haven’t found a way of getting types automatically assigned to the results of ActiveRecord queries (e.g.,



Is there any way I can do that besides (1) including a

/** @var $result common\models\User */

comment before each such query, or (2) wrapping all such queries in methods I declare in each model class?

Note: there’s an older post about this (by another user) in, but it seems it was resurrecting a dead thread, so I’m starting a new one. Please let me know if this is poor etiquette – I’m a long-time Yii user but new to this forum, and I can see an argument either way after reading the pinned “before posting” thread.

There’s nothing that could be done besides whay you’ve already suggested. Well, maybe except writing an IDE plugin that detects finder method and guesses the class.