<?php
class Test {
    public string $x;
}
function test() {
    $test = new Test;
    $test->x = "";
    $r =& $test->x;
    +($r = $y);
}
try {
    test();
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}