This should have been done before M6 but I forgot to do it.

See #29135 where we've introduced an improved API, keeping the old one around for a bit to let other modules adapt.