Skip to content

feat: LocalDateRangeとLocalDateTimeRangeクラスを実装 #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025

Conversation

endou-mame
Copy link
Collaborator

Summary

  • 日付と日時の範囲を表すValueObjectクラスを実装
  • php-monadを本番依存に移動(Result/Option型の利用のため)

追加した機能

LocalDateRange

  • 日付の範囲を表す値オブジェクト
  • 開始日と終了日、範囲タイプを保持
  • 範囲内包含判定、重なり判定、期間計算機能

LocalDateTimeRange

  • 日時の範囲を表す値オブジェクト
  • 開始日時と終了日時、範囲タイプを保持
  • 範囲内包含判定、重なり判定、期間計算機能

RangeType

  • 範囲の境界タイプを表す列挙型
  • CLOSED(閉区間)、OPEN(開区間)、HALF_OPEN_LEFT(左開区間)、HALF_OPEN_RIGHT(右開区間)

Test plan

  • LocalDateRangeの単体テストを実装
  • LocalDateTimeRangeの単体テストを実装
  • 境界値テストを含む包括的なテストケース
  • 使用例をexamplesディレクトリに追加

Fixes #29

🤖 Generated with Claude Code

endou-mame and others added 2 commits June 11, 2025 17:24
- LocalDateRange: 日付の範囲を表す値オブジェクト
- LocalDateTimeRange: 日時の範囲を表す値オブジェクト
- RangeType: 範囲の境界タイプを表す列挙型(閉区間、開区間、半開区間)
- 範囲の有効性検証、包含判定、重なり判定などの機能を実装
- php-monadを本番依存に移動(Result/Option型の利用のため)

Fixes #29

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@endou-mame endou-mame requested a review from Copilot June 11, 2025 08:47
@endou-mame endou-mame merged commit b2b2f24 into main Jun 11, 2025
1 check failed
@endou-mame endou-mame deleted the endou-mame/issue29 branch June 11, 2025 08:48
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

Implements value objects for date and datetime ranges (LocalDateRange, LocalDateTimeRange) with a shared RangeType enum, comprehensive tests/examples, and promotes wiz-develop/php-monad to a runtime dependency.

  • Added RangeType enum to express open/closed/hybrid intervals
  • Introduced LocalDateRange and LocalDateTimeRange classes with validation, serialization, containment, overlap, and iteration
  • Updated composer.json to require wiz-develop/php-monad and removed it from dev dependencies

Reviewed Changes

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

Show a summary per file
File Description
composer.json Moved wiz-develop/php-monad from dev to runtime require
src/DateTime/RangeType.php Added RangeType enum for interval boundary types
src/DateTime/LocalDateTimeRange.php Implemented datetime range value object
src/DateTime/LocalDateRange.php Implemented date range value object
tests/Unit/Enum/EnumValueTest.php Added phpstan ignore annotation in a test
tests/Unit/DateTime/LocalDateTimeRangeTest.php Added unit tests covering all datetime‐range behaviors
tests/Unit/DateTime/LocalDateRangeTest.php Added unit tests covering all date‐range behaviors
Comments suppressed due to low confidence (3)

src/DateTime/LocalDateTimeRange.php:7

  • The use Override; import is unresolved. Either remove this if unused or import the correct attribute namespace (e.g., use JetBrains\PhpStorm\Override;).
use Override;

src/DateTime/LocalDateRange.php:8

  • The use Override; import is unresolved. Either remove this if unused or import the correct attribute namespace (e.g., use JetBrains\PhpStorm\Override;).
use Override;

tests/Unit/DateTime/LocalDateRangeTest.php:340

  • [nitpick] The test name indicates "default is open" but asserts a CLOSED range. Rename the test to reflect that the default is a CLOSED interval.
public function test_from_デフォルトは開区間(): void

@endou-mame endou-mame added this to the v0.6.0 milestone Jun 11, 2025
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.

feat: LocalDateRangeとLocalDateTimeRangeの実装
1 participant