1--TEST--
2ReflectionClass::setStaticPropertyValue() - type constraints must be enforced
3--FILE--
4<?php
5
6class Test {
7    public static $x;
8    public static int $y = 2;
9}
10
11$rc = new ReflectionClass('Test');
12
13try {
14	$rc->setStaticPropertyValue("y", "foo");
15} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
16var_dump(Test::$y);
17
18$rc->setStaticPropertyValue("y", "21");
19var_dump(Test::$y);
20
21
22Test::$x =& Test::$y;
23
24try {
25	$rc->setStaticPropertyValue("x", "foo");
26} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
27var_dump(Test::$y);
28
29$rc->setStaticPropertyValue("x", "42");
30var_dump(Test::$y);
31
32?>
33--EXPECT--
34Typed property Test::$y must be int, string used
35int(2)
36int(21)
37Cannot assign string to reference held by property Test::$y of type int
38int(21)
39int(42)
40