假设我有一组类
class A {
use Dummy;
function getB() : B { ... }
}
class B {
function foo() { ... }
}
trait Dummy {
function works() {
if ($this instanceof A)
$this -> getB() -> foo(); // Typehinting works
}
function doesntWork() {
$this -> getB() -> foo(); // Method foo not found in...
}
}
如何让 PhpStorm 按照方法中的假设进行类型提示工作doesntWork
?我真的很生气,因为我的很多工作都依赖于在这样的特征中使用主类方法,而且我在 PhpStorm 中得到了很多令人分心的黄色......