1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php interface Eatable { public function eat(); } class A implements Eatable { public function eat() {return 1;} } function foo(Eatable $obj) { return $obj->eat(); } foo(null); // FAIL ?>
1 2
Catchable fatal error: Argument 1 passed to foo() must implement interface Eatable, null given, called in /t.php on line 15 and defined on line 11