fork download
  1. <?
  2. class Dummy{}
  3. class Test extends ArrayObject{
  4. public function append(Dummy $value){
  5. parent::append($value);
  6. }
  7.  
  8. public function offsetSet($index, Dummy $value){
  9. parent::offsetSet($index,$value);
  10. }
  11. }
  12.  
  13. $d = new Dummy();
  14. $t = new Test();
  15. $t->append($d);
  16. //$t->append('a'); // throws error as expected
  17.  
Runtime error #stdin #stdout 0.02s 13616KB
stdin
Standard input is empty
stdout
Fatal error: Declaration of Test::offsetSet() must be compatible with that of ArrayAccess::offsetSet() in /home/XEAfxY/prog.php on line 11