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, $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.  
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
object(Test)#2 (1) {
  [0]=>
  object(Dummy)#1 (0) {
  }
}