xref: /php-src/Zend/tests/bug60573.phpt (revision fd2db119)
1--TEST--
2Bug #60573 (type hinting with "self" keyword causes weird errors)
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 Bar4 extends Foo4 {
51
52public function setSelf(self $s) { }
53
54}
55
56?>
57--EXPECTF--
58Fatal error: Declaration of Bar4::setSelf(Bar4 $s) must be compatible with Foo4::setSelf(Foo4 $s) in %s on line %d
59