Question

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?

Était-ce utile?

La solution

You need to add comment in your parent class :

class Model {
    /**
     * @var PDO $database
     */
    protected $database = null;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top