PHP 7.2中abstract function override的用法
发布时间:2020-06-19 13:30:19
来源:亿速云
阅读:107
作者:鸽子
关于 PHP 7.2 abstract function override 的使用abstract class KeyManagerAbstract
{
/**
* 类似于
*
* return [
* self::UCC_USER_DETAIL => ["ucc:user:h:%d", 10],
* ];
*
* @return array
*/
abstract protected static function hashMap();
public static function getHashKey(string $format, int $id)
{
}
}
class KeyManager extends KeyManagerAbstract
{
protected static function hashMap()
{
// TODO: Implement hashMap() method.
}
}
php 7.2 之前这样写是会报错Fatal error: Can't inherit abstract function
php 7.2 则支持了abstract function override