Skip to content

Conversation

@gustavofreze
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 10, 2026 01:00
@gustavofreze gustavofreze merged commit 03184f3 into main Feb 10, 2026
10 checks passed
@gustavofreze gustavofreze deleted the fix/iterable branch February 10, 2026 01:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes iterable mapping when an IterableMapper object is itself Traversable (e.g., implements IteratorAggregate), ensuring mapping uses the object’s iterator (and its keys) rather than reflecting and mapping an internal iterable property.

Changes:

  • Update IterableExtractor to directly convert Traversable objects via iterator_to_array($object).
  • Add test coverage for mapping a Traversable collection that yields keyed items.
  • Introduce new test model fixtures (Invoice, Invoices, InvoiceSummaries) to reproduce and validate the keyed-iterator scenario.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Internal/Extractors/IterableExtractor.php Ensures Traversable iterable mappers are extracted via iteration (preserving yielded keys).
tests/CollectionMappingTest.php Adds a regression test asserting keys from a traversable iterator are preserved in mapped output.
tests/Models/Invoice.php Test fixture representing an invoice element to be mapped.
tests/Models/Invoices.php Test fixture iterable collection used by the traversable mapping test.
tests/Models/InvoiceSummaries.php Test fixture implementing IteratorAggregate and yielding invoices keyed by invoice id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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