在Zend studio中,如何告诉ide变量的类型,以便我有自动完成功能?

发布于 2024-08-28 05:15:11 字数 143 浏览 3 评论 0原文

在php中我们使用include。因此,变量在一个文件中定义,然后它们的范围也跨越包含的文件。 Zend studio 不知道如何获取我在包含文件中使用的变量的类型,当变量类型是一个大类时,这非常烦人。
有没有办法提示 ide 有关变量类型的信息?在包含的文件中?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你穿错了嫁妆 2024-09-04 05:15:11

这是手动输入旧的 Zend Studio 5。

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

此功能也适用于新的 Zend Studio,包括版本 10!

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!

暮凉 2024-09-04 05:15:11

我有一篇关于一些代码完成技巧的文章 Zend Studio 和 PDT 代码完成技巧 这可能会有所帮助。但是,尝试限制其他文件所需的变量是个好主意。它很容易导致代码难以维护。

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.

氛圍 2024-09-04 05:15:11
foreach($A as $AnInstance)
/*@var MyClass $AnInstance*/
$AnInstance->doSomething();
foreach($A as $AnInstance)
/*@var MyClass $AnInstance*/
$AnInstance->doSomething();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文