在 PDT 我可以做
/* @var $this MyClass */
并且 Eclipse 将使用它来进行自动完成、建议等......它在模板文件中很有用,这些模板文件被包含在模板引擎的类的函数中。
Aptana Studio 3 是否有同等功能?
我也试过
/** @var $this MyClass */
和
/** @var MyClass $this */
编辑
我正在评估 Aptana 的使用,它比 Eclipse + PDT 有一些优势。因此,“使用另一个 IDE”并不是真正的答案。
$this
IDE不会自动将其解析为正确的类,因为它是在类定义之外使用的。
示例用法:
模板.class.php:
class Template { public function render() { include 'template.inc.php'; } private function foo() { echo 'bar!'; } }
模板.inc.php
<?php /*@var $this Template*/ ?> <html> <body> <?php /* I want that when I type "$this->" the IDE suggests me "foo()" */ $this->foo(); ?> </body> </html>