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.
35 lines
615 B
35 lines
615 B
--TEST--
|
|
Devirtualize: overridden method stays dynamic (no false devirtualization)
|
|
--FILE--
|
|
<?php
|
|
|
|
class Parent_ {
|
|
public function greet(): string {
|
|
return "parent";
|
|
}
|
|
|
|
public function sayHello(): string {
|
|
return $this->greet();
|
|
}
|
|
}
|
|
|
|
class Child_ extends Parent_ {
|
|
public function greet(): string {
|
|
return "child";
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
$parent = new Parent_();
|
|
var_dump($parent->sayHello());
|
|
|
|
$child = new Child_();
|
|
var_dump($child->sayHello());
|
|
var_dump($child->greet());
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(6) "parent"
|
|
string(5) "child"
|
|
string(5) "child"
|
|
|