anyone of you know how to get effect like in these code
public function create(SomeInterface $obj)
{
$class = get_class($obj);
return new class extends $class {
//some magic here
}
}
Obvious that code will not work in PHP.
$obj
can be an instance of many different classes. I want to get an instance of class extending the $obj. (It will give me an ability to overload some basic methods)