Closed sirbrillig closed 6 years ago
+1. I've tried out Generic.Formatting.MultipleStatementAlignment.NotSameWarning
and WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned even
in a few files and just don't like them, largely because of your observation:
it requires the developer to go back and adjust the spacing of all the other lines
which will lead to messy diffs full of distraction.
I assumed there was already a sniff to do this, but I can't find one. I'd like to make a sniff which replaces this:
with this:
And the same thing with associative arrays, replacing this:
with this:
Why?
Assignment alignment looks nice sometimes, but it vastly complicates writing and modifying code. If there are twenty adjacent assignments, and one of them gets longer than the others, it requires the developer to go back and adjust the spacing of all the other lines. It's also not always consistent since different typeface and displays will have different visual widths of spaces and other characters.