Skip to content

Conversation

@norkunas
Copy link
Collaborator

@norkunas norkunas commented Dec 17, 2025

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.

@norkunas norkunas requested a review from Strift December 17, 2025 12:50
@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

Migrated Doctrine ORM and Symfony Serializer metadata from PHPDoc docblocks to PHP 8 attributes across test entities; updated serializer import paths for Groups 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 using Types::... 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
Switched Groups import from Symfony\Component\Serializer\Annotation\Groups to Symfony\Component\Serializer\Attribute\Groups; migrated class- and property-level ORM and Groups 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:
    • Ensure Types::... constants match previous string types.
    • Verify relationship attributes preserve options (inversedBy, cascade, orphanRemoval, OrderBy).
    • Confirm all Groups 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 name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring 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 name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The 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 between c158a81 and ca49d9a.

📒 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: norkunas
Repo: meilisearch/meilisearch-symfony PR: 410
File: src/Identifier/DefaultIdNormalizer.php:18-22
Timestamp: 2025-12-15T19:07:07.476Z
Learning: 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 from Annotation\Groups to Attribute\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 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.

@norkunas norkunas marked this pull request as ready for review December 17, 2025 12:51
@codecov
Copy link

codecov bot commented Dec 17, 2025

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.

@norkunas norkunas enabled auto-merge December 17, 2025 12:53
Copy link

@coderabbitai coderabbitai bot 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 between 5b6d13b and c158a81.

📒 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: norkunas
Repo: meilisearch/meilisearch-symfony PR: 410
File: src/Identifier/DefaultIdNormalizer.php:18-22
Timestamp: 2025-12-15T19:07:07.476Z
Learning: 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

@norkunas norkunas force-pushed the drop-doctrine-annotations branch from c158a81 to ca49d9a Compare December 17, 2025 12:54
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.

1 participant