1--TEST--
2Typed property assignment by ref with variable name
3--FILE--
4<?php
5
6class Test {
7    public int $prop;
8}
9
10$name = new class {
11    public function __toString() {
12        return 'prop';
13    }
14};
15
16$test = new Test;
17$ref = "foobar";
18try {
19    $test->$name =& $ref;
20} catch (TypeError $e) {
21    echo $e->getMessage(), "\n";
22}
23var_dump($test);
24
25?>
26--EXPECT--
27Typed property Test::$prop must be int, string used
28object(Test)#2 (0) {
29  ["prop"]=>
30  uninitialized(int)
31}
32