Commit 870a551
committed
Return
- In `reorderArgs()`, positional arguments keep their original index from
`$callArgs`. When a named argument appears between positional arguments
(which is invalid PHP), the named arg is removed from the positional
sequence, creating a hole in the `$reorderedArgs` array at an index
beyond the parameter signature length.
- The hole-filling loop at line 401 threw `ShouldNotHappenException` when
encountering a hole index not present in `$signatureParameters`.
- Replace the throw with `return null`, which tells all callers (func calls,
method calls, static calls, `new`, `ParametersAcceptorSelector`) that
argument reordering failed, and they fall back gracefully.
- The fix applies to all callable types (functions, methods, static methods,
constructors) since they all share `reorderArgs()`.
- Added two test cases to `ArgumentsNormalizerTest::dataReorderInvalid`:
one with a variadic parameter and one without.null from ArgumentsNormalizer::reorderArgs() when positional args after named args create holes beyond parameter count1 parent ca00199 commit 870a551
2 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
326 | 353 | | |
327 | 354 | | |
328 | 355 | | |
| |||
0 commit comments