TabAndSpace.DoubleSpace incorrectly detects within the line
The documentation for this sniff clearly states the following:
Check for any line starting with 2 spaces
However, the sniff will incorrectly trigger on line 2 in this example:
private array $bufferRequests = [];
private bool $inBuffer = false;
The first 2 characters of both lines are tab. The failure of this sniff is that it is checking the entire contents of the line, looking for double space. This is not what the docs say this sniff does. Furthermore, as currently implemented, this behavior conflicts with Generic.Formatting.MultipleStatementAlignment which says that multiple assignment lines should be aligned, as the example above shows.
Please fix this sniff to correctly, and only, search the beginning of the line for violation.
@ADmad Do you know what this sniff was meant to do?
From https://github.com/cakephp/cakephp-codesniffer/commit/dd0592448fb3f861c5d60cb76db56ef79294cf43 Probably a bit outdated. Most of the indentation should be taken care off by other sniffs now I assume.
And the inline "anti pattern" of alignment would be a different sniff and responsibility either way.
Our standard doesn't use tabs, so frankly I don't really care if a sniffs creates errors from those who do. One can simply disable that sniff in their app config.
"it doesn't affect me, so I don't care" Nice attitude buddy. Anyways, it's still a valid bug for the rest of the world who might do things differently.
You can make a PR with a suggested fix.
Note: If you are using Tabs you can also consider using psr2r sniffer ruleset. It has also more advanced sniffer on top
Should we deprecate/drop this in favor of different sniffs?