Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Helping the auto-complete feature
Helping the auto-complete feature [message #55202] Wed, 26 September 2007 17:26 Go to next message
Eclipse UserFriend
Originally posted by: kgmann.us.ibm.com

In my code, I'm tossing around a single reference to an instantiated
database access class to keep things tidy and efficient. PDT properly
extracts the likely class types for variables with other names from files.
For instance, I have a class called form that I assign to $form via $form =
new form(); in quite a few files. So when I use the variable $form again,
it properly guesses the class type and the auto-complete list gives me the
list of methods in that class.

However, for my database interface class I'm trying to use a class that
contains a static variable that is instantiated by a static method. This
method then returns a reference to said static variable. Even though the
class contains the line dbiLoader::$dbi = new DBI() inside the method
(fetchDBI), PDT still won't recognize the class type if I use that method.
Furthermore, PDT seems to limit scope. Let's say I want to use the variable
$dbi inside a class. If I DO declare $dbi = new DBI() in a file, then
autocomplete works fine so long as I'm not inside a class. Once I go inside
a class, the scope goes bye-bye, even if I've created the variable $dbi by
referencing the $GLOBALS array or by using the fetchDBI() method named
above.

So my question is this: is there some way to help out the autocomplete and
say "this function returns this value" or "this variable will typically be
of THIS class type" or anything like that? Because not having any help at
all when inside a limited scope becomes frustrating.
Re: Helping the auto-complete feature [message #55258 is a reply to message #55202] Thu, 27 September 2007 05:55 Go to previous message
Eclipse UserFriend
Originally posted by: Martin.eisengardt.de

PDT uses PHPDocumentor syntax to get type hints.

examples:

/**
* this returns a new instance of class Bar
* @return Bar
*/
function foo() {
}

class Foo {
/**
* this contains a global instance of class Bar
* @var Bar
*/
static $someVar = false;
}



hope this helps. PDT does not support cross file type hints. If You are
using $foo inside file A it does not recognize this variable in file B. But
PDT supports class type and function hints across multiple files.
Previous Topic:All in one build for amd64 linux gtk
Next Topic:why does build project process prevent user actions from completing?
Goto Forum:
  


Current Time: Wed Apr 24 22:21:58 GMT 2024

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

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

Back to the top