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?

Was it helpful?

Solution

You need to add comment in your parent class :

class Model {
    /**
     * @var PDO $database
     */
    protected $database = null;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top