- 简化方法指针获取条件判断 - 使用内部类检查替代抽象方法和重写方法检查 - 移除不必要的方法标志位检测 - 重构动态调用测试用例pull/3/head
parent
23f1a1eef9
commit
7eeb416f6a
2 changed files with 34 additions and 6 deletions
@ -0,0 +1,33 @@ |
||||
--TEST-- |
||||
call overridden method through parent parameter type |
||||
--FILE-- |
||||
<?php |
||||
class Base |
||||
{ |
||||
static function create() { |
||||
return new Impl; |
||||
} |
||||
} |
||||
|
||||
class Impl extends Base |
||||
{ |
||||
public function run(): string |
||||
{ |
||||
return 'impl'; |
||||
} |
||||
} |
||||
|
||||
function get_impl(): Base |
||||
{ |
||||
$obj = Base::create(); |
||||
return $obj; |
||||
} |
||||
|
||||
function main(): int |
||||
{ |
||||
$impl = get_impl(); |
||||
echo "result: " . $impl->run() . "\n"; |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
result: impl |
||||
Loading…
Reference in new issue