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.
42 lines
840 B
42 lines
840 B
--TEST--
|
|
late static calls use the exact-class fast path without bypassing subclass dispatch
|
|
--FILE--
|
|
<?php
|
|
|
|
class StaticCallBase
|
|
{
|
|
public static function data(): array
|
|
{
|
|
return [static::class, 'base'];
|
|
}
|
|
|
|
public static function label(): string
|
|
{
|
|
$data = static::data();
|
|
return $data[0] . ':' . $data[1];
|
|
}
|
|
}
|
|
|
|
class StaticCallInherited extends StaticCallBase
|
|
{
|
|
}
|
|
|
|
class StaticCallOverride extends StaticCallBase
|
|
{
|
|
public static function data(): array
|
|
{
|
|
return [static::class, 'override'];
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
var_dump(StaticCallBase::label());
|
|
var_dump(StaticCallInherited::label());
|
|
var_dump(StaticCallOverride::label());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(19) "StaticCallBase:base"
|
|
string(24) "StaticCallInherited:base"
|
|
string(27) "StaticCallOverride:override"
|
|
|