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
463 B

--TEST--
clone operand expression is evaluated once and __clone runs
--FILE--
<?php
class CloneSideEffect
{
public int $value = 1;
public function __clone()
{
echo "__clone\n";
$this->value++;
}
}
function make_clone_source(): CloneSideEffect
{
echo "make\n";
return new CloneSideEffect();
}
function main(): void
{
$copy = clone make_clone_source();
var_dump($copy->value);
}
?>
--EXPECT--
make
__clone
int(2)