题
我似乎得到了一个奇怪的情况,其中CodeSniffer在某些代码上应用2个缩进空间条件。一个例子如下,其中,如果我设置0缩进在线以进行演示目的,则输出以下错误:
336 |错误|线缩进错误;预计4个空间,发现0
336 |错误|线缩进错误;预期的6个空格,发现0
可以看到,它需要在同一条线上的4个空格和6个空格。有没有人见过这种行为?
解决方案
The line of code in question is enclosed in an if else {}
block, which is in turn enclosed in an if {}
block.
If I change the if else
to ifelse
, it fixes the problem, with the Indent sniff reporting correctly.
不隶属于 StackOverflow