- 创建新的AOT类型声明测试文件 011.phpt - 添加Foo1和Foo2类定义用于测试 - 实现main函数测试any类型处理逻辑 - 添加随机对象创建和方法调用验证 - 设置期望输出格式匹配规则pull/1/head
parent
28b6c6e726
commit
77e0268f0a
1 changed files with 30 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||||
|
--TEST-- |
||||||
|
Type Declarations |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
class Foo1 { |
||||||
|
public function run() { |
||||||
|
var_dump(__METHOD__); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class Foo2 { |
||||||
|
public function run() { |
||||||
|
var_dump(__METHOD__); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() { |
||||||
|
$rand = random_int(0, 10000); |
||||||
|
if ($rand % 2) { |
||||||
|
$o = any(new Foo1()); |
||||||
|
} else { |
||||||
|
$o = any(new Foo2()); |
||||||
|
} |
||||||
|
if (method_exists($o, 'run')) { |
||||||
|
$o->run(); |
||||||
|
} |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECTF-- |
||||||
|
string(9) "Foo%d::run" |
||||||
Loading…
Reference in new issue