summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance001.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/return_types/inheritance001.phpt')
-rw-r--r--Zend/tests/return_types/inheritance001.phpt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Zend/tests/return_types/inheritance001.phpt b/Zend/tests/return_types/inheritance001.phpt
new file mode 100644
index 0000000000..ce33d97995
--- /dev/null
+++ b/Zend/tests/return_types/inheritance001.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Return type covariance; extends class
+
+--FILE--
+<?php
+
+class A {
+ function foo(): A {}
+}
+
+class B extends A {
+ function foo(): StdClass {}
+}
+
+--EXPECTF--
+Fatal error: Declaration of B::foo() must be compatible with A::foo(): A in %s on line %d