]> granicus.if.org Git - php/commitdiff
Added tests demonstrating the same effect with abstracts
authorPedro Magalhães <mail@pmmaga.net>
Fri, 27 Jan 2017 18:44:46 +0000 (19:44 +0100)
committerJoe Watkins <krakjoe@php.net>
Sat, 28 Jan 2017 06:28:14 +0000 (06:28 +0000)
Zend/tests/bug73987.phpt
Zend/tests/bug73987_1.phpt
Zend/tests/bug73987_2.phpt [new file with mode: 0644]
Zend/tests/bug73987_3.phpt [new file with mode: 0644]

index 551565650c8c9df7a57b7bc80ae9bcb690894013..610b594a6442440f12b28b5dac8c88fbac1d0643 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
+Bug #73987 (Method compatibility check looks to original definition and not parent - nullability interface)
 --FILE--
 <?php
 
index 6a0a157f29a150339e87de7f248bc787af3418cf..010987ea5f67164dce78a9caba7f3f0fa6440a8c 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
+Bug #73987 (Method compatibility check looks to original definition and not parent - return types interface)
 --FILE--
 <?php
 
diff --git a/Zend/tests/bug73987_2.phpt b/Zend/tests/bug73987_2.phpt
new file mode 100644 (file)
index 0000000..a70f145
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73987 (Method compatibility check looks to original definition and not parent - nullabilty abstract)
+--FILE--
+<?php
+
+abstract class A {
+    abstract function example($a, $b, $c);
+}
+
+class B extends A {
+    function example($a, $b = null, $c = null) { }
+}
+
+class C extends B {
+    function example($a, $b, $c = null) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::example($a, $b, $c = NULL) must be compatible with B::example($a, $b = NULL, $c = NULL) in %s
diff --git a/Zend/tests/bug73987_3.phpt b/Zend/tests/bug73987_3.phpt
new file mode 100644 (file)
index 0000000..89e4686
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73987 (Method compatibility check looks to original definition and not parent - return types abstract)
+--FILE--
+<?php
+
+abstract class A {
+    abstract function example();
+}
+
+class B extends A {
+    function example(): int  { }
+}
+
+class C extends B {
+    function example(): string { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::example(): string must be compatible with B::example(): int in %s