summaryrefslogtreecommitdiff
path: root/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/object_types/return_type_inheritance_in_interface.phpt')
-rw-r--r--Zend/tests/object_types/return_type_inheritance_in_interface.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/Zend/tests/object_types/return_type_inheritance_in_interface.phpt b/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
new file mode 100644
index 0000000000..2631ec8918
--- /dev/null
+++ b/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Adding interface method a object return type during inheritance is allowed
+--FILE--
+<?php
+
+interface One {
+ public function a();
+}
+
+interface Two extends One {
+ public function a() : object;
+}
+
+$three = new class implements Two {
+ public function a() : object {
+ return 12345;
+ }
+};
+$three->a();
+
+--EXPECTF--
+Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13
+Stack trace:
+#0 %s(16): class@anonymous->a()
+#1 {main}
+ thrown in /%s on line 13