Why does Array#compact! return nil if no nil elements were removed from
the array? I would expect the behavior of this method to act similar to
the other ! methods for the array class, which is to alter the original
object and return the new result for use with chaining.

As far as I know, all bang methods return nil when they haven’t made any
modifications to the object.