summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_002.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/type_declarations/typed_properties_002.phpt')
-rw-r--r--Zend/tests/type_declarations/typed_properties_002.phpt15
1 files changed, 15 insertions, 0 deletions
diff --git a/Zend/tests/type_declarations/typed_properties_002.phpt b/Zend/tests/type_declarations/typed_properties_002.phpt
new file mode 100644
index 0000000000..3aec7a34ba
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_002.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test typed properties error condition (read uninitialized)
+--FILE--
+<?php
+$thing = new class() {
+ public int $int;
+};
+
+var_dump($thing->int);
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Typed property class@anonymous::$int must not be accessed before initialization in %s:6
+Stack trace:
+#0 {main}
+ thrown in %s on line 6