Redesign internals with proper collaborators, add Timezone support, and make Country extensible.#21
Conversation
…support, and make Country extensible.
There was a problem hiding this comment.
Pull request overview
This pull request implements a major redesign of the Country library internals, adding comprehensive timezone support and making the Country class extensible. The changes align with the PR title's goals: redesigning internals with proper collaborators (TimezoneCatalog, CountryNameNormalizer), adding Timezone support (Timezone and Timezones classes), and making Country extensible (removing final keyword, using static return types).
Changes:
- Added complete IANA timezone support with Timezone and Timezones value objects that integrate with PHP's ICU database
- Made Country class extensible by removing final keyword and using static return types
- Refactored internal architecture with dedicated collaborators (CountryNameNormalizer, TimezoneCatalog)
- Updated test namespace from TinyBlocks\Country to Test\TinyBlocks\Country
- Removed internal traits (AlphaCodeMapper) in favor of inline implementations using PHP 8.4's array_find
- Enhanced documentation with comprehensive timezone usage examples
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Country.php | Made class extensible (removed final), added timezone support, refactored with static return types |
| src/Timezone.php | New value object representing single IANA timezone identifier with validation |
| src/Timezones.php | New immutable collection for country timezones with search/filter capabilities |
| src/Alpha2Code.php | Removed trait, removed public CODE_LENGTH constant, inline conversion using array_find |
| src/Alpha3Code.php | Removed trait, removed public CODE_LENGTH constant, inline conversion using array_find |
| src/AlphaCode.php | Updated documentation to clarify getName() returns enum case name |
| src/Internal/TimezoneCatalog.php | New internal collaborator for timezone data retrieval with caching |
| src/Internal/CountryNameNormalizer.php | New internal collaborator replacing Name class for normalization logic |
| src/Internal/Exceptions/InvalidTimezone.php | New exception for invalid timezone identifiers |
| tests/CountryTest.php | Comprehensive test coverage for new timezone features and updated namespace |
| composer.json | Updated test namespace, added timezone-related keywords |
| README.md | Extensive documentation for timezone features with practical examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35bb1f8b36
ℹ️ 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".
No description provided.