In Zend studio, how to tell the ide the type of a variable, so I have auto completion?
Asked Answered
V

3

5

In php we use includes. So variables defined in one file and then their scope spans included files too. Zend studio has no idea how to get the type of the variable I am using inside an included file, this is very annoying when the variable type is a big class.
Is there a way to hint the ide about variable types? in included files?

Vaasta answered 6/4, 2010 at 13:49 Comment(2)
use the @var and @return annotationsDoris
@Doris sure, but where? remember I defined those variable in a file that includes the current one.Vaasta
V
3

I have an article on some code completion tips Zend Studio and PDT Code Completion Tips that might help. However, it is a good idea to try and limit the variables that required from other files. It can quite easily make for difficult to maintain code.

Valediction answered 6/4, 2010 at 16:1 Comment(0)
D
4

Here is a manual entry of the very old Zend Studio 5.

/* @var $router \Core\Router */
$router = Registry::get("router");
$router->route();

This feature is also works in new Zend Studio including version 10!

Demimonde answered 22/5, 2013 at 8:33 Comment(0)
V
3

I have an article on some code completion tips Zend Studio and PDT Code Completion Tips that might help. However, it is a good idea to try and limit the variables that required from other files. It can quite easily make for difficult to maintain code.

Valediction answered 6/4, 2010 at 16:1 Comment(0)
V
1
foreach($A as $AnInstance)
/*@var MyClass $AnInstance*/
$AnInstance->doSomething();
Vaasta answered 7/4, 2010 at 1:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.