@ -1573,7 +1573,7 @@ class CompilerBase extends \PhpAot\Core\Translator
$this->fatalError($v, 'The return type is `' . $returnClass . '`, cannot return an instance of `' . $objectClass . '`');
}
// 把子类当做父类返回时,父类必须是抽象类或者接口
if ($objectClass and $objectClass !== $returnClass and !$this->isAbstractClass($returnClass) and !$this->hasInterface($returnClass)) {
if ($objectClass and $objectClass !== $returnClass and !$this->isAbstractClass($returnClass) and !$this->hasInterface($returnClass) and !$this->isInternalInterface($returnClass)) {
$this->fatalError($v, "When returning a subclass `$objectClass` instance as parent type, the parent class `$returnClass` must be abstract/interface");
}
}
@ -3564,6 +3564,19 @@ class CompilerBase extends \PhpAot\Core\Translator
if ($classDef->implements and in_array($expected, $classDef->implements)) {