Commit 8b6e91e
Fix VariableWrong false positives for partial doc blocks (#40)
Previously, when a doc block only documented some parameters (e.g.,
only those needing complex type hints like `array<string>`), the sniff
would compare params by position rather than by name, causing false
positives.
For example, this code:
```php
/**
* @param array<string> $lines
*/
protected function parseBlocks(Node $parent, array $lines, int $indent): void
```
Would incorrectly report: "Doc Block param variable `$lines` should be
`$parent`" because it was comparing the first doc block param with the
first method param positionally.
Now the sniff matches doc block params to method params by variable
name, allowing partial documentation to work correctly. Only params
that don't exist in the method signature at all are reported as errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>1 parent 0773620 commit 8b6e91e
1 file changed
+17
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
160 | 162 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
171 | 179 | | |
172 | 180 | | |
173 | 181 | | |
| |||
0 commit comments