Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Eclipse PDT Auto-Complete doesn't suggest Class methods
Eclipse PDT Auto-Complete doesn't suggest Class methods [message #1071492] Sat, 20 July 2013 04:32 Go to next message
Hamed Kamrava is currently offline Hamed Kamrava
Messages: 8
Registered: July 2013
Junior Member
Hi there

I'm using Eclipse Kepler 4.3 + PDT.

when i'm typing below :

$db-> (Ctrl+Space)


It doesn't suggest `$db` methods!

Any ideas?

Regards
Re: Eclipse PDT Auto-Complete doesn't suggest Class methods [message #1072519 is a reply to message #1071492] Mon, 22 July 2013 20:08 Go to previous messageGo to next message
Valery Cheban is currently offline Valery Cheban
Messages: 17
Registered: January 2013
Junior Member
Hello,
What type has variable $db?
You can use /** @var $db ClassDbName */ comment, where ClassDbName is type of variable $db

[Updated on: Mon, 22 July 2013 20:09]

Report message to a moderator

Re: Eclipse PDT Auto-Complete doesn't suggest Class methods [message #1072681 is a reply to message #1072519] Tue, 23 July 2013 05:14 Go to previous messageGo to next message
Hamed Kamrava is currently offline Hamed Kamrava
Messages: 8
Registered: July 2013
Junior Member
Valery Cheban wrote on Mon, 22 July 2013 20:08
Hello,
What type has variable $db?

$db = DBConnection::getInstance();


But when i'm trying following, it works fine :
$db = new DBConnection();
Re: Eclipse PDT Auto-Complete doesn't suggest Class methods [message #1072860 is a reply to message #1072681] Tue, 23 July 2013 13:02 Go to previous messageGo to next message
Valery Cheban is currently offline Valery Cheban
Messages: 17
Registered: January 2013
Junior Member
You can use two scenario or both:
1. phpDoc in getInstance() method
2. /* @var $db DBConnection */ - comment, if phpDoc wont work.

See example:
/**
 * @property int test more magic-property in code hints
 * @method string test_method() more magic-method in code hints
 */
class DBConnection {
	// ...
	public $db_name;
	public $db_user;
	/**
	 * return DBConnection Instance
	 * @return DBConnection 
	 */
	static function getInstance() {
	}
	// ...
}

$db = DBConnection::getInstance();
$db->| // see all of DBConnection 

//or this:
$db_fix = null;
/* @var $db_fix DBConnection */  // tell pdt $db_fix-type
$db_fix->| // see all of DBConnection 

[Updated on: Tue, 23 July 2013 13:08]

Report message to a moderator

Re: Eclipse PDT Auto-Complete doesn't suggest Class methods [message #1072958 is a reply to message #1072860] Tue, 23 July 2013 16:58 Go to previous message
Hamed Kamrava is currently offline Hamed Kamrava
Messages: 8
Registered: July 2013
Junior Member
Thank You.

It's working like a charm. Shocked
Previous Topic:Eclipse PDT and XDebug 2.2.2
Next Topic:Color Picker plugin
Goto Forum:
  


Current Time: Thu Apr 24 11:24:58 EDT 2014

Powered by FUDForum. Page generated in 0.32476 seconds