xref: /PHP-8.1/Zend/tests/bug60573_2.phpt (revision fd2db119)
1--TEST--
2Bug #60573 (type hinting with "self" keyword causes weird errors) -- variation 2
3--FILE--
4<?php
5class Foo1 {
6
7public function setSelf(self $s) { }
8
9}
10
11class Bar1 extends Foo1 {
12
13public function setSelf(parent $s) { }
14
15}
16
17class Foo2 {
18
19public function setSelf(Foo2 $s) { }
20
21}
22
23class Bar2 extends Foo2 {
24
25public function setSelf(parent $s) { }
26
27}
28
29class Base {
30}
31
32class Foo3 extends Base{
33
34public function setSelf(parent $s) { }
35
36}
37
38class Bar3 extends Foo3 {
39
40public function setSelf(Base $s) { }
41
42}
43
44class Foo4 {
45
46public function setSelf(self $s) { }
47
48}
49
50class Foo5 extends Base {
51
52public function setSelf(parent $s) { }
53
54}
55
56class Bar5 extends Foo5 {
57
58public function setSelf(parent $s) { }
59
60}
61
62?>
63--EXPECTF--
64Fatal error: Declaration of Bar5::setSelf(Foo5 $s) must be compatible with Foo5::setSelf(Base $s) in %sbug60573_2.php on line %d
65