Skip to content

Conversation

@koriym
Copy link
Member

@koriym koriym commented Nov 9, 2025

Summary

  • Upgrade PHPUnit from ^9.5 to ^11.5
  • Add rector/rector for code quality improvements
  • Modernize phpunit.xml.dist for PHPUnit 10+ compatibility

Changes

Dependencies

  • PHPUnit: ^9.5.28^11.5.43 (requires PHP 8.2+, matches project requirements)
  • Rector: Added ^2.2 for automated code quality improvements

Configuration

Updated phpunit.xml.dist for PHPUnit 10+ compatibility:

  • Moved <include> and <exclude> to <source> element
  • Moved cacheDirectory to <phpunit> root element
  • Removed deprecated processUncoveredFiles attribute

Why This Change?

This fixes the CI failure with readonly class syntax in --prefer-lowest runs. The old PHPUnit 9 pulled in older versions of nikic/php-parser that couldn't parse PHP 8.2's readonly class syntax, causing coverage analysis to fail.

Test Plan

  • ✅ All CI tests passing (PHP 8.2-8.5, Ubuntu/Windows, lowest/highest)
  • ✅ Coding standards passing
  • ✅ Coverage generation working

Related

Resolves the issue discovered in #30 where CI failed after merging due to php-parser version compatibility with readonly class syntax.

Summary by Sourcery

Upgrade PHPUnit to v11.5, update test configuration, and add Rector to improve code quality and resolve CI failures with PHP 8.2 readonly syntax

New Features:

  • Introduce rector/rector for automated code quality improvements

Bug Fixes:

  • Resolve CI failures in lowest dependency runs caused by PHP 8.2 readonly class syntax parsing

Enhancements:

  • Upgrade PHPUnit dependency from ^9.5 to ^11.5
  • Modernize phpunit.xml.dist configuration for PHPUnit 10+ compatibility

Summary by CodeRabbit

  • Chores
    • Upgraded testing framework to PHPUnit 11 and added a new dev tooling dependency for automated refactoring.
  • Tests
    • Simplified and restructured test configuration: explicit source/include/exclude filtering, separated coverage scope, unified cache location, and streamlined test directory entries for clearer test discovery.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Upgrade PHPUnit to ^11.5, introduce Rector for automated code improvements, and modernize phpunit.xml.dist for PHPUnit 10+ compatibility to resolve CI failures with PHP 8.2’s readonly class syntax.

Entity relationship diagram for updated phpunit.xml.dist configuration

erDiagram
  PHPUNIT {
    string cacheDirectory
  }
  SOURCE {
    string include
    string exclude
  }
  PHPUNIT ||--|| SOURCE : contains
Loading

File-Level Changes

Change Details Files
Update project dependencies
  • Bump phpunit/phpunit from ^9.5.28 to ^11.5.43
  • Add rector/rector ^2.2 for automated code quality improvements
composer.json
Modernize PHPUnit configuration
  • Move and into element
  • Relocate cacheDirectory to the root
  • Remove deprecated processUncoveredFiles attribute
phpunit.xml.dist

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Walkthrough

Upgrades PHPUnit from ^9.5.28 to ^11.5.43 and adds rector/rector ^2.2 as a dev dependency. Revises phpunit.xml.dist to separate source inclusion and coverage scope, introduces a top-level cacheDirectory, adds a include/exclude for src/src-deprecated, removes processUncoveredFiles and specific coverage path, and simplifies test-suite directory entries by removing phpVersion qualifiers.

Changes

Cohort / File(s) Summary
Dependency Management
composer.json
Bumped phpunit/phpunit from ^9.5.28 to ^11.5.43; added dev dependency rector/rector ^2.2.
PHPUnit configuration
phpunit.xml.dist
Reworked config: added top-level cacheDirectory (.phpunit.cache); removed explicit code-coverage path and processUncoveredFiles; added <source> with <include> for src and <exclude> for src-deprecated; replaced coverage attributes with an empty <coverage> block; simplified test <directory> entries by removing phpVersion constraints.

Sequence Diagram(s)

(omitted — configuration changes, no runtime control-flow to diagram)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Attention points:
    • Verify PHPUnit 11 compatibility with existing test code and any custom listeners/bootstrap.
    • Confirm Rector ^2.2 rules or config (not included in this diff) align with project expectations.
    • Ensure src-deprecated exclusion and new cacheDirectory do not break CI cache or coverage reporting.

Poem

🐰 I hopped through composer, bumped tests with a grin,

PHPUnit climbed up, and Rector hopped in.
Cache tucked in tidy, sources split with care,
Old deprecated burrows left out in the air.
A tiny rabbit cheers for clearer test lair.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Upgrade to PHPUnit 11' directly and clearly summarizes the main change in the pull request, which is upgrading the PHPUnit dependency from version 9 to 11.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test-readonly-class

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 607fa37 and 4cfc8d2.

📒 Files selected for processing (2)
  • composer.json (1 hunks)
  • phpunit.xml.dist (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composer.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Sourcery review
  • GitHub Check: PHPUnit (windows-latest, 8.4, lowest)
  • GitHub Check: PHPUnit (windows-latest, 8.5, lowest)
  • GitHub Check: PHPUnit (windows-latest, 8.5, highest)
  • GitHub Check: PHPUnit (windows-latest, 8.4, highest)
  • GitHub Check: PHPUnit (windows-latest, 8.3, highest)
  • GitHub Check: PHPUnit (windows-latest, 8.3, lowest)
  • GitHub Check: PHPUnit (windows-latest, 8.2, highest)
  • GitHub Check: PHPUnit (ubuntu-latest, 8.5, highest)
  • GitHub Check: PHPUnit (ubuntu-latest, 8.4, highest)
  • GitHub Check: PHPUnit (ubuntu-latest, 8.3, highest)
  • GitHub Check: PHPUnit (windows-latest, 8.3, lowest)
  • GitHub Check: PHPUnit (windows-latest, 8.4, lowest)
🔇 Additional comments (4)
phpunit.xml.dist (4)

5-5: LGTM: cacheDirectory correctly placed at root level.

The cacheDirectory attribute is now at the <phpunit> root element, which is the correct location for PHPUnit 11.


6-13: LGTM: block correctly structured for PHPUnit 11.

The <source> block with nested <include> and <exclude> elements properly defines the coverage scope. Excluding src-deprecated is a sensible choice.


14-15: LGTM: Empty block uses PHPUnit 11 defaults.

The empty <coverage> element is valid and uses default coverage behavior. Since the PR confirms coverage generation is working, this configuration is sufficient.


19-20: LGTM: Simplified test directory configuration.

Removing the phpVersion qualifiers from test directories simplifies the configuration. Since CI is passing across PHP 8.2–8.5, this confirms the test suites run correctly on all supported versions.


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.

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8aca537) to head (4cfc8d2).
⚠️ Report is 2 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x       #31   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        38        38           
===========================================
  Files             24        24           
  Lines             90        90           
===========================================
  Hits              90        90           

☔ 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

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@koriym
Copy link
Member Author

koriym commented Nov 9, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@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 (1)
phpunit.xml.dist (1)

19-20: Consider removing outdated phpVersion constraints.

The phpVersion="7.4" and phpVersion="8.0.0" constraints are legacy from when this project supported older PHP versions. Since composer.json now requires "php": "^8.2", these constraints are always satisfied and add no value. Consider removing them for clarity.

Apply this diff to simplify:

-      <directory phpVersion="7.4" phpVersionOperator=">=">tests-pecl-ext</directory>
-      <directory phpVersion="8.0.0" phpVersionOperator=">=">tests-php8</directory>
+      <directory>tests-pecl-ext</directory>
+      <directory>tests-php8</directory>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aca537 and 607fa37.

📒 Files selected for processing (2)
  • composer.json (1 hunks)
  • phpunit.xml.dist (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review
🔇 Additional comments (4)
phpunit.xml.dist (3)

4-5: LGTM! Correct PHPUnit 11 configuration.

The cacheDirectory attribute is correctly placed at the root <phpunit> element level, which is the required format for PHPUnit 10+.


6-13: LGTM! Proper modernization for PHPUnit 10+.

The <source> element with nested <include> and <exclude> blocks is the correct structure for PHPUnit 10+. Including src and excluding src-deprecated aligns with the autoload configuration in composer.json.


14-15: LGTM! Valid empty coverage element.

An empty <coverage> element is valid in PHPUnit 11. Coverage options are typically specified via CLI arguments (as seen in the composer scripts).

composer.json (1)

23-24: No issues found. PHPUnit 11.5.43 is the current latest version with no active security advisories.

Verification confirms that 11.5.43 is indeed the current latest release in the 11.x series. The security advisories returned are only for older versions (4.x and 5.x series). The version constraint ^11.5.43 is appropriate and will receive future patch updates within the 11.x line.

Changes:
- Upgrade PHPUnit from ^9.5 to ^11.5
- Add rector/rector ^2.2 for code quality
- Update phpunit.xml.dist for PHPUnit 10+ compatibility:
  - Move include/exclude to <source> element
  - Move cacheDirectory to <phpunit> root element
  - Remove deprecated processUncoveredFiles attribute

PHPUnit 11 requires PHP 8.2+ which matches project requirements.
This also fixes php-parser compatibility with readonly class syntax
in --prefer-lowest CI runs.
@koriym koriym force-pushed the test-readonly-class branch from 607fa37 to 4cfc8d2 Compare November 9, 2025 15:00
@koriym koriym merged commit e910db9 into 1.x Nov 9, 2025
37 checks passed
@koriym koriym deleted the test-readonly-class branch November 9, 2025 15:18
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