Return to bug60573.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Bug #60573 (type hinting with "self" keyword causes weird errors) ! 3: --FILE-- ! 4: <?php ! 5: class Foo1 { ! 6: ! 7: public function setSelf(self $s) { } ! 8: ! 9: } ! 10: ! 11: class Bar1 extends Foo1 { ! 12: ! 13: public function setSelf(parent $s) { } ! 14: ! 15: } ! 16: ! 17: class Foo2 { ! 18: ! 19: public function setSelf(Foo2 $s) { } ! 20: ! 21: } ! 22: ! 23: class Bar2 extends Foo2 { ! 24: ! 25: public function setSelf(parent $s) { } ! 26: ! 27: } ! 28: ! 29: class Base { ! 30: } ! 31: ! 32: class Foo3 extends Base{ ! 33: ! 34: public function setSelf(parent $s) { } ! 35: ! 36: } ! 37: ! 38: class Bar3 extends Foo3 { ! 39: ! 40: public function setSelf(Base $s) { } ! 41: ! 42: } ! 43: ! 44: class Foo4 { ! 45: ! 46: public function setSelf(self $s) { } ! 47: ! 48: } ! 49: ! 50: class Bar4 extends Foo4 { ! 51: ! 52: public function setSelf(self $s) { } ! 53: ! 54: } ! 55: ! 56: class Foo5 extends Base { ! 57: ! 58: public function setSelf(parent $s) { } ! 59: ! 60: } ! 61: ! 62: class Bar5 extends Foo5 { ! 63: ! 64: public function setSelf(parent $s) { } ! 65: ! 66: } ! 67: ! 68: abstract class Foo6 extends Base { ! 69: ! 70: abstract public function setSelf(parent $s); ! 71: ! 72: } ! 73: ! 74: class Bar6 extends Foo6 { ! 75: ! 76: public function setSelf(Foo6 $s) { } ! 77: ! 78: } ! 79: --EXPECTF-- ! 80: Strict Standards: Declaration of Bar4::setSelf() should be compatible with Foo4::setSelf(Foo4 $s) in %sbug60573.php on line %d ! 81: ! 82: Strict Standards: Declaration of Bar5::setSelf() should be compatible with Foo5::setSelf(Base $s) in %sbug60573.php on line %d ! 83: ! 84: Fatal error: Declaration of Bar6::setSelf() must be compatible with Foo6::setSelf(Base $s) in %sbug60573.php on line %d