Add eager evaluation from closure method and update documentation.#43
Merged
gustavofreze merged 1 commit intomainfrom Apr 16, 2026
Merged
Add eager evaluation from closure method and update documentation.#43gustavofreze merged 1 commit intomainfrom
gustavofreze merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds eager collection creation from a closure (mirroring the lazy closure factory) and updates docs/tests to describe and validate eager vs lazy evaluation behavior and complexity.
Changes:
- Introduce
Collection::createFromClosure()backed by an eager pipeline that materializes the closure result immediately. - Move
first/isEmpty/lastresolution intoPipelineimplementations (eager/lazy) and remove the old resolving helpers. - Expand README + API docs with evaluation strategy and complexity explanations; add extensive tests and new test models.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Models/Status.php | Removes trailing whitespace from the enum file. |
| tests/Models/Shipments.php | Adds a typed Shipments collection with a custom toArray() serializer. |
| tests/Models/ShipmentRecord.php | Adds a record wrapper that maps raw arrays into typed shipments (eager + closure-based). |
| tests/Models/Shipment.php | Adds a readonly shipment domain model + serializer for tests. |
| tests/EagerCollectionTest.php | Adds comprehensive tests for eager createFromClosure behavior and typed collections. |
| tests/CollectionTest.php | Updates closure-related tests to assert parity across lazy/eager closure sources; adds eager typed-collection test. |
| src/Internal/Pipeline.php | Extends pipeline interface with first/isEmpty/last and documents complexities. |
| src/Internal/Operations/Transforming/RemoveAll.php | Minor predicate null-check refactor. |
| src/Internal/Operations/Resolving/Last.php | Removes old Last resolver helper (now handled by pipelines). |
| src/Internal/Operations/Resolving/First.php | Removes old First resolver helper (now handled by pipelines). |
| src/Internal/LazyPipeline.php | Implements first/isEmpty/last on lazy pipelines. |
| src/Internal/EagerPipeline.php | Adds eager pipeline creation from closure + implements first/isEmpty/last. |
| src/Collection.php | Adds createFromClosure() and delegates first/isEmpty/last to the pipeline. |
| src/Collectible.php | Updates public API docs to include createFromClosure() + adds complexity annotations. |
| README.md | Adds evaluation strategies section, updates creation examples, and includes complexity tables. |
| .github/copilot-instructions.md | Adds repo-specific Copilot guidance file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.