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.
36 lines
586 B
36 lines
586 B
--TEST--
|
|
Trait parent:: call forwards an existing reference parameter
|
|
--FILE--
|
|
<?php
|
|
|
|
trait ParentReferenceTrait
|
|
{
|
|
public function update(string &$value): void
|
|
{
|
|
parent::update($value);
|
|
}
|
|
}
|
|
|
|
class ReferenceParent
|
|
{
|
|
public function update(string &$value): void
|
|
{
|
|
$value = 'updated';
|
|
}
|
|
}
|
|
|
|
class ReferenceChild extends ReferenceParent
|
|
{
|
|
use ParentReferenceTrait;
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$value = std::any('initial');
|
|
$child = new ReferenceChild();
|
|
$child->update($value);
|
|
var_dump($value);
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(7) "updated"
|
|
|