Skip to content

chore: update deprecated php-cs-fixer rules (visibility_required, @PHP83Migration) #100

Description

@valbeat

概要

.php-cs-fixer.dist.php が現行の php-cs-fixer (3.95.11) で deprecated になったルール名を使っており、composer cs-check / cs-fix 実行時に以下の警告が出ます。次のメジャーリリースで動かなくなるため、後継名へ更新しておくのが望ましいです(現時点では動作影響なし・CI も pass)。

実際の警告出力

Detected deprecations in use (they will stop working in next major release):
- Rule "visibility_required" is deprecated. Use "modifier_keywords" instead.
- Rule set "@PHP83Migration" is deprecated. Use "@PHP8x3Migration" instead.

php-cs-fixer fix --dry-run -vvv で確認)

対応

.php-cs-fixer.dist.php を次のように更新:

  • '@PHP83Migration' => true,'@PHP8x3Migration' => true,
  • 'visibility_required' => ['elements' => ['method', 'property']],'modifier_keywords' => ['elements' => ['method', 'property']],

更新後に composer cs-fix を流し、src/ ・ tests/ に差分が出ないこと(=適用結果が同一であること)を確認する。

補足

  • @PHP8x3Migration は php-cs-fixer 側で「8.3 系」を表す新しい命名。プロジェクトの PHP 要件は ^8.3 なのでこのまま 8.3 系を指定する。
  • 深刻度: 低(動作影響なし、将来のメジャー更新への備え)。

Claude-Session: https://claude.ai/code/session_017XTM7pxbWPVNLV639i5WgK

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions