1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00

Added tests demonstrating the same effect with abstracts

This commit is contained in:
Pedro Magalhães
2017-01-27 19:44:46 +01:00
committed by Joe Watkins
parent b67eb3440b
commit c11b2b809d
4 changed files with 42 additions and 2 deletions
+1 -1
View 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
+1 -1
View 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
+20
View File
@@ -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
+20
View File
@@ -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