Skip to content

Delegate identityEquals to Identity::equals for strict typed comparison#3

Merged
gustavofreze merged 1 commit intomainfrom
fix
Apr 22, 2026
Merged

Delegate identityEquals to Identity::equals for strict typed comparison#3
gustavofreze merged 1 commit intomainfrom
fix

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

…parison, resolve event short name via string ops and throw LogicException when aggregate lacks when<event> handler</event>.
Copilot AI review requested due to automatic review settings April 22, 2026 00:36
Copy link
Copy Markdown

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 updates identity equality to rely on Identity::equals() (value-object semantics) and aligns several related APIs/tests with updated naming and dependency changes across the library.

Changes:

  • Delegate EntityBehavior::identityEquals() to Identity::equals() (value-object equality) and adjust related Identity interfaces.
  • Rename upcaster payload hook (doUpcast()rewrite()), and rename snapshot state payload (datapayload) with corresponding test updates.
  • Add an explicit failure path when an event-sourced aggregate is missing a when* handler (currently via a native exception), plus accompanying tests and docs/config updates.

Reviewed changes

Copilot reviewed 47 out of 48 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Upcast/UpcastersTest.php Renames local variables for clarity/consistency in upcaster chaining tests.
tests/Upcast/SingleUpcasterBehaviorTest.php Renames local variables in single-upcaster behavior tests.
tests/Upcast/IntermediateEventTest.php Expands IntermediateEvent::equals() test coverage; updates mapper serialization calls.
tests/Snapshot/SnapshotterBehaviorTest.php Updates FileSnapshotter import after namespace move to tests/Mocks.
tests/Snapshot/SnapshotTest.php Renames equality result variable in snapshot equality tests.
tests/Snapshot/SnapshotConditionTest.php Improves BDD step clarity and renames boolean result variable.
tests/Models/ProductV2Upcaster.php Updates hook name to rewrite() and payload naming.
tests/Models/ProductV1Upcaster.php Updates hook name to rewrite() and payload naming.
tests/Models/CartWithoutHandler.php Adds fixture aggregate lacking a when* handler to test missing-handler behavior.
tests/Mocks/FileSnapshotter.php Moves mock snapshotter into Test\\...\\Mocks namespace.
tests/Event/SnapshotDataTest.php Updates SnapshotData constructor arg name (datapayload) and renames locals.
tests/Event/SequenceNumberTest.php Renames locals and minor formatting changes around exception message assertions.
tests/Event/RevisionTest.php Renames locals and minor formatting changes around exception message assertions.
tests/Event/EventTypeTest.php Renames locals and normalizes data provider array formatting.
tests/Event/EventRecordsTest.php Renames locals; updates SnapshotData ctor arg name.
tests/Event/EventRecordTest.php Updates SnapshotData ctor arg name; renames equality result locals.
tests/Entity/SingleIdentityBehaviorTest.php Renames locals in identity equality tests.
tests/Entity/EntityBehaviorTest.php Renames locals in identity/identityEquals tests to reflect boolean meaning.
tests/Entity/CompoundIdentityBehaviorTest.php Renames locals in compound identity equality tests.
tests/Aggregate/EventSourcingRootBehaviorTest.php Adds test asserting behavior when a when* handler method is missing.
src/Upcast/Upcaster.php Updates docs to reflect rewrite() hook naming.
src/Upcast/SingleUpcasterBehavior.php Renames abstract hook to rewrite() and updates call site.
src/Upcast/IntermediateEvent.php Adds explicit equals() implementation using strict comparisons for payload.
src/Snapshot/Snapshot.php Removes named args from native calls (ReflectionObject, in_array) per style rules.
src/Internal/Exceptions/MissingIdentityProperty.php Reorders ctor params; updates message to reference identityName(); removes named args for native ctor.
src/Internal/Exceptions/InvalidSequenceNumber.php Removes named arg usage to native exception ctor.
src/Internal/Exceptions/InvalidRevision.php Removes named arg usage to native exception ctor.
src/Internal/Exceptions/InvalidEventType.php Removes named arg usage to native exception ctor.
src/Event/SnapshotData.php Renames internal field/ctor arg to $payload; removes named args from json_encode.
src/Event/EventType.php Removes named args from preg_match and ReflectionClass construction.
src/Entity/SingleIdentity.php Simplifies interface inheritance (now covered via Identity extends ValueObject).
src/Entity/Identity.php Changes Identity to extend ValueObject and updates immutability wording in docs.
src/Entity/EntityBehavior.php Delegates identityEquals() to Identity::equals() and updates exception ctor call.
src/Entity/CompoundIdentity.php Simplifies interface inheritance (now covered via Identity extends ValueObject).
src/Aggregate/EventualAggregateRootBehavior.php Updates collection add call to named argument (elements).
src/Aggregate/EventSourcingRootBehavior.php Adds missing-handler detection and throws on absent when* method (currently native exception).
src/Aggregate/AggregateRootBehavior.php Updates SnapshotData ctor arg name (payload).
composer.json Updates dependency set (removes immutable-object; bumps value-object major) and adjusts package description.
README.md Updates overview language to match current feature set and design positioning.
LICENSE Updates copyright year.
.gitignore Expands ignored files/dirs (IDE, Composer lock, PHPUnit caches, coverage).
.gitattributes Refines export-ignore set for Packagist tarball contents.
.claude/rules/php-library-testing.md Updates/normalizes testing rules text and references.
.claude/rules/php-library-modeling.md Adds/updates modeling rules document.
.claude/rules/php-library-documentation.md Normalizes documentation rules and adds example requirements.
.claude/rules/php-library-code-style.md Expands style rules (complexity, brace placement, default-arg omission, etc.).
.claude/rules/php-domain.md Removes deprecated rules file in favor of new modeling rules.
.claude/CLAUDE.md Updates project framing as a library and clarifies command expectations.

Comment thread composer.json
Comment thread src/Aggregate/EventSourcingRootBehavior.php
Comment thread tests/Aggregate/EventSourcingRootBehaviorTest.php
@gustavofreze gustavofreze merged commit 5d04fe2 into main Apr 22, 2026
10 checks passed
@gustavofreze gustavofreze deleted the fix branch April 22, 2026 00:44
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.

2 participants