Skip to content

Document IndexOutOfBoundsException on List::removeAt() - #48

Merged
delacry merged 1 commit into
0.1.xfrom
fix/remove-at-throws-docblock
Sep 27, 2026
Merged

delacry merged 1 commit into
0.1.xfrom
fix/remove-at-throws-docblock

Conversation

@delacry

@delacry delacry commented Sep 27, 2026

Copy link
Copy Markdown
Member

removeAt() declared @throws OutOfBoundsException, the SPL class, but every implementation raises Noctud\Collection\Exception\IndexOutOfBoundsException, which extends LogicException rather than it. A catch written against the docblock never matched.

Correct the declaration on ImmutableList and WritableList, and regenerate WritableTrackedList, MutableList and MutableTrackedList, whose narrowed removeAt() docblocks are copied from WritableList. The generator does not manage use statements, so the now unused OutOfBoundsException imports are removed by hand. The List API docs carried the same mistake and are fixed too.

Docblocks and docs only, no behavior change. The existing removeAt_throws_on_invalid_index test already asserts IndexOutOfBoundsException.

removeAt() declared @throws OutOfBoundsException (the SPL class), but
every implementation raises Noctud\Collection\Exception\IndexOutOfBoundsException,
which extends LogicException - so a catch written against the docblock
never matched. Correct the declaration on ImmutableList and WritableList,
regenerate the narrowed interfaces that copy it, drop the now unused
imports, and fix the same mistake in the List API docs.
@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@delacry
delacry merged commit eca31a1 into 0.1.x Sep 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant