1--TEST--
2Test typed properties yield reference guard
3--FILE--
4<?php
5$foo = new class {
6    public int $foo = 1;
7    public int $bar = 3;
8    public int $baz = 5;
9    public int $qux = PHP_INT_MAX;
10
11    public function &fetch() {
12        yield $this->foo;
13        yield $this->bar;
14        yield $this->baz;
15        yield $this->qux;
16    }
17};
18
19try {
20    foreach ($foo->fetch() as &$prop) {
21        $prop += 1;
22    }
23} catch (Error $e) { echo $e->getMessage(), "\n"; }
24
25var_dump($foo);
26?>
27--EXPECTF--
28Cannot assign float to reference held by property class@anonymous::$qux of type int
29object(class@anonymous)#1 (4) {
30  ["foo"]=>
31  int(2)
32  ["bar"]=>
33  int(4)
34  ["baz"]=>
35  int(6)
36  ["qux"]=>
37  &int(%d)
38}
39