Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drop doctrine annotations#424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
norkunas wants to merge1 commit intomeilisearch:main
base:main
Choose a base branch
Loading
fromnorkunas:drop-doctrine-annotations

Conversation

@norkunas
Copy link
Collaborator

@norkunasnorkunas commentedDec 17, 2025
edited by coderabbitaibot
Loading

Pull Request

Related issue

Fixes #<issue_number>

What does this PR do?

  • Drops doctrine annotations

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • Refactor

    • Modernized entity metadata to PHP 8 attribute-based mappings across test entities for cleaner metadata handling.
    • Updated serializer import usage to the attribute-based form.
  • Chores

    • Added an entry to .gitignore to exclude a configuration reference file.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitaibot commentedDec 17, 2025
edited
Loading

Walkthrough

Migrated Doctrine ORM and Symfony Serializer metadata from PHPDoc docblocks to PHP 8 attributes across test entities; updated serializer import paths forGroups where needed. Also added/config/reference.php to.gitignore. No public API or runtime behavior changes.

Changes

Cohort / File(s)Summary
Configuration
/.gitignore
Added ignore entry for/config/reference.php.
Class-level annotation removals / attribute-only entities
tests/Entity/Article.php,tests/Entity/Car.php,tests/Entity/ContentAggregator.php,tests/Entity/EmptyAggregator.php,tests/Entity/Podcast.php
Removed PHPDoc@ORM\Entity blocks; entities now rely on existing or added#[ORM\Entity] attributes only.
Class + property ORM attribute migrations
tests/Entity/Image.php,tests/Entity/Tag.php,tests/Entity/DynamicSettings.php,tests/Entity/ContentItem.php
Replaced property-level docblock ORM annotations (Id, GeneratedValue, Column, discriminator, etc.) with PHP 8 attributes usingTypes::... constants where applicable.
ORM relationships & discriminator migrations
tests/Entity/Link.php,tests/Entity/ContentItem.php
Converted relationship and inheritance/discriminator docblock annotations to PHP 8 attributes (ManyToOne, OneToMany, JoinColumn, discriminator column/map).
ORM + Serializer Groups migration
tests/Entity/Comment.php,tests/Entity/DummyCustomGroups.php,tests/Entity/Page.php,tests/Entity/Post.php
SwitchedGroups import fromSymfony\Component\Serializer\Annotation\Groups toSymfony\Component\Serializer\Attribute\Groups; migrated class- and property-level ORM andGroups annotations to attributes.
Docblock removal while retaining attributes
tests/Entity/SelfNormalizable.php,tests/Entity/EmptyAggregator.php
Removed legacy docblock annotations while keeping PHP 8 attribute mappings; no signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review focus:
    • EnsureTypes::... constants match previous string types.
    • Verify relationship attributes preserve options (inversedBy, cascade, orphanRemoval, OrderBy).
    • Confirm allGroups imports changed to the Attribute namespace and no annotation imports remain.
    • Spot-check a few entities for accidental signature/type changes.

Suggested labels

enhancement

Suggested reviewers

  • Strift

Poem

🐇 I hopped through comments, whisked docblocks away,

Switched old annotations to attributes today.
Types and Groups now wear PHP‑8 hats,
Clean metadata — no more scattered stats.
A little rabbit cheer for a tidy codebay! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run@coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'Drop doctrine annotations' accurately and concisely describes the primary change across all modified files—migrating from PHPDoc Doctrine annotations to PHP 8 attributes for ORM mapping.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweenc158a81 andca49d9a.

📒 Files selected for processing (16)
  • .gitignore (1 hunks)
  • tests/Entity/Article.php (0 hunks)
  • tests/Entity/Car.php (0 hunks)
  • tests/Entity/Comment.php (1 hunks)
  • tests/Entity/ContentAggregator.php (0 hunks)
  • tests/Entity/ContentItem.php (0 hunks)
  • tests/Entity/DummyCustomGroups.php (1 hunks)
  • tests/Entity/DynamicSettings.php (0 hunks)
  • tests/Entity/EmptyAggregator.php (0 hunks)
  • tests/Entity/Image.php (0 hunks)
  • tests/Entity/Link.php (0 hunks)
  • tests/Entity/Page.php (1 hunks)
  • tests/Entity/Podcast.php (0 hunks)
  • tests/Entity/Post.php (3 hunks)
  • tests/Entity/SelfNormalizable.php (0 hunks)
  • tests/Entity/Tag.php (0 hunks)
💤 Files with no reviewable changes (11)
  • tests/Entity/ContentItem.php
  • tests/Entity/Article.php
  • tests/Entity/Podcast.php
  • tests/Entity/Tag.php
  • tests/Entity/ContentAggregator.php
  • tests/Entity/Car.php
  • tests/Entity/SelfNormalizable.php
  • tests/Entity/DynamicSettings.php
  • tests/Entity/Link.php
  • tests/Entity/EmptyAggregator.php
  • tests/Entity/Image.php
🚧 Files skipped from review as they are similar to previous changes (4)
  • .gitignore
  • tests/Entity/DummyCustomGroups.php
  • tests/Entity/Page.php
  • tests/Entity/Comment.php
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-15T19:07:07.476Z
Learnt from: norkunasRepo: meilisearch/meilisearch-symfony PR: 410File: src/Identifier/DefaultIdNormalizer.php:18-22Timestamp: 2025-12-15T19:07:07.476ZLearning: In PHP projects (Symfony style), avoid importing global PHP classes (e.g., \InvalidArgumentException, \LogicException) via use statements inside namespaces. Instead, reference them with a leading backslash (fully qualified name) when used, e.g. \InvalidArgumentException $e = new \InvalidArgumentException('msg'); This preserves clarity about the global namespace and follows Symfony coding conventions for global classes.

Applied to files:

  • tests/Entity/Post.php
🔇 Additional comments (3)
tests/Entity/Post.php (3)

11-11:LGTM! Correct import for PHP 8 attributes.

The import path change fromAnnotation\Groups toAttribute\Groups correctly reflects the migration to PHP 8 attributes for Symfony Serializer.


13-41:LGTM! Clean migration to PHP 8 attributes.

The class-level and property-level attributes are correctly applied:

  • ORM entity and table mappings are accurate
  • Column types and nullability constraints align with property declarations
  • The OneToMany relationship configuration is correct
  • Serializer groups are consistently applied
  • Retaining the docblock on line 35-37 for IDE type hints is good practice

61-61:LGTM! Serializer attributes correctly applied to methods.

The#[Groups('searchable')] attributes on getter methods are properly placed and consistent with the property-level serialization configuration.

Also applies to: 72-72


Thanks for usingCodeRabbit! 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.

@norkunasnorkunas marked this pull request as ready for reviewDecember 17, 2025 12:51
@codecov
Copy link

codecovbot commentedDec 17, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.38%. Comparing base (483bd19) to head (ca49d9a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@##             main     #424   +/-   ##=======================================  Coverage   72.38%   72.38%           =======================================  Files          28       28             Lines        1224     1224           =======================================  Hits          886      886             Misses        338      338

☔ 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.

Copy link

@coderabbitaicoderabbitaibot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/Entity/Post.php (2)

62-63:Incomplete migration: Replace docblock annotation with attribute.

The@Groups annotation in the docblock should be replaced with the PHP 8 attribute to complete the migration.

Apply this diff:

-    /**-     * @Groups({"searchable"})-     */+    #[Groups('searchable')]     public function getTitle(): ?string

75-76:Incomplete migration: Replace docblock annotation with attribute.

The@Groups annotation in the docblock should be replaced with the PHP 8 attribute to complete the migration.

Apply this diff:

-    /**-     * @Groups({"searchable"})-     */+    #[Groups('searchable')]     public function getPublishedAt(): \DateTimeImmutable
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between5b6d13b andc158a81.

📒 Files selected for processing (16)
  • .gitignore (1 hunks)
  • tests/Entity/Article.php (0 hunks)
  • tests/Entity/Car.php (0 hunks)
  • tests/Entity/Comment.php (1 hunks)
  • tests/Entity/ContentAggregator.php (0 hunks)
  • tests/Entity/ContentItem.php (0 hunks)
  • tests/Entity/DummyCustomGroups.php (1 hunks)
  • tests/Entity/DynamicSettings.php (0 hunks)
  • tests/Entity/EmptyAggregator.php (0 hunks)
  • tests/Entity/Image.php (0 hunks)
  • tests/Entity/Link.php (0 hunks)
  • tests/Entity/Page.php (1 hunks)
  • tests/Entity/Podcast.php (0 hunks)
  • tests/Entity/Post.php (1 hunks)
  • tests/Entity/SelfNormalizable.php (0 hunks)
  • tests/Entity/Tag.php (0 hunks)
💤 Files with no reviewable changes (11)
  • tests/Entity/Podcast.php
  • tests/Entity/Car.php
  • tests/Entity/ContentAggregator.php
  • tests/Entity/SelfNormalizable.php
  • tests/Entity/Article.php
  • tests/Entity/ContentItem.php
  • tests/Entity/Tag.php
  • tests/Entity/Link.php
  • tests/Entity/EmptyAggregator.php
  • tests/Entity/DynamicSettings.php
  • tests/Entity/Image.php
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-15T19:07:07.476Z
Learnt from: norkunasRepo: meilisearch/meilisearch-symfony PR: 410File: src/Identifier/DefaultIdNormalizer.php:18-22Timestamp: 2025-12-15T19:07:07.476ZLearning: In PHP projects (Symfony style), avoid importing global PHP classes (e.g., \InvalidArgumentException, \LogicException) via use statements inside namespaces. Instead, reference them with a leading backslash (fully qualified name) when used, e.g. \InvalidArgumentException $e = new \InvalidArgumentException('msg'); This preserves clarity about the global namespace and follows Symfony coding conventions for global classes.

Applied to files:

  • tests/Entity/Page.php
  • tests/Entity/DummyCustomGroups.php
  • tests/Entity/Post.php
  • tests/Entity/Comment.php
🔇 Additional comments (5)
.gitignore (1)

7-7:Good housekeeping—ignoring generated/temporary reference file.

The addition of/config/reference.php to.gitignore follows Git conventions and is logically placed within the configuration section. This appears to be a generated or temporary file that should not be version-controlled as part of the annotation migration.

tests/Entity/Page.php (1)

10-10:LGTM! Clean migration to PHP 8 attributes.

The serializer Groups import and usage have been correctly migrated from annotation to attribute namespace. The attribute syntax is properly applied to the properties.

Also applies to: 22-22, 26-26

tests/Entity/DummyCustomGroups.php (1)

9-9:LGTM! Migration is consistent.

The Groups attribute is correctly applied to all properties with proper import from the Attribute namespace.

Also applies to: 16-16, 20-20, 24-24

tests/Entity/Comment.php (1)

9-9:LGTM! Attribute migration completed correctly.

The serializer Groups have been consistently migrated to PHP 8 attributes across all properties.

Also applies to: 18-18, 26-26, 30-30

tests/Entity/Post.php (1)

11-11:Property migrations look good.

The Groups attribute has been correctly applied to all properties with the proper import from the Attribute namespace.

Also applies to: 20-20, 24-24, 28-28, 32-32, 40-40

@norkunasnorkunasforce-pushed thedrop-doctrine-annotations branch fromc158a81 toca49d9aCompareDecember 17, 2025 12:54
@norkunasnorkunas mentioned this pull requestDec 19, 2025
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@StriftStriftAwaiting requested review from Strift

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@norkunas

[8]ページ先頭

©2009-2025 Movatter.jp