Hey there. I am trying to connect to a DB in a class so I have created this class that opens a new persistent connection if one is not opened already.

PHP Code:
private static function connect(){
        if(!
self::$connection){
            try{
                
self::$connection  = new PDO($this->type.':host='.$this->host.';dbname='.$this->name$this->user$this->password);
            }

            catch(\
PDOException $e){
                die();
            }
        }
            return 
self::$connection;
    } 
but when I try to connect to the database I end up getting a "Access to undeclared static property: Fusion\Core\db::$connection" error.

Can someone point me in the right direction.

Thanks!