Skip to content

improvement: deprecation ゲート有効化+未使用の非推奨 public API 削除 (#6933)#6937

Open
ttokoro20240902 wants to merge 3 commits into
4.4from
feature/6933-deprecation-gate
Open

improvement: deprecation ゲート有効化+未使用の非推奨 public API 削除 (#6933)#6937
ttokoro20240902 wants to merge 3 commits into
4.4from
feature/6933-deprecation-gate

Conversation

@ttokoro20240902

@ttokoro20240902 ttokoro20240902 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

概要

Issue #6933 のうち、仕様(実行時の挙動・CSV等の出力・管理/店頭画面・DBスキーマ)を一切変えない範囲で対応する。

  • Part 1: deprecation ゲートの有効化(Symfony 追従の本命)
  • Part 2: 未使用の @deprecated public API の削除(4.4 の BC 破壊に相乗り)

Fixes #6933(の安全に実施できる範囲。据え置き分は後述)

方針

Part 1 — SYMFONY_DEPRECATIONS_HELPERmax[direct]=0

weak(発火してもCIを落とさない)から max[direct]=0(自コードが Symfony/Doctrine の非推奨 API を直接呼んだら CI 失敗)へ引き上げる。次期 Symfony(7.4→8)追従を「負債の発掘」から「非推奨を消すだけ」に変えるための早期警告。

  • phpunit.xml.dist … 実 PHPUnit CI(unit-test.yml / coverage.yml の phpunit ジョブ)はこの設定を継承するため、ここが強制化の本体。
  • coverage.yml … 無効化済み Codeception ジョブの値も整合のため更新。
  • max[self]=0 は併用しないStringUtilE_USER_DEPRECATED は本 Issue の対象外で、併用すると CI が落ちるため direct 単独とした。

Part 2 — 削除できるのは「呼び出し元なし/CSV非出力/スキーマ不変」のものだけ

@deprecated public API を「①コアに呼び出し元があるか ②CSV 出力に載る保存カラムのアクセサか ③カラム削除マイグレーションを伴うか」で判定し、すべて No のもののみ削除した。

削除

API 理由
OrderItem::getTaxRuleId() / setTaxRuleId() 呼び出し元皆無・CSV非出力(tax_rule_id カラムは残置)
Product::isEnable()ProductClass::isEnable() 計算メソッド・相互呼び出しのみ
Cart::getLock() / setLock()$lock ORM 非マッピングの一時プロパティ
transChoice() trans() の別名・呼び出し元皆無
TaxProcessor::getTaxDisplayType() デッドな protected メソッド
CartService::$cart 未初期化・未使用プロパティ
Order::getTotalPrice() getPaymentTotal() の別名(self 発火源)
CacheUtil::clear() 代替は clearCache()(専用テストごと削除)
CustomerStatus::NONACTIVE / ACTIVE 現役定数 PROVISIONAL / REGULAR と同値の別名

据え置き(削除すると仕様が変わるため本 PR では触らない)

  • Order::getTax/setTaxItemHolderInterface::setTaxOrder::getDiscounttax/discount カラム … CSV 出力「税金」「値引き」列を支える現役@deprecated 予告は残置。
  • BaseInfo::getPhpPath/setPhpPathphp_path カラム … 削除にマイグレーション(スキーマ変更)を伴う。

テスト

  • 専用テストは削除: CacheUtilTestOrderTest::testGetTotalPrice
  • 道具として使うテストは等価 API へ付け替え:
    • EditControllerTest: getTotalPrice()getPaymentTotal()
    • EntryControllerTest / CustomerRepository(GetQueryBuilderBySearchData)Test / Generator: CustomerStatus::NONACTIVE/ACTIVEPROVISIONAL/REGULAR
  • ローカル QA(Docker): PHPStan(level6) / PHP-CS-Fixer / Rector すべてクリーン。影響テスト(OrderTest・EntryController・EditController・CustomerRepository×2)緑。max[direct]=0 実適用で direct 発火 0 を確認。

互換性

  • 本 PR は意図的な BC 破壊(public API の削除)を含む。Issue [4.4] deprecation ゲート有効化+非推奨 public API の削除 #6933 の方針に基づき、4.4 が既に含む Symfony 7 移行の BC 破壊に相乗りさせ、プラグイン作者の移行を 1 回に集約する。
  • CSV 入出力フォーマットは変更していない(税額・値引きの列を支える API は据え置き)。
  • 削除した public API はいずれもコアに呼び出し元がない。プラグインが利用していた場合の移行先は上表のとおり。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 変更

    • 会員ステータスの名称を「仮会員」「本会員」「退会」に対応した表記へ整理しました。
    • 注文合計金額の取得方法を統一しました。
    • カートロック、商品・注文関連の旧式APIを廃止しました。
    • 翻訳やキャッシュ削除に関する非推奨機能を整理しました。
  • 品質改善

    • 非推奨機能の検出基準を強化し、将来の互換性問題を早期に検知できるようにしました。

ttokoro20240902 and others added 3 commits July 16, 2026 11:53
コアに呼び出し元がなく、CSV 出力にも載らず、DB スキーマ変更も伴わない
未使用の @deprecated public API を削除する。仕様(挙動・出力・画面)は不変。

- OrderItem::getTaxRuleId() / setTaxRuleId()(呼び出し元皆無・tax_rule_id カラムは残置)
- Product::isEnable() + ProductClass::isEnable()(計算メソッド・相互呼び出しのみ)
- Cart::getLock() / setLock() + ORM 非マッピングの $lock プロパティ
- transChoice()(trans() の別名・呼び出し元皆無)
- TaxProcessor::getTaxDisplayType()(デッドな protected メソッド)
- CartService::$cart(未初期化・未使用プロパティ)+未使用 import

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
呼び出し元がテストのみの @deprecated public API を削除する。
仕様(挙動・出力・画面)は不変。

削除:
- Order::getTotalPrice()(getPaymentTotal() の別名。E_USER_DEPRECATED の
  self 発火源)
- CacheUtil::clear()(代替は clearCache()。専用テスト CacheUtilTest ごと削除)
- CustomerStatus::NONACTIVE / ACTIVE(現役定数 PROVISIONAL / REGULAR と同値の別名)

テストの扱い:
- 専用テストは削除: CacheUtilTest、OrderTest::testGetTotalPrice
- 道具として使うテストは等価 API へ付け替え:
  - EditControllerTest: getTotalPrice() → getPaymentTotal()
  - EntryControllerTest / CustomerRepository(GetQueryBuilderBySearchData)Test /
    Generator: CustomerStatus::NONACTIVE/ACTIVE → PROVISIONAL/REGULAR

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Symfony のメジャー追従を楽にするため、自コードが Symfony/Doctrine の
非推奨 API を直接呼んだ場合に CI を落とす。weak(発火してもCIを落とさない)
から max[direct]=0 へ引き上げる。

- phpunit.xml.dist: 実 PHPUnit CI(unit-test.yml / coverage.yml の phpunit
  ジョブ)はこの設定を継承するため、ここが強制化の本体。
- coverage.yml: 無効化済み Codeception ジョブの値も整合のため更新。

max[self]=0 は併用しない(StringUtil の E_USER_DEPRECATED は本 Issue の
対象外で、併用すると CI が落ちるため)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Symfonyの非推奨検出設定を強化し、複数の非推奨public APIを削除しました。CustomerStatusの定数名と関連テスト、受注テストのAPI参照も更新されています。

Changes

非推奨検出ゲート

Layer / File(s) Summary
Symfony deprecations helper設定
.github/workflows/coverage.yml, phpunit.xml.dist
設定値をweakからmax[direct]=0へ変更しました。

エンティティAPI削除

Layer / File(s) Summary
エンティティの非推奨API削除
src/Eccube/Entity/Cart.php, src/Eccube/Entity/Order.php, src/Eccube/Entity/OrderItem.php, src/Eccube/Entity/Product.php, src/Eccube/Entity/ProductClass.php
カートロック、合計金額、税ルールID、商品有効状態に関する非推奨メンバーを削除しました。

サービス・ユーティリティ整理

Layer / File(s) Summary
サービスとユーティリティの非推奨API削除
src/Eccube/Resource/functions/trans.php, src/Eccube/Service/CartService.php, src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php, src/Eccube/Util/CacheUtil.php
transChoice()、旧カートプロパティ、税表示メソッド、静的キャッシュクリア処理を削除しました。

会員ステータスとテスト更新

Layer / File(s) Summary
CustomerStatus参照と関連テスト
src/Eccube/Entity/Master/CustomerStatus.php, tests/Eccube/Tests/Fixture/Generator.php, tests/Eccube/Tests/Repository/*, tests/Eccube/Tests/Web/*
PROVISIONALREGULARWITHDRAWINGを定義し、既存テストの定数参照を更新しました。
受注テスト整理
tests/Eccube/Tests/Entity/OrderTest.php, tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php
削除されたgetTotalPrice()のテストを除去し、検証をgetPaymentTotal()へ変更しました。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: improvement

Suggested reviewers: dotani1111, nanasess, ji-eunsoo

Poem

ぴょんと跳ねて、古 API を片づけ
deprecation の芽を早めに摘む
新しい状態名を掲げれば
テストも軽やか、月へ跳ぶ
うさぎの足跡、CI に並ぶ 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning deprecation ゲート更新と非推奨API削除は達成されていますが、UPGRADEノート/CHANGELOG の周知が見当たりません。 削除した非推奨 public API と互換性影響を UPGRADE ノートまたは CHANGELOG に追記してください。
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは deprecation ゲート有効化と非推奨 public API 削除という主変更を簡潔に示しています。
Out of Scope Changes check ✅ Passed 変更は deprecation ゲート調整、非推奨 public API 削除、関連テスト更新に収まっており、明確な逸脱はありません。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/6933-deprecation-gate
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feature/6933-deprecation-gate

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/coverage.yml (1)

259-260: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

無効化された Codeception ジョブではなく、実行されるジョブに設定してください。

この設定は if: false の Codeception ジョブ内にあるため、現在のCIでは評価されません。さらに有効化しても continue-on-error: true により非推奨検出がCIゲートになりません。CI全体のゲートを意図する場合は、PHPUnitジョブへ移動するか、この重複設定を削除してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/coverage.yml around lines 259 - 260, Move the
SYMFONY_DEPRECATIONS_HELPER setting from the disabled Codeception job to the
active PHPUnit job, and remove continue-on-error there so deprecation failures
gate CI; if the setting is already present in PHPUnit, delete this duplicate
instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/Eccube/Tests/Fixture/Generator.php`:
- Line 912:
createCustomers()のDocBlockに記載されたデフォルトステータスをACTIVEからREGULARへ更新し、実装のCustomerStatus::REGULARと説明を一致させてください。

---

Nitpick comments:
In @.github/workflows/coverage.yml:
- Around line 259-260: Move the SYMFONY_DEPRECATIONS_HELPER setting from the
disabled Codeception job to the active PHPUnit job, and remove continue-on-error
there so deprecation failures gate CI; if the setting is already present in
PHPUnit, delete this duplicate instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28c17751-aec3-494b-90c9-37192139dbb3

📥 Commits

Reviewing files that changed from the base of the PR and between b978d3a and 1d13a23.

📒 Files selected for processing (19)
  • .github/workflows/coverage.yml
  • phpunit.xml.dist
  • src/Eccube/Entity/Cart.php
  • src/Eccube/Entity/Master/CustomerStatus.php
  • src/Eccube/Entity/Order.php
  • src/Eccube/Entity/OrderItem.php
  • src/Eccube/Entity/Product.php
  • src/Eccube/Entity/ProductClass.php
  • src/Eccube/Resource/functions/trans.php
  • src/Eccube/Service/CartService.php
  • src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php
  • src/Eccube/Util/CacheUtil.php
  • tests/Eccube/Tests/Entity/OrderTest.php
  • tests/Eccube/Tests/Fixture/Generator.php
  • tests/Eccube/Tests/Repository/CustomerRepositoryGetQueryBuilderBySearchDataTest.php
  • tests/Eccube/Tests/Repository/CustomerRepositoryTest.php
  • tests/Eccube/Tests/Util/CacheUtilTest.php
  • tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php
  • tests/Eccube/Tests/Web/EntryControllerTest.php
💤 Files with no reviewable changes (12)
  • src/Eccube/Entity/ProductClass.php
  • tests/Eccube/Tests/Util/CacheUtilTest.php
  • src/Eccube/Entity/OrderItem.php
  • src/Eccube/Resource/functions/trans.php
  • src/Eccube/Entity/Master/CustomerStatus.php
  • src/Eccube/Entity/Order.php
  • src/Eccube/Entity/Product.php
  • src/Eccube/Entity/Cart.php
  • tests/Eccube/Tests/Entity/OrderTest.php
  • src/Eccube/Service/CartService.php
  • src/Eccube/Util/CacheUtil.php
  • src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php

/** @var CustomerStatus $Status */
$Status = $options['status']
?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::ACTIVE);
?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::REGULAR);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

DocBlockのデフォルト値もREGULARへ更新してください。

実装はCustomerStatus::REGULARをデフォルトにしていますが、createCustomers()のDocBlock(Line 895)は依然としてACTIVEと記載されています。利用者が誤ったステータスを想定しないよう、コメントも同時に更新してください。

修正例
-     *     `@var` CustomerStatus|null $status         全 Customer に設定する CustomerStatus (デフォルト: ACTIVE)
+     *     `@var` CustomerStatus|null $status         全 Customer に設定する CustomerStatus (デフォルト: REGULAR)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Eccube/Tests/Fixture/Generator.php` at line 912,
createCustomers()のDocBlockに記載されたデフォルトステータスをACTIVEからREGULARへ更新し、実装のCustomerStatus::REGULARと説明を一致させてください。

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.

[4.4] deprecation ゲート有効化+非推奨 public API の削除

1 participant