[Fix #10883] Fix `Style/RedundantParentheses` to be able to detect offenses and properly correct when the end parentheses and comma are on their own line
Previously in #2874 / #3078, Style/RedundantParentheses was updated to ignore parentheses in arrays when the comma is on a separate line with the end parenthesis, as that would leave a comma on a line by itself, which is a syntax error.
Additionally, this trailing comma problem shows up in method argument lists, hashes, etc.
This change removes the false negative for this situation, and instead updates ParenthesesCorrector to be able to handle commas that are orphaned onto their own line after removing parentheses. Note that this corrector is also used by Style/ParenthesesAroundCondition and Style/RescueModifier but all tests are passing without change.
Before submitting the PR make sure the following are checked:
[x] The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
FYI this update causes invalid syntax for a heredoc string used in an array or hash, as the autocorrect adds the comma to the end of the heredoc end marker, breaking the marker. In that scenario we'll want to leave the dangling parentheses + comma.