문제

So I have Model class:

class Model {
    protected $database = null;

    protected function __construct() {
        $this->database = new PDO(DB_TYPE.':dbname='.DB_NAME.';host='.DB_HOST, 
                DB_USER, DB_PASS);
        $this->database-> //Here intellisense works
    }
}

And I also have class that extends it

class Queries extends Model {
    ...
    public function example(){
        $this->database-> //Here intellisense doesn't works
    }
    ...
}

Why intellisense doesn't work for Queries?

도움이 되었습니까?

해결책

You need to add comment in your parent class :

class Model {
    /**
     * @var PDO $database
     */
    protected $database = null;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top