HP-2651: Use billing registry in Price creation UI to render unit dropdown#106
Conversation
WalkthroughThe interface Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/product/Domain/Model/Unit/FractionUnitInterface.php (3)
5-10: DRY the contract: extend UnitInterface instead of redeclaring name().FractionUnitInterface can inherit name() from UnitInterface to avoid duplication and keep the type hierarchy clear.
Apply:
-interface FractionUnitInterface +interface FractionUnitInterface extends UnitInterface { - public function name(): string; public function label(): string; }
9-9: Scope check: should label() belong to all units?If the Price creation UI renders a dropdown of “units” (not only fractional ones), consider moving label() to UnitInterface for consistency; otherwise the UI will need type checks.
Outside this file (UnitInterface):
interface UnitInterface { public function name(): string; + public function label(): string; }Then keep FractionUnitInterface focused on fraction-specific concerns.
7-9: Document semantics of name() vs label().Add PHPDoc to define invariants (e.g., name = stable identifier, label = human-readable, localized) to prevent misuse across UI and persistence.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/product/Domain/Model/Unit/FractionUnitInterface.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/product/Domain/Model/Unit/FractionUnitInterface.php (2)
src/product/Domain/Model/TariffTypeInterface.php (2)
name(7-7)label(9-9)src/product/Domain/Model/Unit/UnitInterface.php (1)
name(9-9)
🔇 Additional comments (1)
src/product/Domain/Model/Unit/FractionUnitInterface.php (1)
7-9: Heads-up: Adding methods to FractionUnitInterface is a BC break.No classes in this repository implement FractionUnitInterface; however, any external/consumer implementations must now define name() and label() or risk runtime errors. Verify and update all downstream implementers.
Summary by CodeRabbit