fix: Shipping エンティティの nullable カラムと型定義の不整合を修正#6809
Conversation
dtb_shipping の kana01 / kana02 カラムは nullable: true だが、 getKana01() / getKana02() の戻り型と setKana01() / setKana02() の 引数型が非null (string) になっており、DB に NULL が格納されている Shipping を読み込んで getter を呼ぶと TypeError が発生する状態だった。 同様に tracking_number カラムも nullable だが setTrackingNumber() の 引数型のみ非null になっていたため修正する。 Customer / CustomerAddress の同名カラムは既に ?string で定義されており、 本変更で住所系エンティティ間の型定義が揃う。型を nullable に広げる 後方互換な変更で、PHPStan も問題なく通過する。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesShipping エンティティのフィールド型シグネチャ更新
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.4 #6809 +/- ##
============================================
+ Coverage 75.10% 75.33% +0.23%
Complexity 6752 6752
============================================
Files 483 483
Lines 26279 26277 -2
============================================
+ Hits 19736 19797 +61
+ Misses 6543 6480 -63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
概要
dtb_shippingのスキーマ定義(#[ORM\Column]のnullable: true)と、Shippingエンティティの getter / setter の型定義に不整合があったため修正します。PR #6802 のレビュー指摘(pullrequestreview-4417047208)で「別PRで Shipping 側を修正すべき」とされた内容に対応するものです。
不整合の内容
kana01nullable: truegetKana01(): stringsetKana01(string)kana02nullable: truegetKana02(): stringsetKana02(string)tracking_numbernullable: truegetTrackingNumber(): ?string(整合済)setTrackingNumber(string)kana01/kana02はカラムが nullable にもかかわらず getter 戻り型が非null (string) だったため、DB にNULLが格納されているShippingを読み込んで getter を呼ぶとTypeErrorが発生する状態でした。修正内容
src/Eccube/Entity/Shipping.php:getKana01()/getKana02()の戻り型を?stringに変更setKana01()/setKana02()の引数型を?stringに変更setTrackingNumber()の引数型を?stringに変更補足
Customer/CustomerAddressの同名カラムは既に?stringで定義されており、本変更で住所系エンティティ間の型定義が揃います。CustomerAddress::setFromShipping()等の呼び出し側にも影響はありません。Shipping.php/CustomerAddress.php)は問題なく通過することを確認済みです。🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート