以下是Base.php代码和类基地在phpDoc中,我如何编写一个我不知道还会返回的类?
/**
* @return ?
*/
public static function withId($id, $class = __CLASS__)
{
$instance = new $class($id);
if ($instance->getId() == self::ID_OF_UNKNOWN_USER) {
$instance = null;
}
return $instance;
}
其他类将扩展此类。我使用迟了的静态绑定来确定在调用withId()并将类名传递给$ class之前应该创建的对象。
返回的类可以是Base或其任何子类。我如何在phpDoc中标记?