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.
 
 

32 lines
540 B

--TEST--
Native class: method calls accept native object expressions as receivers
--FILE--
<?php
#[Native]
class NativeChainValue
{
public int $value = 42;
public function getValue(): int
{
return $this->value;
}
}
function makeNativeChainValue(): NativeChainValue
{
return new NativeChainValue();
}
function main(): void
{
echo (new NativeChainValue())->getValue(), PHP_EOL;
echo makeNativeChainValue()->getValue(), PHP_EOL;
echo makeNativeChainValue()->value, PHP_EOL;
}
?>
--EXPECT--
42
42
42