V
V
vitaly_742019-09-21 06:00:04
phpstorm
vitaly_74, 2019-09-21 06:00:04

How to specify the type of a class property in PHPstorm IDE?

Good afternoon, I'm using PHP storm + yii2
and I can't make the query property be of the Query type. the ultimate goal is to use in class methods $this->query with Query hints.
Now I use such a crutch - which I really do not like.

$query = $this->query;
        /**@var $query Query */
        $query->orFilterWhere([
            'and',
            ['is_company' => 0],
            ['access' => 0]
        ]);
        $this->query = $query;

And I would like this (but the IDE does not suggest methods):
$this->query = $this->query->orFilterWhere([
            'and',
            ['is_company' => 0],
            ['access' => 0]
        ]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2019-09-21
@sidni

class Someone {
/**@var Query  */
private $query
// .......
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question