proget-hq / phpstan-yii2

Yii2 extension for PHPStan
MIT License
52 stars 17 forks source link

error with annotation `@return static[]` #51

Closed lesha724 closed 2 years ago

lesha724 commented 2 years ago

I have next error

 ------ ---------------------------------------------------------------------------------------------
  Line   TestModel.php
 ------ ---------------------------------------------------------------------------------------------
  14     Method common\models\TestModel::getAll() should return array<static(common\models\TestModel)> but returns array<int, common\models\TestModel>.
 ------ ----------------------------------------------------------------------------------------------

This is my example code

class TestModel extends ActiveRecord
{
    /**
     * @return static[]
     */
    public function getAll() : array
    {
        return static::find()->all();
    }
}

Version phpstan is latest (1.5.4)