<?php
class the_class {
public $var = 'foo';
}
class my_other_class {
public function __construct(the_class $obj) {
echo $obj->var;
}
}
$a = new the_class;
$b = new my_other_class($a);
$c = new my_other_class($b);
?>
foo
Fatal error: Argument 1 must be an instance of the_class in script.php on line 6