Commit f26a0c2
Generic/UpperCaseConstantName: handle unconventional spacing and comments after
This commit fixes false negatives in the sniff when handling
unconventional spacing and comments after `define(`. When checking for
the constant name after the opening parenthesis, the sniff would
incorrectly exclude only whitespaces while comments can also be placed
between the opening parenthesis and the constant name.
Looking for the constant name by getting the next non-empty token after
the opening parenthesis fixes this problem.
The added tests also include comments between `define` and the opening
parenthesis but that was already handled correctly by the sniff.define(
1 parent 0e2a562 commit f26a0c2
File tree
3 files changed
+14
-2
lines changed- src/Standards/Generic
- Sniffs/NamingConventions
- Tests/NamingConventions
3 files changed
+14
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
0 commit comments