public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName)
    {
        $isRequired = '!' === $argType[\strlen($argType) - 1];
        $isMultiple = '[' === $argType[0];
        $endIndex = ($isRequired ? 1 : 0) + ($isMultiple ? 1 : 0);
        $type = \substr($argType, $isMultiple ? 1 : 0, $endIndex > 0 ? -$endIndex : \strlen($argType));

        $result = $this->populateObject($this->getType($type, $info), $data, $isMultiple, $info);
        $errors = [];
        if (\is_object($result) && $this->validator) {
            $errors = $this->validator->validate($result);
        }

        if (\count($errors) > 0) {
            throw new InvalidArgumentError($argName, $errors);
        } else {
            return $result;
        }
    }