public static createFromInstance ( object $object ) : |
||
$object | object | |
return |
public static function createFromInstance($object)
{
if (gettype($object) !== 'object') {
throw new \InvalidArgumentException('Can only create from an instance of an object');
}
$reflector = ClassReflector::buildDefaultReflector();
$reflectionClass = $reflector->reflect(get_class($object));
return new self($reflector, $reflectionClass, $object);
}
/** * Create a ReflectionClass from an instance, using default reflectors etc. * * This is simply a helper method that calls ReflectionObject::createFromInstance(). * * @see ReflectionObject::createFromInstance * @param object $instance * @return ReflectionClass */ public static function createFromInstance($instance) { if (gettype($instance) !== 'object') { throw new \InvalidArgumentException('Instance must be an instance of an object'); } return ReflectionObject::createFromInstance($instance); }