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 56class Foo5 extends Base { 57 58public function setSelf(parent $s) { } 59 60} 61 62class Bar5 extends Foo5 { 63 64public function setSelf(parent $s) { } 65 66} 67 68abstract class Foo6 extends Base { 69 70abstract public function setSelf(parent $s); 71 72} 73 74class Bar6 extends Foo6 { 75 76public function setSelf(Foo6 $s) { } 77 78} 79--EXPECTF-- 80Warning: Declaration of Bar4::setSelf(Bar4 $s) should be compatible with Foo4::setSelf(Foo4 $s) in %sbug60573.php on line %d 81 82Warning: Declaration of Bar5::setSelf(Foo5 $s) should be compatible with Foo5::setSelf(Base $s) in %sbug60573.php on line %d 83 84Fatal error: Declaration of Bar6::setSelf(Foo6 $s) must be compatible with Foo6::setSelf(Base $s) in %sbug60573.php on line %d 85