Skip to content

Add Duration and Period value objects with associated arithmetic and validation.#4

Merged
gustavofreze merged 1 commit intomainfrom
feature/develop
Mar 2, 2026
Merged

Add Duration and Period value objects with associated arithmetic and validation.#4
gustavofreze merged 1 commit intomainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 2, 2026 22:49
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dc290cc25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Adds new time value objects to the TinyBlocks\Time domain to support temporal arithmetic and interval modeling alongside Instant.

Changes:

  • Introduces Duration (unsigned seconds-based quantity) with arithmetic, comparisons, and unit conversions.
  • Introduces Period (half-open interval [from, to)) with validation plus contains() and overlapsWith() logic.
  • Extends Instant with plus(), minus(), durationUntil(), and comparison helpers; updates tests and README accordingly.

Reviewed changes

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

Show a summary per file
File Description
src/Duration.php New Duration value object with factories, arithmetic, comparisons, conversions.
src/Internal/Exceptions/InvalidDuration.php New exception type for invalid/negative duration operations.
src/Period.php New Period value object with range validation and interval operations.
src/Internal/Exceptions/InvalidPeriod.php New exception type for invalid periods (ordering / zero duration).
src/Instant.php Adds duration arithmetic and comparison helpers to Instant.
tests/DurationTest.php New unit tests covering Duration factories, arithmetic, comparisons, conversions.
tests/PeriodTest.php New unit tests covering Period creation/validation, contains/overlaps, duration behavior.
tests/InstantTest.php Adds coverage for new Instant arithmetic/comparison APIs.
README.md Documents Duration, Period, and new Instant arithmetic/distance/comparison APIs.

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

@gustavofreze gustavofreze merged commit d5fb930 into main Mar 2, 2026
10 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch March 2, 2026 22:56
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