summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_082.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/type_declarations/typed_properties_082.phpt')
-rw-r--r--Zend/tests/type_declarations/typed_properties_082.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/type_declarations/typed_properties_082.phpt b/Zend/tests/type_declarations/typed_properties_082.phpt
new file mode 100644
index 0000000000..1e4e62e89b
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_082.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test typed references to static properties
+--FILE--
+<?php
+
+class Test {
+ public static int $x = 0;
+}
+
+class Test2 extends Test {
+ public static $y = 1;
+}
+
+$x =& Test::$x;
+try {
+ $x = "foo";
+} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
+var_dump($x, Test::$x);
+
+Test::$x =& Test2::$y; // remove the typed ref from $x
+$x = "foo";
+var_dump($x, Test::$x);
+
+?>
+--EXPECT--
+Cannot assign string to reference held by property Test::$x of type int
+int(0)
+int(0)
+string(3) "foo"
+int(1)