1--TEST--
2Clone must inherit typed references
3--FILE--
4<?php
5
6class Test {
7    public int $x = 42;
8}
9
10$test = new Test;
11$x =& $test->x;
12$test2 = clone $test;
13unset($test);
14try {
15	$x = "foo";
16} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
17var_dump($test2->x);
18
19?>
20--EXPECT--
21Cannot assign string to reference held by property Test::$x of type int
22int(42)
23