Netbeans 不突出显示使用不存在函数的代码 - php
我在 PHP 和 NetBeans 7.0 中使用以下行:
$ret = $this->stupid_function();
我当然知道 stupid_function
在此类中不存在或其任何衍生品。
“导航到源代码/声明”
我无处可去。
但 NetBeans 似乎仍然没有将该行标记为错误。
- 我尝试重新启动 Netbeans
- 我尝试重新添加项目
- 我尝试删除缓存
似乎没有任何效果...
不过,我观察到,如果我从该语句中删除 $this
,NetBeans 知道该函数不会不存在。 NetBeans 似乎无法正确理解 $this
。
在 NetBeans 中使用 PHP 时如何突出显示引用不存在函数的代码?
I am using the following line in PHP with NetBeans 7.0 :
$ret = $this->stupid_function();
I certainly know that stupid_function
doesn't exist in this class or any derivative of this.
"Navigate to source/declaration"
takes me nowhere.
But still NetBeans doesn't seem to mark the line as error.
- I tried restarting Netbeans
- I tried re-adding the project
- I tried deleting cache
Nothing seems to work...
Although, I observed that if I removed $this
from that statement, NetBeans knows that the function doesn't exist. It seems like NetBeans doesn't understand $this
properly.
How to highlight code referencing nonexistent function when using PHP in NetBeans?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Netbeans 中对 PHP 突出显示的支持相当有限。
检查工具 -> 编辑器 -> 提示
选择 PHP。
您在这里有关于代码中可能的错误/警告的受支持提示的完整列表。 7.0 中的“实验性”选项对我来说没有任何作用(因此“未知函数提示”失败),7.1 中的情况稍好一些,但仍然不起作用。事实上,在 7.1 中,他们从列表中删除了未知函数提示。
看来 Netbeans 7.2 提高了突出显示的质量。如果您使用 PHP,我建议您下载最新版本的 Netbeans。
The support for PHP highlighting is rather limited in Netbeans.
Check in Tools -> Editor -> Hints
Choose PHP.
You have here the full list of supported hints about possible errors/warnings in the code. Nothing works for me among the
Experimental
options (so Unknow function hints fails) in 7.0, it's slightly better in 7.1, but still doesn't work. Indeed in 7.1 they removed the Unknow function hints from the list.Seems that Netbeans 7.2 has improved the highlightings quality. If you're in PHP I suggest you download the latest version of Netbeans.
我认为你应该在你的类中使用 PHP 的魔术方法功能。
I think you should use the magic method functionality of PHP in your class.