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.
 
 

33 lines
596 B

--TEST--
Devirtualize: private method always uses native call (not virtual)
--FILE--
<?php
class Base {
private function value(): string {
return "base-private";
}
public function getValue(): string {
return $this->value();
}
private function withArg(int $n): string {
return "num:" . $n;
}
public function testArg(): string {
return $this->withArg(42);
}
}
function main() {
$base = new Base();
var_dump($base->getValue());
var_dump($base->testArg());
}
?>
--EXPECT--
string(12) "base-private"
string(6) "num:42"