Commit 6b106cc
committed
Generic/OpeningFunctionBraceKernighanRitchie: improve error message
Follow up on 707
When there are multiple tabs between the end of the function signature and the open brace, the "found: $length" part of the error message would refer to the number of tabs found.
This is inconsistent with other sniffs and confusing.
This commit fixes this, while still maintaining the previous behaviour - as introduced via squizlabs/PHP_CodeSniffer@c4b9807 - of special casing the messaging for a single tab - independently of whether or not tab replacement is in effect.
Example for line 10 of test case file 2:
```
// Before:
Expected 1 space before opening brace; found 3
// After:
Expected 1 space before opening brace; found 11
```
Covered via pre-existing tests in both test case files + some additional new tests.1 parent 941a00e commit 6b106cc
File tree
4 files changed
+30
-8
lines changed- src/Standards/Generic
- Sniffs/Functions
- Tests/Functions
4 files changed
+30
-8
lines changedLines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 141 | + | |
| 142 | + | |
149 | 143 | | |
150 | 144 | | |
151 | 145 | | |
| 146 | + | |
152 | 147 | | |
153 | 148 | | |
154 | 149 | | |
155 | 150 | | |
156 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
157 | 161 | | |
158 | 162 | | |
159 | 163 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
0 commit comments