Variable suggestion and autocompletion

Dear phpStorm development team,

I'm totally impressed with your product, first time I tried features you added - I fought to myself - this IDE was built for me! It has all features that I;m used to and that about I always dreamed of .

Now I have several requests/bug reports:
1) I have a project that has a portion of code that is encoded with Zend, encoded part is for CMS admin side, and unencoded for client side. Admin and client side have and/or may have same duplicate file names in the project like admin.class.php. As I've spotted for some unencoded classes I cannot call autosuggestion (they are loaded in another project PHP file), maybe it's because of encoded/unencoded files having same filenames?

2) Autocompletion and autosuggestion does not show me variables that I created and used in another PHP files. Only when I type in full variable name, if it's object, then I see it's methods. It's kinda annoying.

Thats it for now!

0
7 comments

Your feedback and kind words are appreciated.

1) PhpStorm has no any support or for Zend binary format. However most features require that there's exactly one definition for any particular class in project sources (regardless of file name, includes or anything). I'm not completely understand your setup

2) Our team and many other users have no any problems with variable completion. Please try to narrow the problem and post specific example here so we can work on the problem. Be sure to indicate caret position, and describe both expected and actual behavior. Also, note that completion relies on type inference and you can check types inferred for any variables via Quick Documentation popup (Ctrl-Q in default keymap).

0

Hi Alexey,

about Zend encoded files, nevermind, I've just discovered my object method autocompletion issue.
I create $systemObj object variable with this line of code in init.inc.php file and try to call autosuggestion or autocompletion in another file:

$systemObj = system::getInstance();
but not in usual style:

$systemObj = new system();

that's why I get no autocompletion, your IDE should check if method called does return its singleton. In my case the system object returns its instance in such a way:

public static function getInstance() {

   if(self::$instance == null) {

       self::$instance = new system();

   }

 

   return self::$instance;

}

Secondly, about object visibility in project scope:
In the same init.inc.php file I create a new object in standard way:
$someObj = new someClass();

In another.php file I try to use this object and call variable autocompletion:
$some| and nothing comes up, after typing whole variable name, $someObj->| and calling autosuggestion I see all methods available to me, but's annoying

Best regards

0

Use PHPDOC annotations. Just add /** @return system */ to getInstance() or /** @var system */ to $instance field.

0

+1 for this feature.

I would also love to see "Global project level vars annotation".

For example, in symfony2 $this->get("service.id") always returns predefined class (different for each service.id).
It would be amazing if I will be able to set it in project properties and get method/properties hints everywhere I use it.

0

thanks for notice :)
Going to wait until it will be done :)

0

Please sign in to leave a comment.