Skip to content

refactor: DECIMAL型プロパティを?stringに統一し、PHPStan Doctrine統合を追加#6572

Open
nanasess wants to merge 2 commits intoEC-CUBE:4.3-symfony7from
nanasess:refactor/decimal-nullable-string
Open

refactor: DECIMAL型プロパティを?stringに統一し、PHPStan Doctrine統合を追加#6572
nanasess wants to merge 2 commits intoEC-CUBE:4.3-symfony7from
nanasess:refactor/decimal-nullable-string

Conversation

@nanasess
Copy link
Contributor

@nanasess nanasess commented Jan 15, 2026

概要

DECIMAL型プロパティの型宣言を?stringに統一し、PHPStan Doctrine統合を追加しました。

変更内容

Entity修正

  • Order.php: subtotal, discount, delivery_fee_total, charge, tax, total, payment_total を ?string に統一
  • OrderItem.php: quantity, tax, tax_rate, tax_adjust を ?string に統一
  • Doctrine統合により不要になった @phpstan-ignore コメントを削除(30ファイル)

PHPStan設定

  • phpstan-doctrine および phpstan-extension-installer を追加
  • tests/object-manager.php を作成(Doctrine統合用)
  • phpstan.neon.dist にDoctrine統合設定を追加

その他の修正

  • Cart.php: $errorsプロパティに@phpstan-ignoreコメント追加
  • DeliveryFee.php, LoginHistory.php: doctrine.associationTypeエラー対応
  • OrderStatusRepository.php: findNotContainsBy()の戻り値型を修正
  • OrderItemCollection.php: @templateアノテーション追加

目的

  • Symfony Formのバリデーション処理でnullが設定される可能性があるため、全てのDECIMAL型プロパティをnullable(?string)で統一
  • PHPStan Doctrine統合により、Entityの型検査をより正確に実行
  • 不要な@phpstan-ignoreコメントを削除してコードをクリーンに

変更ファイル数

38ファイル (+181行, -52行)

テスト計画

  • PHPStan静的解析でエラーなし
  • 既存のPHPUnitテストが全てパス

🤖 Generated with Claude Code

nanasess and others added 2 commits January 15, 2026 15:20
## Entity修正
- Order.php: subtotal, discount, delivery_fee_total, charge, tax, total, payment_total を ?string に統一
- OrderItem.php: quantity, tax, tax_rate, tax_adjust を ?string に統一
- Doctrine統合により不要になった phpstan-ignore コメントを削除

## PHPStan設定
- phpstan-doctrine および phpstan-extension-installer を追加
- tests/object-manager.php を作成(Doctrine統合用)
- phpstan.neon.dist にDoctrine統合設定を追加

## その他の修正
- Cart.php: $errorsプロパティにphpstan-ignoreコメント追加
- DeliveryFee.php, LoginHistory.php: doctrine.associationTypeエラー対応
- OrderStatusRepository.php: findNotContainsBy()の戻り値型を修正
- OrderItemCollection.php: @templateアノテーション追加

Symfony Formのバリデーション処理でnullが設定される可能性があるため、
全てのDECIMAL型プロパティをnullable(?string)で統一。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- OrderItem::getPriceIncTax()でtaxプロパティをstringにキャスト
- PurchaseFlowのreduce()で$sumの不要なキャストを削除(初期値'0'から常にstring)
- OrderStatusRepositoryのPHPDoc戻り値型をFQCNから短縮形に修正

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.33%. Comparing base (3c4c246) to head (47ae353).
⚠️ Report is 1 commits behind head on 4.3-symfony7.

Additional details and impacted files
@@              Coverage Diff              @@
##           4.3-symfony7    #6572   +/-   ##
=============================================
  Coverage         82.33%   82.33%           
=============================================
  Files               482      482           
  Lines             25691    25691           
=============================================
  Hits              21152    21152           
  Misses             4539     4539           
Flag Coverage Δ
E2E 82.33% <100.00%> (ø)
Unit 82.33% <100.00%> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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 added this to the 4.4.0 milestone Mar 16, 2026
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