summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance001.phpt
diff options
context:
space:
mode:
authorLevi Morrison <levim@php.net>2015-01-08 23:40:36 +0300
committerLevi Morrison <levim@php.net>2015-01-27 11:49:56 -0700
commitc8576c5a46508ce87f7d2eb2442e6a9283b6a1ce (patch)
tree65a6b0195b60631537af97e7acd726aec127c732 /Zend/tests/return_types/inheritance001.phpt
parent0290571ccfb3a440599ca009e97f2879bb1d09f0 (diff)
downloadphp-git-c8576c5a46508ce87f7d2eb2442e6a9283b6a1ce.tar.gz
Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
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