| 
| Helping the auto-complete feature [message #55202] | Wed, 26 September 2007 13:26  |  | 
| Eclipse User  |  |  |  |  | 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 01:55  |  | 
| Eclipse User  |  |  |  |  | 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.
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03572 seconds