Skip to content

Conversation

VadymHrechukha
Copy link
Collaborator

@VadymHrechukha VadymHrechukha commented Sep 9, 2025

Summary by CodeRabbit

  • Chores
    • Updated developer environment requirements and upgraded developer tooling.
  • Tests
    • Upgraded test framework to a newer major release to keep tests compatible and reliable.
  • Chores
    • Upgraded static-analysis tooling to a newer major release.

No impact on application features or runtime behavior.

Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Walkthrough

Bumped dev requirements in composer.json: added php ^8.3 and upgraded phpunit/phpunit from ^10.0.0^12.0 and vimeo/psalm from ^5.0^6.13.1. No other files changed.

Changes

Cohort / File(s) Summary
Dev dependency updates
composer.json
Added dev requirement: php^8.3. Updated require-dev entries: phpunit/phpunit^12.0; vimeo/psalm^6.13.1.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • SilverFire

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The current title “HP-2693: Upgrade PHPUnit to v12” clearly conveys the ticket reference along with the main change of bumping PHPUnit to version 12, making it concise, specific, and immediately understandable to reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

Hop hop, I nudge the tree of code,
Bumped tools that help tests cleverly goad.
Composer hums, versions set just right,
My ears twitch—green CI lights in sight.
Carrot cheers for builds that glow! 🐇


📜 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 eef640d and f852866.

📒 Files selected for processing (1)
  • composer.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composer.json
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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

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)

85-98: Minimum-stability=dev without prefer-stable increases solver churn and pulls dev branches.

Given many dev-master hiqdev packages, you may need minimum-stability=dev, but you should still prefer stable to reduce accidental dev-main selections (the root cause here).

Apply:

   "minimum-stability": "dev",
+  "prefer-stable": true,

If feasible long-term, migrate off dev-master constraints to tagged releases and drop minimum-stability entirely. I can help propose a phased plan.

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

79-84: Move tests namespace to autoload-dev to keep prod autoload lean.

Currently tests are included in the main autoload section. Shift them to autoload-dev to avoid exposing test classes in production contexts.

   "autoload": {
     "psr-4": {
       "hiqdev\\php\\billing\\": "src",
-      "hiqdev\\php\\billing\\tests\\": "tests"
     }
   },
+  "autoload-dev": {
+    "psr-4": {
+      "hiqdev\\php\\billing\\tests\\": "tests"
+    }
+  },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e28267a and 8390bc6.

📒 Files selected for processing (1)
  • composer.json (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: behat-tests
composer.json

[error] 1-1: Command: composer install -n failed. Your requirements could not be resolved to an installable set of packages: phpunit/phpunit (^12.0) requires sebastian/diff ^7.0.0, but conflict analysis indicates no installable combination (dev-main).

🪛 GitHub Actions: phpunit-tests
composer.json

[error] 1-1: Command 'composer install -n' failed: Your requirements could not be resolved to an installable set of packages. Root composer.json requires phpunit/phpunit ^12.0 and vimeo/psalm ^5.0; phpunit/phpunit 12.x requires sebastian/diff ^7.0.0, but a conflict with sebastian/diff dev-main prevents installation.

🪛 GitHub Actions: Psalm Static Analysis
composer.json

[error] 1-1: Step 'composer install -n' failed: Your requirements could not be resolved to an installable set of packages. phpunit/phpunit ^12.0 requires sebastian/diff ^7.0.0; conflict with sebastian/diff dev-main (alias) prevents install.

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

55-55: Enable stable dependency resolution and pin sebastian/diff

  • In composer.json, add "prefer-stable": true alongside your existing "minimum-stability": "dev"
  • Under "require-dev", insert "sebastian/diff": "^7.0" to satisfy PHPUnit 12’s requirement
  • After updating, run composer install then composer why sebastian/diff to uncover any remaining dev-main pulls and confirm a clean solve

@@ -52,7 +52,7 @@
"require-dev": {
"ext-intl": "*",
"behat/behat": "^3.4.3",
"phpunit/phpunit": "^10.0.0",
"phpunit/phpunit": "^12.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Sanity-check PHPUnit 12 ecosystem constraints before merging.

PHPUnit 12 may raise minimum PHP or sebastian/* requirements compared to v10. Validate your runtime/tooling matrix and deprecations in the test suite (e.g., removed APIs, annotations).


🌐 Web query:

What PHP version and sebastian/* package versions does phpunit/phpunit 12.x require? List notable breaking changes from PHPUnit 11->12.

💡 Result:

Short answer

  • PHP: PHPUnit 12 requires PHP >= 8.3. [1]
  • sebastian/* (representative required versions in PHPUnit 12.x composer):
    • sebastian/cli-parser: ^4.0.0
    • sebastian/comparator: ^7.0.1
    • sebastian/diff: ^7.0.0
    • sebastian/environment: ^8.0.1
    • sebastian/exporter: ^7.0.0
    • sebastian/global-state: ^8.0.0
    • sebastian/object-enumerator: ^7.0.0
    • sebastian/type: ^6.0.2
    • sebastian/version: ^6.0.0
      (See composer.json for full dependency list / exact minor versions.) [2]

Notable breaking changes when upgrading from PHPUnit 11 → 12

  • PHP requirement raised to PHP ≥ 8.3 (you cannot install PHPUnit 12 on older PHP). [1]
  • Annotation (doc‑comment) metadata support removed — migrate all @test, @before, @after, @dataProvider, etc. to PHP attributes. (Annotations were deprecated in PHPUnit 11 and removed in 12.) [1][3]
  • Test‑double API cleanup and removals:
    • Methods for creating mocks/stubs for abstract classes and traits removed (previously deprecated). [1][4]
    • Configuring expectations on objects created with createStub() no longer works (was deprecated earlier). [1][4]
    • TestCase helper methods that returned stub configuration objects (returnValue, returnValueMap, onConsecutiveCalls, returnArgument, returnSelf, returnCallback, etc.) were removed — use the shorthand willReturn/willReturnMap/willReturnCallback/etc. instead. [4]
  • Functionality that was only soft‑deprecated in PHPUnit 11 is hard‑deprecated/removed in 12 — run your suite under PHPUnit 11.5 and fix deprecation warnings before upgrading. [1]

Sources

  1. PHPUnit 12 release announcement / requirements and major changes. [phpunit.de announcement]. [1]
  2. PHPUnit 12.x composer.json dependency snapshot (shows PHP platform and sebastian/* constraints). [composer.json diff / package listing]. [2]
  3. Notes / guidance on removing doc‑comment metadata and migrating to attributes. [community article / PHPUnit docs]. [3]
  4. Issue / PR tracking removal of TestCase return* methods and other test‑double removals. [GitHub issue]. [4]

If you want, I can paste the exact composer.json dependency block for PHPUnit 12.x (or link to the tag) so you can copy the exact constraints.


composer.json (line 55): require PHP ≥ 8.3 and bump sebastian/ deps for PHPUnit 12*
Update the PHP requirement to >=8.3 and set sebastian/cli-parser to ^4.0.0, comparator to ^7.0.1, diff to ^7.0.0, environment to ^8.0.1, exporter to ^7.0.0, global-state to ^8.0.0, object-enumerator to ^7.0.0, type to ^6.0.2, and version to ^6.0.0. Migrate all annotations (@test, @before, @after, @dataProvider, etc.) to PHP 8 attributes and replace removed TestCase stub helpers (returnValue*, returnValueMap, onConsecutiveCalls, returnArgument, returnSelf, returnCallback, etc.) with the willReturn* shorthands. Run your suite under PHPUnit 11.5 to clear deprecation warnings before upgrading.

🤖 Prompt for AI Agents
In composer.json around line 55, update the PHP platform requirement to ">=8.3"
and add explicit version constraints for the sebastian packages required by
PHPUnit 12 (set sebastian/cli-parser to ^4.0.0, sebastian/comparator to ^7.0.1,
sebastian/diff to ^7.0.0, sebastian/environment to ^8.0.1, sebastian/exporter to
^7.0.0, sebastian/global-state to ^8.0.0, sebastian/object-enumerator to ^7.0.0,
sebastian/type to ^6.0.2, and sebastian/version to ^6.0.0); then update test
code by converting PHPUnit annotations (@test, @before, @after, @dataProvider,
etc.) to PHP 8 attributes and replace removed TestCase stub helpers
(returnValue*, returnValueMap, onConsecutiveCalls, returnArgument, returnSelf,
returnCallback, etc.) with the willReturn* shorthands; finally run the test
suite under PHPUnit 11.5, fix any deprecation warnings, then proceed to upgrade
to PHPUnit 12.

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