nvlad / yii2support

Yii2 Support for PhpStorm / IntelliJ IDEA
https://plugins.jetbrains.com/idea/plugin/9388-yii2-support
Other
295 stars 54 forks source link

type resulution for method one not work in the ActiveRecord itself when overwrite find. #230

Closed feistiny closed 4 years ago

feistiny commented 5 years ago

What steps will reproduce the problem?

class User extends ActiveRecord {
  public static function find() {
     return new UserQuery(get_called_class());
  }
  public function test(){
     $user = User::find()->one();
     $user->doSth();
  }
  public function doSth(){

  }
}

What is the expected result?

autocomplete the doSth method.

What do you get instead?

doSth not autocomplete

Additional info

Q A
IDE Name PhpStorm
IDE Version 2019.1.2
Plugin version v0.10.57.23
Yii App Template advanced
feistiny commented 5 years ago

In other ActiveRecord, the complete is ok.

feistiny commented 5 years ago

Surely I can add phpdoc /** @var User $user*/ , but is this a bug?

malsatin commented 5 years ago

It is not about this plugin, but about phpDocs of yii2. You also need to check, if $user is null