Skip to content

Conversation

othercodes
Copy link
Contributor

No description provided.

@othercodes othercodes requested a review from Copilot October 13, 2025 07:43
Copy link

@Copilot 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 implements invariant violation aggregation functionality, allowing multiple invariant violations to be collected and thrown together as a single exception, improving error reporting and developer experience.

  • Adds an Aggregatable contract to distinguish which exceptions can be collected vs. thrown immediately
  • Implements aggregation logic in HasInvariants trait to collect multiple violations before throwing
  • Enhances InvariantViolation exception with support for multiple violations and better error messages

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Exceptions/InvariantViolation.php Enhanced to implement Aggregatable interface and support multiple violations with improved messaging
src/Traits/HasInvariants.php Updated invariant checking logic to aggregate violations and handle non-aggregatable exceptions
src/IsModel.php Added new() static method as an alias for make() for more idiomatic domain object creation
tests/TraitsTest.php Added comprehensive test coverage for invariant violation aggregation scenarios
tests/TypeValidationTest.php Added tests for the new new() static method functionality
tests/ValueObjectsTest.php Updated comment to clarify non-aggregatable exception behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@othercodes othercodes force-pushed the feature/invariant-violation-aggregation branch from 288e663 to 1b949d1 Compare October 13, 2025 07:46
Copy link

@othercodes othercodes merged commit 6dc84ee into main Oct 13, 2025
6 checks passed
@othercodes othercodes deleted the feature/invariant-violation-aggregation branch October 13, 2025 07:52
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