I have a small problem with code insight in a project I'm working on. I've defined a class with a static method to return a PDO resource database connection. The code is this:
class dbConn {
private static $conn;
private function __construct(){}
static public function getConn ($dsn, $user, $pass) {
if (is_null(self::$conn)) {
self::$conn = new PDO($dsn, $user, $pass);
}
return self::$conn;
}
} |
I'm using this code in the constructor of another class to get a database connection with the following code:
$this->db = dbConn::getConn($conn, $user, $pass);
|
The problem is that $this->db is not recognised by PHPED as a PDO resource. When I use the property the IDE doesn't give me any code insight on the property meaning I have to manually type all of the methods, etc. Is this a bug or is there anything I can do to force code insight to recognise $this->db as a PDO resource?
Thanks.