Skip to content

Commit c11b2b8

Browse files
pmmagakrakjoe
authored andcommitted
Added tests demonstrating the same effect with abstracts
1 parent b67eb34 commit c11b2b8

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

Zend/tests/bug73987.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Bug #73987 (Method compatibility check looks to original definition and not parent)
2+
Bug #73987 (Method compatibility check looks to original definition and not parent - nullability interface)
33
--FILE--
44
<?php
55

Zend/tests/bug73987_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Bug #73987 (Method compatibility check looks to original definition and not parent)
2+
Bug #73987 (Method compatibility check looks to original definition and not parent - return types interface)
33
--FILE--
44
<?php
55

Zend/tests/bug73987_2.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #73987 (Method compatibility check looks to original definition and not parent - nullabilty abstract)
3+
--FILE--
4+
<?php
5+
6+
abstract class A {
7+
abstract function example($a, $b, $c);
8+
}
9+
10+
class B extends A {
11+
function example($a, $b = null, $c = null) { }
12+
}
13+
14+
class C extends B {
15+
function example($a, $b, $c = null) { }
16+
}
17+
18+
?>
19+
--EXPECTF--
20+
Fatal error: Declaration of C::example($a, $b, $c = NULL) must be compatible with B::example($a, $b = NULL, $c = NULL) in %s

Zend/tests/bug73987_3.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #73987 (Method compatibility check looks to original definition and not parent - return types abstract)
3+
--FILE--
4+
<?php
5+
6+
abstract class A {
7+
abstract function example();
8+
}
9+
10+
class B extends A {
11+
function example(): int { }
12+
}
13+
14+
class C extends B {
15+
function example(): string { }
16+
}
17+
18+
?>
19+
--EXPECTF--
20+
Fatal error: Declaration of C::example(): string must be compatible with B::example(): int in %s

0 commit comments

Comments
 (0)