def METHOD_NAME(cls: type[PydanticDataclass], cls_name: str, undefined_name: str) -> None:
    undefined_type_error_message = (
        f'`{cls_name}` is not fully defined; you should define {undefined_name},'
        f' then call `pydantic.dataclasses.rebuild_dataclass({cls_name})`.'
    )
    def attempt_rebuild() -> SchemaValidator | None:
        from ..dataclasses import rebuild_dataclass
        if rebuild_dataclass(cls, raise_errors=False, _parent_namespace_depth=5):
            return cls.__pydantic_validator__
        else:
            return None
    cls.__pydantic_validator__ = MockValSer(  # type: ignore[assignment]
        undefined_type_error_message,
        code='class-not-fully-defined',
        val_or_ser='validator',
        attempt_rebuild=attempt_rebuild,
    )