TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
707 B
34 lines
707 B
--TEST--
|
|
Dynamic static method name on object target uses the runtime method value
|
|
--FILE--
|
|
<?php
|
|
|
|
class DynamicObjectStaticTarget
|
|
{
|
|
public static function reward(string $value): string
|
|
{
|
|
return 'base:' . $value;
|
|
}
|
|
}
|
|
|
|
class DynamicObjectStaticChild extends DynamicObjectStaticTarget
|
|
{
|
|
public static function reward(string $value): string
|
|
{
|
|
return 'child:' . $value;
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$method = 'reward';
|
|
$target = new DynamicObjectStaticTarget();
|
|
$child = new DynamicObjectStaticChild();
|
|
|
|
var_dump($target::$method('first'));
|
|
var_dump($child::$method(value: 'second'));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(10) "base:first"
|
|
string(12) "child:second"
|
|
|