سؤال

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