public static function fromReflection(ReflectionClass $reflectionClass)
    {
        if ($reflectionClass->isInterface() !== true) {
            throw new InvalidArgumentException('The reflected class must be an interface.');
        }

        $ig = new static($reflectionClass->getShortName(), $reflectionClass->getNamespaceName());
        if ($reflectionClass->getReflectionDocComment()->isEmpty() !== true) {
            $ig->setDocumentation(DocCommentGenerator::fromReflection($reflectionClass->getReflectionDocComment()));
        }

        $extends = array();
        foreach ($reflectionClass->getOwnInterfaces() as $interface) {
            if ($interface->getNamespaceName() === $ig->getNamespace()) {
                $extends[] = $interface->getShortName();
            } else {
                $extends[] = '\\' . $interface->getName();
            }
        }
        $ig->setExtends($extends);

        foreach ($reflectionClass->getOwnConstants() as $constant) {
            $ig->addConstant(ClassConstantGenerator::fromReflection($constant));
        }

        foreach ($reflectionClass->getOwnMethods() as $method) {
            $method = MethodGenerator::fromReflection($method);
            $method->setAbstract(false);
            $ig->addMethod($method);
        }

        return $ig;
    }