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.
 
 

41 lines
556 B

--TEST--
call method overridden in grandchild through base parameter
--FILE--
<?php
use native_types;
class Base
{
public function value(): string
{
return 'base';
}
}
class Middle extends Base
{
}
class Leaf extends Middle
{
public function value(): string
{
return 'leaf';
}
}
function readValue(Base $obj): string
{
$alias = $obj;
return $alias->value();
}
function main(): int
{
$r = readValue(new Leaf());
echo "result: $r\n";
return $r === 'leaf' ? 0 : 1;
}
?>
--EXPECT--
result: leaf