我有界面:
interface AbstractMapper
{
public function objectToArray(ActiveRecordBase $object);
}
和类:
class ActiveRecordBase
{
...
}
class Product extends ActiveRecordBase
{
...
}
========
但我不能这样做:
interface ExactMapper implements AbstractMapper
{
public function objectToArray(Product $object);
}
或这个:
interface ExactMapper extends AbstractMapper
{
public function objectToArray(Product $object);
}
我收到错误“声明必须兼容”
有没有办法在 PHP 中做到这一点?