0
<?php
interface iFoo {
public function print(): iFoo;
}
class Foo implements iFoo {
public function print(): iFoo {
return $this;
}
public function chain(): iFoo {
return $this;
}
}
$foo = new Foo();
$foo->print()
->chain() // Method 'chain' not found in iFoo
->print();
即使不在合同中,我如何使PhpStorm识别链式方法?PhpStorm无法识别不在接口中的方法
它不会因为它不符合合同,我也不能将Foo设置为接口中的返回类型。 –