Skip to content

refactor(entity): DateTime および Collection プロパティにネイティブ型宣言を追加#6569

Open
nanasess wants to merge 3 commits intoEC-CUBE:4.3-symfony7from
nanasess:refactor/entity-type-declarations
Open

refactor(entity): DateTime および Collection プロパティにネイティブ型宣言を追加#6569
nanasess wants to merge 3 commits intoEC-CUBE:4.3-symfony7from
nanasess:refactor/entity-type-declarations

Conversation

@nanasess
Copy link
Copy Markdown
Contributor

概要

Entityファイルの DateTime および Collection プロパティにPHP 8のネイティブ型宣言を追加しました。

変更内容

  • 全ての日付プロパティに nullable DateTime 型宣言 (?\DateTime $property = null) を追加
  • Collection 型宣言を追加(PHPDoc のジェネリクス情報は型推論のため維持)
  • DateTime プロパティの冗長な PHPDoc @var アノテーションを削除

対象ファイル(34ファイル)

主要Entity

  • Order.php, Customer.php, Product.php, Shipping.php, Cart.php

関連Entity

  • ProductClass.php, Member.php, Payment.php, Category.php, Delivery.php

その他Entity

  • AuthorityRole.php, BaseInfo.php, Block.php, Calendar.php, ClassCategory.php, ClassName.php, Csv.php, CustomerAddress.php, CustomerFavoriteProduct.php, DeliveryTime.php, Layout.php, LoginHistory.php, MailHistory.php, MailTemplate.php, News.php, OrderPdf.php, Page.php, Plugin.php, ProductImage.php, ProductStock.php, ProductTag.php, Tag.php, TaxRule.php, Template.php

目的

  • Symfony 7/Doctrine ORM 3.x 互換性の向上
  • Symfony Form の PRE_SET_DATA イベント中の初期化エラー回避
  • Enterprise版との型宣言パターン統一

修正パターン

DateTime型

// Before
/**
 * @var \DateTime
 */
private $create_date;

// After
private ?\DateTime $create_date = null;

Collection型

// Before
/**
 * @var Collection<int, OrderItem>
 */
private $OrderItems;

// After
/**
 * @var Collection<int, OrderItem>
 */
private Collection $OrderItems;

テスト計画

  • PHPStan静的解析でエラーなし(確認済み)
  • php-cs-fixerでスタイル違反なし(確認済み)
  • 既存のPHPUnitテストが全てパス

🤖 Generated with Claude Code

- 全ての日付プロパティに nullable DateTime 型宣言 (?\DateTime $property = null) を追加
- Collection 型宣言を追加(PHPDoc のジェネリクス情報は型推論のため維持)
- DateTime プロパティの冗長な PHPDoc @var アノテーションを削除
- Symfony 7/Doctrine ORM 3.x 互換性の向上
- Symfony Form の PRE_SET_DATA 初期化要件に対応

34個の Entity ファイルに一貫した型宣言パターンを適用。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dotani1111 dotani1111 added this to the 4.4.0 milestone Jan 14, 2026
@dotani1111 dotani1111 added the refactor リファクタリング label Jan 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41fa4e1e-41dd-4cec-9cd7-291a37825ec1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor リファクタリング

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants