Skip to content

fix: Shipping エンティティの nullable カラムと型定義の不整合を修正#6809

Merged
dotani1111 merged 1 commit into
EC-CUBE:4.4from
nanasess:fix/shipping-nullable
Jun 10, 2026
Merged

fix: Shipping エンティティの nullable カラムと型定義の不整合を修正#6809
dotani1111 merged 1 commit into
EC-CUBE:4.4from
nanasess:fix/shipping-nullable

Conversation

@nanasess

@nanasess nanasess commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

概要

dtb_shipping のスキーマ定義(#[ORM\Column]nullable: true)と、Shipping エンティティの getter / setter の型定義に不整合があったため修正します。

PR #6802 のレビュー指摘(pullrequestreview-4417047208)で「別PRで Shipping 側を修正すべき」とされた内容に対応するものです。

不整合の内容

カラム スキーマ 修正前 getter 修正前 setter
kana01 nullable: true getKana01(): string setKana01(string)
kana02 nullable: true getKana02(): string setKana02(string)
tracking_number nullable: true getTrackingNumber(): ?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 で定義されており、本変更で住所系エンティティ間の型定義が揃います。
  • getter 戻り型・setter 引数を nullable に広げる後方互換な変更です。CustomerAddress::setFromShipping() 等の呼び出し側にも影響はありません。
  • PHPStan(Shipping.php / CustomerAddress.php)は問題なく通過することを確認済みです。

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • Refactor
    • 配送情報の個人情報系フィールド(フリガナ、追跡番号)について、空値の取り扱いに対応しました。これにより、これらのフィールドはより柔軟に処理されるようになります。

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>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0b87a1b-ec76-4890-8c73-ee91a1ac6872

📥 Commits

Reviewing files that changed from the base of the PR and between 9820448 and eb50665.

📒 Files selected for processing (1)
  • src/Eccube/Entity/Shipping.php

📝 Walkthrough

Walkthrough

Shipping エンティティの個人情報関連フィールドである kana01kana02tracking_number について、setter/getter メソッドの型シグネチャを nullable 対応に更新しました。引数および戻り値の型を string から ?string に変更しています。

Changes

Shipping エンティティのフィールド型シグネチャ更新

Layer / File(s) Summary
kana01、kana02、tracking_number の nullable対応
src/Eccube/Entity/Shipping.php
setKana01getKana01setKana02getKana02 のメソッドシグネチャを string から ?string に変更し、setTrackingNumber の引数型も同様に nullable 対応に更新しました。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 型をnullableに変えて、
Shippingの情報、柔軟に。
kana と tracking、
空白も許される、
エンティティの成長!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルはデータベーススキーマと型定義の不整合を修正する主要な変更を正確に説明しており、変更セット全体を適切に要約している。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.33%. Comparing base (3f76a03) to head (eb50665).
⚠️ Report is 38 commits behind head on 4.4.

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     
Flag Coverage Δ
Unit 75.33% <100.00%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dotani1111 dotani1111 merged commit 887c692 into EC-CUBE:4.4 Jun 10, 2026
283 checks passed
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.

3 participants