Skip to content

Conversation

@unicolored
Copy link

@unicolored unicolored commented Dec 13, 2025

  • Switch Dockerfile to PHP 8.4 to test in the latest PHP version (Symfony 8 requires PHP 8.4+).
  • Add symfony "|| ^8.0" in composer.json to upgrade the dependency.
  • Update PHP_VERSION_ID limit to 80100 in one test to fix a breaking error when launching test:unit.
  • Fix use of Groups Annotation to Attribute in some test entities (this resolved 9 errors in test:unit). After the fix: test:unit is successful except 1 skipped (proxy).

Pull Request

Related issue

Fixes #402

What does this PR do?

  • Allows installation of meilisearch/search-bundle in a Symfony 8.0 project by updating dependencies, tests, and annotations to attributes for compatibility.

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?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • Chores

    • Updated container PHP runtime to 8.5 with a default startup command; broadened Symfony compatibility to include v8; removed an unused dev tool, upgraded PHPUnit/tooling, and simplified test scripts.
  • Tests

    • Migrated tests to PHP 8 attribute-based metadata, updated serializer attribute usage, adjusted test discovery and coverage settings, and removed static-analysis bootstrap.
  • CI

    • Expanded CI matrices to include additional Symfony versions and added exclusion rules.
  • Documentation

    • Raised README minimums: PHP 8.1+ and Symfony 6.4+.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

Bumps PHP base image to php:8.5-fpm; extends Symfony/composer constraints to include ^8.0 and updates dev/test tooling to PHPUnit 10; migrates serializer Groups imports to attribute namespace in tests; removes Doctrine auto_mapping / EntityValueResolver test wiring; expands CI matrices for Symfony 7.4/8.0; adjusts phpunit/phpstan configs and README requirements.

Changes

Cohort / File(s) Summary
Docker configuration
Dockerfile
Base image changed from php:8.0-fpmphp:8.5-fpm; apt-install formatting adjusted; added CMD ["php-fpm"].
Composer & scripts
composer.json
Broadened Symfony runtime/dev constraints to include ^8.0; updated dev packages (added/updated PHPUnit 10 and php-code-coverage ^10.1); removed phpmd/phpmd; updated scripts to call phpunit and removed phpmd script.
Serializer attribute imports (tests)
tests/Entity/Comment.php, tests/Entity/DummyCustomGroups.php, tests/Entity/Page.php, tests/Entity/Post.php
Replaced Symfony\Component\Serializer\Annotation\Groups imports with Symfony\Component\Serializer\Attribute\Groups.
PHPUnit config
phpunit.xml.dist
Removed convertDeprecationsToExceptions attribute; replaced <coverage> wrapper with <source>; updated SYMFONY_PHPUNIT_VERSION to 10.5; changed testsuite file suffix filters to Test.php; added new display/fail attributes on the root phpunit element.
Tests (PHPUnit attributes)
tests/Integration/Command/MeilisearchCreateCommandTest.php, tests/Unit/ConfigurationTest.php
Migrated docblock data providers to PHP 8 attributes (#[TestWith], #[DataProvider]) and added corresponding PHPUnit attribute imports.
Doctrine/test entity metadata
tests/Entity/ContentAggregator.php, tests/Entity/EmptyAggregator.php
Removed Doctrine ORM mapping imports and @ORM\Entity / #[ORM\Entity] annotations/attributes.
Kernel / Doctrine wiring (tests)
tests/Kernel.php, tests/config/doctrine*.yaml
Removed conditional EntityValueResolver import/logic in Kernel and removed explicit auto_mapping: true from doctrine test configs.
CI workflows
.github/workflows/pre-release-tests.yml, .github/workflows/tests.yml
Added Symfony 7.4 and 8.0 to matrices; added exclusion rules for specific PHP/Symfony combinations; mirrored exclusions across related workflows; removed simple-phpunit --version emission in PHPStan job.
Static analysis
phpstan.dist.neon
Removed bootstrapFiles / vendor autoload bootstrap from PHPStan config.
Documentation
README.md
Updated requirements: PHP minimum 8.1+; Symfony compatibility 6.4+.
Test baseline
tests/baseline-ignore
Removed baseline-ignore file containing test deprecation/warning suppression patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention areas:
    • composer.json Symfony ^8 support and PHPUnit 10 compatibility.
    • phpunit.xml.dist new attributes, coverage/source changes, and testsuite filters.
    • CI matrix expansions and exclusion correctness across workflows.
    • Removal of Doctrine auto_mapping and EntityValueResolver wiring in tests and Kernel.
    • PHPStan bootstrap removal and potential autoloading/static-analysis implications.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • curquiza

Poem

🐰 I hopped to eight-point-five with a twitch and a grin,

Attributes now sparkle where old annotations had been.
Composer doors opened so Symfony eight may play,
CI learned new steps and phpunit found its way.
Little carrot clap — tests run, let's hop away!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for Symfony 8' directly and clearly summarizes the main objective of the pull request, which is to add Symfony 8 compatibility to the meilisearch-symfony project.
Linked Issues check ✅ Passed The pull request addresses issue #402 by implementing Symfony 8 support through updated dependencies, PHP 8.4 Docker image, PHPUnit 10 migration, and conversion of annotations to PHP attributes, fulfilling the core coding requirements.
Out of Scope Changes check ✅ Passed All changes are within scope: Dockerfile/PHP version updates, composer.json Symfony 8 support, test entity annotation migrations, PHPUnit tooling upgrades, workflow matrix expansions, and baseline ignore file removal are all directly related to Symfony 8 compatibility.
✨ Finishing touches
🧪 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 ce065f5 and 7147226.

📒 Files selected for processing (1)
  • tests/baseline-ignore (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/baseline-ignore

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.

@unicolored
Copy link
Author

@coderabbitai generate docstrings

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Caution

Docstrings generation - FAILED

No docstrings were generated.

@unicolored
Copy link
Author

I updated composer.json to drop support for symfony 5.4 and php =< 8.1 as proposed here #402 (comment)

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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20ffbb5 and 574843b.

📒 Files selected for processing (1)
  • composer.json (2 hunks)
🔇 Additional comments (1)
composer.json (1)

25-31: Symfony 8 support is available and stable.

All listed Symfony packages now have 8.0 releases on Packagist and can be reliably included in dependencies. The addition of || ^8.0 to these core components aligns with current package availability. Note that internal package dependencies may use ^7.4|^8.0 constraints rather than the broader ^6.0 || ^7.0 || ^8.0 shown here, which is acceptable for supporting the 8.0 release cycle while maintaining compatibility.

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: 1

🧹 Nitpick comments (2)
composer.json (2)

21-21: Redundant PHP version constraint.

The constraint ^8.2 || ^8.4 is redundant—^8.2 already includes 8.2.x, 8.3.x, 8.4.x, and beyond. The || ^8.4 portion is a subset and adds nothing. Consider simplifying to ^8.2.

Note: The previous review suggesting ^8.4 alone would be incorrect here since the bundle still supports Symfony 6/7, which work on PHP 8.2/8.3. Symfony 8's own packages enforce php: ^8.4, so Composer will naturally prevent invalid combinations.

-    "php": "^8.2 || ^8.4",
+    "php": "^8.2",

29-29: Consider removing unnecessary polyfill.

symfony/polyfill-php80 provides backports of PHP 8.0 features for older PHP versions. Since the minimum PHP requirement is now ^8.2, this polyfill is no longer necessary and can be removed.

-    "symfony/polyfill-php80": "^1.27",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 574843b and 25a7446.

📒 Files selected for processing (1)
  • composer.json (2 hunks)
🔇 Additional comments (2)
composer.json (2)

48-54: Symfony 8 support in require-dev looks good.

The symfony/http-client now correctly includes || ^8.0 (addressing the previous review comment), and other Symfony dev dependencies are consistently updated.


25-31: Symfony 8 constraints properly added to require section.

All core Symfony dependencies now include || ^8.0, enabling Symfony 8 compatibility while maintaining support for Symfony 6 and 7.

@norkunas
Copy link
Collaborator

Thanks for your PR. I'd like to merge #410 before doing this, so we'll open additional extension points for those who cannot upgrade yet.
But definitely we'll merge your PR later :)

@norkunas
Copy link
Collaborator

Also please check coderabbit nitpicks, there are good suggestions:)

@norkunas
Copy link
Collaborator

Can you rebase?

- Switch Dockerfile to php 8.4
- Add symfony || ^8.0 to composer.json
- Update PHP_VERSION_ID limit to 80100 into one test to avoid issue
- Fix use of Groups Annotation to Attribute in some tests entities =>
test:unit success except 1 skipped (proxy)
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

♻️ Duplicate comments (1)
composer.json (1)

51-51: Add || ^8.0 constraint to symfony/phpunit-bridge for consistency.

All other Symfony dev dependencies include || ^8.0 support, but symfony/phpunit-bridge remains at ^7.3. For consistency and to ensure compatibility with Symfony 8 projects, update to "symfony/phpunit-bridge": "^7.3 || ^8.0".

Apply this diff:

-    "symfony/phpunit-bridge": "^7.3",
+    "symfony/phpunit-bridge": "^7.3 || ^8.0",
🧹 Nitpick comments (1)
composer.json (1)

28-28: Remove unnecessary polyfill dependency.

The symfony/polyfill-php80 package provides PHP 8.0 features to PHP 7.x projects. Since this project requires PHP ^8.1 (line 21), this polyfill serves no purpose and adds unnecessary overhead.

Apply this diff to remove the unnecessary dependency:

-    "symfony/polyfill-php80": "^1.27",
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25a7446 and 2f5ab86.

📒 Files selected for processing (6)
  • Dockerfile (1 hunks)
  • composer.json (2 hunks)
  • tests/Entity/Comment.php (1 hunks)
  • tests/Entity/DummyCustomGroups.php (1 hunks)
  • tests/Entity/Page.php (1 hunks)
  • tests/Entity/Post.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/Entity/Page.php
  • tests/Entity/Comment.php
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
📚 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
  • tests/Entity/DummyCustomGroups.php
📚 Learning: 2025-12-15T19:07:18.247Z
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 410
File: src/Identifier/DefaultIdNormalizer.php:18-22
Timestamp: 2025-12-15T19:07:18.247Z
Learning: In the meilisearch-symfony project, global PHP classes (like \InvalidArgumentException, \LogicException, etc.) should not be imported via use statements. Instead, use the fully qualified class name with a leading backslash, following Symfony coding standards.

Applied to files:

  • composer.json
🔇 Additional comments (5)
tests/Entity/DummyCustomGroups.php (1)

9-9: LGTM: Correct migration to attribute-based Groups.

The change from Annotation\Groups to Attribute\Groups aligns with PHP 8+ attribute support and Symfony Serializer 6+ conventions.

Dockerfile (1)

1-1: LGTM: PHP 8.4 base image supports latest features.

Upgrading to php:8.4-fpm enables testing with the latest PHP version and supports the attribute-based syntax used throughout the test entities.

tests/Entity/Post.php (1)

11-11: LGTM: Consistent attribute-based migration.

The import change to Attribute\Groups is consistent with the other test entities and follows PHP 8+ conventions.

composer.json (2)

24-30: LGTM: Symfony 8 support correctly added.

The addition of || ^8.0 constraints to Symfony runtime dependencies enables proper Symfony 8 compatibility.


47-50: LGTM: Dev dependencies updated for Symfony 8 compatibility.

The addition of || ^8.0 constraints to symfony/doctrine-bridge, symfony/filesystem, symfony/framework-bundle, symfony/http-client, symfony/yaml, and symfony/var-exporter enables proper Symfony 8 development environment support.

Also applies to: 52-53

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
+ Coverage   72.38%   72.39%   +0.01%     
==========================================
  Files          28       28              
  Lines        1224     1239      +15     
==========================================
+ Hits          886      897      +11     
- Misses        338      342       +4     

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

@unicolored
Copy link
Author

Can you rebase?

Done! Thanks for your comments.

test:unit results:

There was 1 skipped test:

1) Meilisearch\Bundle\Tests\Integration\AggregatorTest::testAggregatorProxyClass
Skipping, because proxies are not wrapped anymore with lazy native objects.

OK, but incomplete, skipped, or risky tests!
Tests: 68, Assertions: 132, Skipped: 1.

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: 1

🧹 Nitpick comments (1)
composer.json (1)

28-28: Consider removing the redundant polyfill.

Since the package requires PHP 8.1+ (line 21), all PHP 8.0 features are already available natively. The symfony/polyfill-php80 dependency appears unnecessary. Was this added to address a specific requirement or transitive dependency issue?

If not needed, apply this diff to remove the redundant dependency:

-    "symfony/polyfill-php80": "^1.27",
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f5ab86 and 1fe5283.

📒 Files selected for processing (1)
  • composer.json (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
📚 Learning: 2025-12-15T19:07:18.247Z
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 410
File: src/Identifier/DefaultIdNormalizer.php:18-22
Timestamp: 2025-12-15T19:07:18.247Z
Learning: In the meilisearch-symfony project, global PHP classes (like \InvalidArgumentException, \LogicException, etc.) should not be imported via use statements. Instead, use the fully qualified class name with a leading backslash, following Symfony coding standards.

Applied to files:

  • composer.json
🔇 Additional comments (1)
composer.json (1)

24-30: LGTM! Symfony 8 support added consistently.

All Symfony package constraints have been properly updated to include || ^8.0 support. The version patterns are appropriate, with some packages using more specific minor versions where needed (e.g., symfony/http-client at ^6.4.15 || ^7.1.8 || ^8.0).

Also applies to: 47-53

Copy link
Collaborator

@norkunas norkunas left a comment

Choose a reason for hiding this comment

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

@unicolored you also need to update github workflows to include new symfony versions

Update php requirement

Fix 6.0 to 6.4 for symfony packages
@unicolored unicolored force-pushed the symfony-8-upgrade branch 2 times, most recently from 8ccb0bd to ff66d3b Compare December 17, 2025 11:38
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: 1

♻️ Duplicate comments (1)
.github/workflows/pre-release-tests.yml (1)

43-43: Verify Symfony 8.0 PHP version requirements (consistent with tests.yml).

Similar to the main tests.yml workflow, the exclusions here restrict Symfony 8.0 to PHP 8.4 only. Please confirm the minimum PHP version requirement for Symfony 8.0 to ensure the test matrix is correctly configured.

This concern is identical to the one raised in tests.yml. The web search requested there will verify whether these exclusions are correct.

Also applies to: 54-59

🧹 Nitpick comments (2)
.github/workflows/tests.yml (1)

46-55: Consider adding explicit Symfony 8.0 test combinations.

The include section tests edge cases with 'lowest' and 'highest' dependencies for Symfony 6.4 and 7.3. Consider adding similar combinations for Symfony 8.0 to ensure comprehensive coverage of dependency resolution scenarios.

For example, add these entries:

          - php-version: '8.4'
            sf-version: '8.0'
            dependencies: 'lowest'
          - php-version: '8.4'
            sf-version: '8.0'
            dependencies: 'highest'
.github/workflows/pre-release-tests.yml (1)

60-69: Consider adding explicit Symfony 8.0 test combinations (consistent with tests.yml).

Similar to the main tests.yml workflow, consider adding explicit test combinations for Symfony 8.0 with 'lowest' and 'highest' dependencies to ensure comprehensive coverage.

Add these entries for consistency:

          - php-version: '8.4'
            sf-version: '8.0'
            dependencies: 'lowest'
          - php-version: '8.4'
            sf-version: '8.0'
            dependencies: 'highest'
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe5283 and 8ccb0bd.

📒 Files selected for processing (4)
  • .github/workflows/pre-release-tests.yml (2 hunks)
  • .github/workflows/tests.yml (2 hunks)
  • Dockerfile (1 hunks)
  • composer.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • composer.json
  • Dockerfile
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
🔇 Additional comments (1)
.github/workflows/tests.yml (1)

105-105: Verify Symfony version compatibility for SYMFONY_REQUIRE: 7.4.*

The code-style job references SYMFONY_REQUIRE: 7.4.*. Confirm that this version is available and compatible with current project requirements. If 7.4 does not exist or is not intended, consider using 7.3.*, 8.0.*, or a more flexible constraint.

Remove polyfill-php80

Add missing 7.4
@norkunas
Copy link
Collaborator

Based on the failing CI, you need to also bump matthiasnoback packages versions

@unicolored
Copy link
Author

@norkunas is phpmd still used? it rely on pdepend/pdepend which is not yet ready for php 8.1, which make Tests / integration-tests (PHP 8.4) (Symfony 8.0.*) (pull_request) Failing after 17s.

@norkunas
Copy link
Collaborator

I am not the one who added it. As it blocks us from supporting 8.0 i guess we could remove it. But @Strift needs to approve this move

@unicolored
Copy link
Author

I am not the one who added it. As it blocks us from supporting 8.0 i guess we could remove it. But @Strift needs to approve this move

Ok. I try without phpmd to check it there is more to be done, until an answer.

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 (1)
composer.json (1)

71-71: Remove the orphaned phpmd script.

The phpmd/phpmd dependency was removed from require-dev (as discussed in PR comments to unblock Symfony 8 support), but this script still references ./vendor/bin/phpmd, which will no longer exist. Remove this script entry to maintain consistency.

Apply this diff to remove the script:

   "scripts": {
-    "phpmd": "./vendor/bin/phpmd src text phpmd.xml",
     "phpstan": "./vendor/bin/phpstan",
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56d8352 and 498adce.

📒 Files selected for processing (1)
  • composer.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
📚 Learning: 2025-08-05T04:46:01.119Z
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.

Applied to files:

  • composer.json
🔇 Additional comments (4)
composer.json (4)

24-29: LGTM! Symfony runtime dependencies correctly updated.

All Symfony runtime packages now include ^8.0 support with consistent ^6.4 || ^7.0 || ^8.0 constraints, enabling the bundle to work across Symfony 6.4, 7, and 8.


45-51: LGTM! Symfony dev dependencies correctly updated.

All Symfony dev packages now include ^8.0 support. The version constraints are appropriate and consistent, with symfony/phpunit-bridge correctly starting at ^7.3 (following its own versioning scheme).


34-35: No issues found. Both matthiasnoback/symfony-config-test (^6.1) and matthiasnoback/symfony-dependency-injection-test (^6.2) exist on Packagist and support Symfony 8.x.


44-44: php-code-coverage ^10.0 is compatible with the project's PHP ^8.1 requirement.

The upgrade is compatible with Symfony 7/8 and PHPUnit 10, which the project uses via symfony/phpunit-bridge. No compatibility issues.

@unicolored unicolored force-pushed the symfony-8-upgrade branch 2 times, most recently from c3a385c to 7debade Compare December 17, 2025 18:17
Remove phpmd^2.15 dependency which is not yet compatible with php8.1

Update Requirements section
@norkunas
Copy link
Collaborator

@unicolored i guess you'll have to update phpunit.xml.dist to switch to at least phpunit ^v10, but IIRC you'll need to replace @dataProvider and @testWith with php attributes as annotations are deprecated.
Maybe it's ok the forced version to phpunit-bridge will pick up the most appropriate version now, so please try both solutions

TestWith and DataProvider
@unicolored
Copy link
Author

@unicolored i guess you'll have to update phpunit.xml.dist to switch to at least phpunit ^v10, but IIRC you'll need to replace @dataProvider and @testWith with php attributes as annotations are deprecated. Maybe it's ok the forced version to phpunit-bridge will pick up the most appropriate version now, so please try both solutions

I update to phpunit 10.5 and updates the attributes. My local test:unit is successful, let's see if it works in the matrix.

@unicolored unicolored force-pushed the symfony-8-upgrade branch 2 times, most recently from ef804b2 to 9c88521 Compare December 18, 2025 20:29
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

🧹 Nitpick comments (3)
phpunit.xml.dist (1)

20-23: Good improvement to test discovery specificity.

The change from suffix=".php" to suffix="Test.php" is a best practice that ensures only actual test files are discovered and executed. This prevents accidentally running helper files or other PHP files in the test directories.

Based on the PR context showing 68 tests running successfully, test discovery is working correctly with the new suffix.

.github/workflows/tests.yml (1)

29-29: Symfony 7.4 LTS is missing from the test matrix.

Per the earlier discussion, Symfony 7.4 is an LTS release and should be included in the matrix. Add '7.4' to the sf-version array and an exclusion for the PHP 8.1 + Symfony 7.4 combination (since 7.4 requires PHP 8.2+).

🔎 Suggested changes:
-        sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3', '8.0' ]
+        sf-version: ['6.4', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]

And add exclusion:

          - php-version: '8.1'
            sf-version: '7.4'
composer.json (1)

50-50: Consider broadening symfony/phpunit-bridge constraint for consistency.

This is the only Symfony dev dependency pinned exclusively to ^8.0, while others allow ^6.4 || ^7.0 || ^8.0. If intentional (e.g., to leverage PHPUnit 10.x features in the bridge), this is fine. Otherwise, consider using ^7.3 || ^8.0 to maintain consistency with the other Symfony dev packages.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef804b2 and 9c88521.

📒 Files selected for processing (3)
  • .github/workflows/tests.yml (3 hunks)
  • composer.json (2 hunks)
  • phpunit.xml.dist (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
📚 Learning: 2025-08-05T04:46:01.119Z
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.

Applied to files:

  • .github/workflows/tests.yml
  • composer.json
🔇 Additional comments (8)
phpunit.xml.dist (2)

4-8: LGTM! Required PHPUnit 10 migration.

The <coverage> element was replaced with <source> in PHPUnit 10. This change is necessary and correctly implemented.


16-16: PHPUnit 10.5 upgrade is properly configured.

The version bump from 9.6 to 10.5 is appropriate for the Symfony 8 upgrade. Verification confirms no deprecated @-style PHPUnit annotations remain in the test suite, and phpunit.xml.dist is correctly configured for PHPUnit 10.5 with valid schema references.

.github/workflows/tests.yml (2)

40-45: Exclusions for Symfony 8.0 are correct.Symfony 8.0 requires PHP 8.4 or higher, so the exclusions for PHP 8.1, 8.2, and 8.3 with Symfony 8.0 are correct.


119-119: LGTM!

The change from simple-phpunit to phpunit aligns with the PHPUnit 10.x upgrade in composer.json.

composer.json (4)

24-29: LGTM!

Broadening Symfony component constraints to include ^8.0 enables installation in Symfony 8 projects while maintaining backward compatibility with 6.4 and 7.x.


44-45: LGTM!

PHPUnit 10.x upgrade aligns with the migration from annotation-based data providers to PHP attributes mentioned in the PR objectives.


73-74: LGTM!

Updating test scripts to use phpunit directly is consistent with the PHPUnit 10.x upgrade and removal of simple-phpunit.


34-35: matthiasnoback packages ^6.x fully support Symfony 6.4.

matthiasnoback/symfony-config-test v6.1.0 requires symfony/config: ^5.4 || ^6.4 || ^7.0 || ^8.0, and matthiasnoback/symfony-dependency-injection-test v6.2.0 requires symfony/config: ^5.4 || ^6.4 || ^7.0 || ^8.0 and symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0 || ^8.0. Both packages explicitly support Symfony 6.4, so the version upgrades are compatible with the bundle's minimum supported version.

simple-phpunit does not work with phpunit 10
phpunit 10 is required by phpunit/php-code-coverage 10.1
php-code-coverage > 10.1 require php >= 8.2
Update suffix to Test.php to avoid warning
Force require phpunit/phpunit 10.5

Remove boostrapFiles used by simple-phpunit
Copy link
Collaborator

@norkunas norkunas left a comment

Choose a reason for hiding this comment

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

almost good :)

Was ran only because in case phpunit was not downloaded
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 (1)
.github/workflows/tests.yml (1)

31-45: Add exclusion for PHP 8.1 + Symfony 7.4.

Symfony 7.4 requires PHP 8.2 or higher, but there's no exclusion for the PHP 8.1 + Symfony 7.4 combination. This will cause CI failures when the matrix attempts to test this incompatible pairing.

🔎 Proposed fix
           - php-version: '8.1'
             sf-version: '7.3'
+          - php-version: '8.1'
+            sf-version: '7.4'
           - php-version: '8.1'
             sf-version: '8.0'
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b76fb29 and 737c0aa.

📒 Files selected for processing (1)
  • .github/workflows/tests.yml (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.
📚 Learning: 2025-08-05T04:46:01.119Z
Learnt from: norkunas
Repo: meilisearch/meilisearch-symfony PR: 391
File: src/Command/MeilisearchImportCommand.php:117-120
Timestamp: 2025-08-05T04:46:01.119Z
Learning: In meilisearch-symfony project, the maintainer norkunas prefers to keep PRs focused and defer error handling improvements for settings updates to separate PRs, particularly when it involves decisions about partial import behavior when some indexes fail.

Applied to files:

  • .github/workflows/tests.yml

composer.json Outdated
Comment on lines 73 to 74
"test:unit": "SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/baseline-ignore' ./vendor/bin/phpunit --colors=always",
"test:unit:coverage": "SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/baseline-ignore' XDEBUG_MODE=coverage ./vendor/bin/phpunit --colors=always --coverage-html=tests/coverage",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think SYMFONY_DEPRECATIONS_HELPER is available only when running through symfony/phpunit-bridge. Or am i wrong? 🤔

Copy link
Author

Choose a reason for hiding this comment

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

It make sense. I do not find "SYMFONY_DEPRECATIONS_HELPER" on phpunit 10 documentation.

Copy link
Author

Choose a reason for hiding this comment

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

idem for "XDEBUG_MODE"

Copy link
Collaborator

Choose a reason for hiding this comment

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

It make sense. I do not find "SYMFONY_DEPRECATIONS_HELPER" on phpunit 10 documentation.

yeah because it was always a symfony feature through phpunit-bridge, i am just wondering if the deprecations will be not swallowed anymore

phpunit.xml.dist Outdated
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
xsi:noNamespaceSchemaLocation="vendor/bin/.phpunit/phpunit/phpunit.xsd">
Copy link
Collaborator

Choose a reason for hiding this comment

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

On my project i am using phpunit v12, but can you check if these are available when running on v10?:

<phpunit
         displayDetailsOnIncompleteTests="true"
         displayDetailsOnPhpunitDeprecations="true"
         displayDetailsOnTestsThatTriggerDeprecations="true"
         displayDetailsOnTestsThatTriggerErrors="true"
         displayDetailsOnTestsThatTriggerNotices="true"
         displayDetailsOnTestsThatTriggerWarnings="true"
         failOnDeprecation="false"
         failOnNotice="true"
         failOnWarning="true"
         failOnRisky="true"
>
<source ignoreSuppressionOfDeprecations="true" ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">

Copy link
Author

Choose a reason for hiding this comment

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

Everything works but:

source
ignoreIndirectDeprecations="true" ❌ not allowed

Now new deprecation raises in test:unit which make tests failed.

PHPUnit 10.5.60 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.15
Configuration: /home/package/phpunit.xml.dist

D...S............................................................ 65 / 68 ( 95%)
...                                                               68 / 68 (100%)

Time: 00:33.419, Memory: 40.50 MB

1 test triggered 1 deprecation:

1) /home/package/vendor/symfony/deprecation-contracts/function.php:25
Since doctrine/doctrine-bundle 3.1: The "auto_mapping" option is deprecated and will be removed in DoctrineBundle 4.0, as it only accepts `false` since 3.0.

Triggered by:

* Meilisearch\Bundle\Tests\Integration\AggregatorTest::testGetEntities (2 times)
  /home/package/tests/Integration/AggregatorTest.php:19

OK, but there were issues!
Tests: 68, Assertions: 132, Deprecations: 1, Skipped: 1.

If I set auto_mapping to false, all tests are failing: Doctrine\ORM\Mapping\MappingException: No identifier/primary key specified for Entity...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well there are two auto_mapping options.
One is under doctrine.orm.auto_mapping path and second one under doctrine.orm.controller_resolver.auto_mapping. Maybe you disabled the first one? :)

Copy link
Author

Choose a reason for hiding this comment

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

I get it and removed it everywhere. It implies to also remove ORM\Entity attribute from the two Aggregator in the entities directory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I did most of work about removing doctrine annotations in #424

Copy link
Author

Choose a reason for hiding this comment

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

I saw that! I leave you the task to rebase and complete? Or not?

@norkunas
Copy link
Collaborator

if baseline-ignore is not needed anymore, it should be removed :)

Copy link
Collaborator

@norkunas norkunas left a comment

Choose a reason for hiding this comment

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

I am approving, but we still need decision from @Strift about phpmd :)

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.

Add support for Symfony 8

2 participants