mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
064b464448
RFC: https://wiki.php.net/rfc/constructor_promotion Closes GH-5291.
21 lines
260 B
PHP
21 lines
260 B
PHP
--TEST--
|
|
Constructor promotion of by-ref parameter
|
|
--FILE--
|
|
<?php
|
|
|
|
class Ary {
|
|
public function __construct(public array &$array) {}
|
|
}
|
|
|
|
$array = [];
|
|
$ary = new Ary($array);
|
|
$array[] = 42;
|
|
var_dump($ary->array);
|
|
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
[0]=>
|
|
int(42)
|
|
}
|