Lets say I create and interface
interface IMyInterface {
function abstractMethod();
}
class MyClass implements IMyInterface {
function abstractMethod() {
//code
}
}
class OtherClass {
private $IMyInterfaceObj;
function __construct($obj) {
$this->IMyInterfaceObj = $obj;
}
}
What can I do to make sure that the object assigned to $IMyInterfaceObj is an Object that actually implements the interface, since PHP is loosely typed. Should I check the type???