Commit a509ed7
authored
Fix: Preserve parameter order when inserting missing
When multiple missing parameters need to be inserted before an existing
parameter (or at the end of a docblock), they were being inserted in
reverse order due to how addContentBefore() works - each call inserts
before the same position, resulting in a LIFO order.
The fix reverses the pendingInserts array before iterating, so the
parameters are inserted in the correct signature order.
Example: For a method like:
function foo(string $a, bool $b, string $c)
This was causing cascading issues with other sniffs like
DocBlockParamAllowDefaultValue and DocBlockParamTypeMismatch,
which would detect type mismatches due to the wrong parameter order.@param annotations (#44)1 parent f5ee62c commit a509ed7
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
401 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
402 | 406 | | |
403 | 407 | | |
404 | 408 | | |
| |||
0 commit comments