Hi,

this PR fixes #28180 by applying switch expressions where appropriate (there are a couple of places where they didn't make things more concise imho).

The nice side-benefit is that with switch expressions we get a compilation failure now if a new enum case is added instead of needing to rely on throwing exceptions during runtime.

Cheers, Christoph

Comment From: wilkinsona

Thanks very much, @dreis2211.