diff options
Diffstat (limited to 'Zend/tests/type_declarations/typed_properties_067.phpt')
-rw-r--r-- | Zend/tests/type_declarations/typed_properties_067.phpt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Zend/tests/type_declarations/typed_properties_067.phpt b/Zend/tests/type_declarations/typed_properties_067.phpt new file mode 100644 index 0000000000..da6865e5d4 --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_067.phpt @@ -0,0 +1,36 @@ +--TEST-- +Iterable typed properties must be accepted to by-ref array arguments +--FILE-- +<?php + +$obj = new class { + public ?iterable $it = null; +}; + +function arr(?array &$arr) { + $arr = [1]; +} + +arr($obj->it); +var_dump($obj->it); +array_shift($obj->it); +var_dump($obj->it); +parse_str("foo=bar", $obj->it); +var_dump($obj->it); +$obj->it = []; +var_dump($obj->it); + +?> +--EXPECT-- +array(1) { + [0]=> + int(1) +} +array(0) { +} +array(1) { + ["foo"]=> + string(3) "bar" +} +array(0) { +} |