Skip to content

chore: rector.php のルール重複登録を解消 - #7028

Open
dotani1111 wants to merge 1 commit into
EC-CUBE:4.4from
dotani1111:fix/rector-duplicate-rule-registration
Open

chore: rector.php のルール重複登録を解消#7028
dotani1111 wants to merge 1 commit into
EC-CUBE:4.4from
dotani1111:fix/rector-duplicate-rule-registration

Conversation

@dotani1111

@dotani1111 dotani1111 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

概要(Overview・Refs Issue)

rector.phpwithRules() に登録している ContainerGetNameToTypeInTestsRector が、有効化済みのセットにも含まれているため、Rector 実行時に重複登録の警告が出ています。

[WARNING] These rules are registered in both sets and "withRules()". Remove
          them from "withRules()" to avoid duplications:
          * Rector\Symfony\Symfony34\Rector\Closure\ContainerGetNameToTypeInTestsRector

withRules() からの登録を削除して警告を解消します。

方針(Policy)

ルール自体は引き続き有効にしたいため、withRules() の登録のみを削除しました。
withRules() に添えていた運用上の注意(クラス名のエイリアスを持たない private サービスは get($serviceId) の形にして変換対象から外す)は、同じルールを指定している withSkip() の箇所へ移しています。

実装に関する補足(Appendix)

vendor/bin/rector list-rules で、削除後も Rector\Symfony\Symfony34\Rector\Closure\ContainerGetNameToTypeInTestsRector が Loaded Rector rules に含まれることを確認しています。
セット側で有効なため、ルールが無効化されることはありません。

テスト(Test)

ローカル(PHP 8.3 / 現在の composer.lock の rector 2.3.9)で以下を実行しています。

  • vendor/bin/rector list-rules: 警告が出ないこと、対象ルールが Loaded Rector rules に残ること
  • vendor/bin/rector process --dry-run: 変更検出なし
  • vendor/bin/php-cs-fixer fix --dry-run: 指摘なし
  • vendor/bin/phpstan analyse src: エラーなし

Rector の設定ファイルのみの変更で、アプリケーションコードには手を入れていません。

相談(Discussion)

特にありません。

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか
    • 権限を超えた操作が可能にならないか
    • 不要なファイルアップロードがないか
    • 外部へ公開されるファイルや機能の追加ではないか
    • テンプレートでのエスケープ漏れがないか

Summary by CodeRabbit

  • リファクタリング

    • テスト関連の静的解析設定を整理しました。
    • サービスID変換時の注意事項と、既存の対象外ケースに関するコメントを追加しました。
    • 購入フロー用テストの既存設定には変更ありません。
  • ユーザーへの影響

    • アプリケーションの機能や表示に変更はありません。

- ContainerGetNameToTypeInTestsRector は有効化済みのセットに含まれており、
  withRules() での再登録が Rector の重複登録警告を発生させていた
- withRules() の登録を削除し、運用上の注意は同ルールを指定している withSkip() へ集約

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 433b0716-bf87-4993-9d5d-451da12f830a

📥 Commits

Reviewing files that changed from the base of the PR and between f8925c0 and 09d2865.

📒 Files selected for processing (1)
  • rector.php
 ________________________________________________________________________________________________________________________
< Don't worry if it doesn't work right. If everything did, you'd be out of a job. - Mosher's Law of Software Engineering >
 ------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ 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.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.15%. Comparing base (f8925c0) to head (09d2865).

Additional details and impacted files
@@            Coverage Diff             @@
##              4.4    #7028      +/-   ##
==========================================
- Coverage   77.18%   77.15%   -0.04%     
==========================================
  Files         564      564              
  Lines       28123    28123              
==========================================
- Hits        21707    21697      -10     
- Misses       6416     6426      +10     
Flag Coverage Δ
Unit 77.15% <ø> (-0.04%) ⬇️

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.

@nanasess nanasess left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

2 participants