Skip to main content


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 08:32 Go to next message
Hamed Kamrava is currently offline Hamed KamravaFriend
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] Tue, 23 July 2013 00:08 Go to previous messageGo to next message
Valery Cheban is currently offline Valery ChebanFriend
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: Tue, 23 July 2013 00: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 09:14 Go to previous messageGo to next message
Hamed Kamrava is currently offline Hamed KamravaFriend
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 17:02 Go to previous messageGo to next message
Valery Cheban is currently offline Valery ChebanFriend
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 17: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 20:58 Go to previous message
Hamed Kamrava is currently offline Hamed KamravaFriend
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: Tue Mar 19 02:15:31 GMT 2024

Powered by FUDForum. Page generated in 0.01704 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top