Having an issue where generics on properties gives zero IDE info or autocomplete when using T of Class where Class has known methods/properties.
use Illuminate\Database\Eloquent\Model;
/**
* @template TModel of Model
*/
trait HasModel
{
/**
* @var TModel
*/
public Model $model;
public function table(): string
{
return $this->model->getTable(); // No IDE info about getTable(), even if this is part of Model
}
It works if I make an accessor model(), though.