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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 06:35:17

问题


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?


回答1:


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.




回答2:


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!




回答3:


foreach($A as $AnInstance)
/*@var MyClass $AnInstance*/
$AnInstance->doSomething();


来源:https://stackoverflow.com/questions/2585736/in-zend-studio-how-to-tell-the-ide-the-type-of-a-variable-so-i-have-auto-compl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!