public static function createFromInstance($object) : ReflectionClass
    {
        if (! is_object($object)) {
            throw new InvalidArgumentException('Can only create from an instance of an object');
        }

        $className = get_class($object);

        if (strpos($className, ReflectionClass::ANONYMOUS_CLASS_NAME_PREFIX) === 0) {
            $reflector = new ClassReflector(new AnonymousClassObjectSourceLocator(
                $object,
                (new BetterReflection())->phpParser()
            ));
        } else {
            $reflector = (new BetterReflection())->classReflector();
        }

        return new self($reflector, $reflector->reflect($className), $object);
    }