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.
39 lines
764 B
39 lines
764 B
--TEST--
|
|
By-reference variadic signatures remain compatible across interfaces and inheritance
|
|
--FILE--
|
|
<?php
|
|
declare(strict_types=1);
|
|
|
|
interface IncrementContract
|
|
{
|
|
public function increment(int &...$values): void;
|
|
}
|
|
|
|
abstract class IncrementBase implements IncrementContract
|
|
{
|
|
abstract public function increment(int &...$values): void;
|
|
}
|
|
|
|
final class Incrementer extends IncrementBase
|
|
{
|
|
public function increment(int &...$values): void
|
|
{
|
|
foreach ($values as &$value) {
|
|
$value++;
|
|
}
|
|
unset($value);
|
|
}
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$incrementer = new Incrementer();
|
|
$first = 10;
|
|
$second = 20;
|
|
$incrementer->increment($first, $second);
|
|
var_dump($first, $second);
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(11)
|
|
int(21)
|
|
|