Commit 73c2fd4
Enhance RuleTestCase to support multiple errors on same line
Key improvements:
- Update regex to properly parse multiple error comments using non-greedy matching
- Simplify expected errors parsing by removing complex sorting logic
- Add comprehensive test cases for multiple errors per line scenarios
- Add dedicated test method demonstrating 2, 3, and 4 errors on single lines
- Add test cases for mixed valid/invalid operations on same line
The enhanced RuleTestCase now correctly handles the common scenario where
multiple PHPStan rule violations occur on the same line of code, making it
much more practical for testing complex rules.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent af5b783 commit 73c2fd4
File tree
4 files changed
+43
-16
lines changed- src
- tests
- Rule/Data/DisallowDivisionByLiteralZeroRule
4 files changed
+43
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 83 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 84 | + | |
92 | 85 | | |
93 | 86 | | |
94 | 87 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 88 | + | |
98 | 89 | | |
99 | 90 | | |
100 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
0 commit comments