Since we use tabs to indent lines, we should tell PHPCS how many spaces a tab equals to. Usually (e.g. in IDEs), a tab corresponds to 4 spaces, and we should tell this to PHPCS by setting tab-width.
Not setting this option causes some whitespace-related issues to behave badly, see T243529. People upstream suggested setting the tab width to let the InterfaceWrongIndent sniff and others behave correctly.
However, there's an important side-effect in doing so: the LineLength sniff. Right now, the following line:
\t\t\tFOO
(where \t is a tab) is counted as having 6 characters (3 tabs + 3 letters). By setting tab-width to 4, it will be counted as having 15 characters (4*3 + 3). Hence, we'll start getting lots of new warnings about long lines, see test run. Of note, I've always found it weird to have tabs counted as 1, but I don't know whether it's intentional/there are historical reasons to do so. For sure, it makes more sense (IMHO) to count a tab as 4 characters when computing line length.
Either way, I see three possible outcomes:
- We don't set tabWidth, but then we'll have to disable InterfaceWrongIndent, and possibly other space-related sniffs.
- We set tabWidth, but we also increase the max line length (e.g. by 8-10 chars, assuming that the average indent is around 2.5-3 tabs).
- We set tabWidth, and also fix all the long lines.
IMHO, 3 is the best option, but 2 would be fine for now.