如何激活“转到定义”在 Eclipse 中继承类属性
我有一个基类(我们称之为 A),并且我有继承类(我们称之为 AA)。
在一个不同的抽象类中,我有:
abstract class DifferentClass{
/**
*@var A
*/
protected MyA;
}
在一个更不同的类中:
class MoreDifferent extends DifferentClass{
public function __construct(){
$this->MyA = new AA;
}
}
我的问题是,当我在继承类中按住 Ctrl+左键单击 MyA
时,它将带我到原始的 A 类文件。我希望它能带我到 AA
文件。
PHPdoc 执行此操作的方法是什么?
I have a base class (lets call it A) and I have inheriting Class (lets call it AA).
In a different abstract class I have:
abstract class DifferentClass{
/**
*@var A
*/
protected MyA;
}
In a more different class:
class MoreDifferent extends DifferentClass{
public function __construct(){
$this->MyA = new AA;
}
}
My problem is when I ctrl+left click on MyA
in the inheriting class, it will take me to the original class A file. I would like it to take me to the AA
file.
What is the PHPdoc way of doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是因为您所做的唯一“phpdoc”事情是显示受保护的 MyA 属性是“A”类型。
phpdoc 定义不会从“= new AA”代码行本身获取任何内容。
我认为您可以通过在 MoreDifferent 类中显式重新列出“受保护的 MyA”,并在其中放置一个显示“@var AA”的文档块,来在本地覆盖此行为。我真的没有看到任何其他选择来获得您所追求的行为。
I think it's because the only "phpdoc" thing you've done is show that the protected MyA property is of type "A".
The phpdoc definitions are not going to pick up anything from the " = new AA" code line itself.
I think you could potentially locally sort-of-override this behavior by making an explicit relisting of "protected MyA" in your MoreDifferent class, and put a docblock there that shows "@var AA". I don't really see any other option to get the behavior you're after.