Updated dev tooling to the latest PHP 8.3-compatible versions and migrated tests to PHPUnit 12. - #125
Conversation
Bumped 'phpunit/phpunit' to ^12.5.32 (13.x requires PHP 8.4, above the library's >=8.3 floor), 'drevops/phpcs-standard' to ^1.0.0 and 'rector/rector' to ^2.5.7. Capped 'phpstan/phpstan' below 2.2.6: that release changed a PHPStan RichParser internal that 'rector/rector' 2.5.7 reads via reflection, crashing the lint step. composer.lock is not committed, so CI re-resolves to the newest allowed release on every run, and the ceiling keeps the static-analysis tooling working together.
📝 WalkthroughWalkthroughDevelopment tool constraints in ChangesDevelopment Tooling Updates
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
🚀 Deployed on https://6a66ab25a69438529115e502--tui-docs.netlify.app |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@composer.json`:
- Line 32: Align the PHPUnit configuration with the upgraded dependency by
updating the schema reference in phpunit.xml from PHPUnit 11.4 to 12.5 and
changing rector.php to use PHPUnitSetList::PHPUNIT_120 instead of
PHPUnitSetList::PHPUNIT_110.
- Line 26: Update the PHPUnit configuration and Rector setup to match the
PHPUnit 12.5 dependency: change the schema reference in phpunit.xml from 11.4 to
the PHPUnit 12 schema and replace PHPUnitSetList::PHPUNIT_110 in rector.php with
the PHPUnit 12 equivalent, or use Rector’s composer-based PHPUnit detection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1ba19b48-a2d9-4829-ac36-0593d01488f7
📒 Files selected for processing (1)
composer.json
PHPUnit 12 no longer accepts a trait as a '#[CoversClass]' target and emits a 'not a valid target for code coverage' warning for each one. Because phpunit.xml sets 'failOnWarning', the coverage run ('composer test-coverage', which CI runs) failed once phpunit moved to 12, even though the plain 'composer test' run (no coverage) stayed green. Converted the capability-trait covers in the widget tests to '#[CoversTrait]' and added the matching import, keeping '#[CoversClass]' for the widget and helper classes.
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
==========================================
+ Coverage 98.70% 98.77% +0.07%
==========================================
Files 102 104 +2
Lines 3557 3686 +129
==========================================
+ Hits 3511 3641 +130
+ Misses 46 45 -1 ☔ View full report in Codecov by Harness. |
… 12 upgrade. Pointed 'phpunit.xml' at the 12.5 schema and switched the Rector set from 'PHPUnitSetList::PHPUNIT_110' to 'PHPUNIT_120'. The 120 set introduces no rewrites here, so this is a configuration alignment only.
|
Summary
Updates the four
require-devtooling constraints incomposer.jsonto their latest versions that still support the library's>=8.3PHP floor, and carries the PHPUnit 11 -> 12 major bump through the test suite and the tooling configuration so the whole stack lints and tests cleanly again.phpstan/phpstanis deliberately capped at>=2.2.4 <2.2.6rather than left to float, because 2.2.6 changed an internalPHPStan\Parser\RichParserproperty (container) thatrector/rector2.5.7 reaches into via reflection inPHPStanContainerMemento::removeRichVisitors(). With 2.2.6 installed,rectorfatal-crashes (MissingPrivatePropertyException: Property "$container" was not found in "PHPStan\Parser\RichParser"), which kills thecomposer lintstep. Becausecomposer.lockis gitignored, CI resolves dependencies fresh on every run and always picks the newest allowedphpstan, so this crash is already breakingmain's CI - the most recentTest PHPrun onmainfailed at the "Check coding standards" step with exactly this error. This PR therefore both updates the tooling and fixesmain's currently-red CI; the cap can be lifted oncerectorships a release compatible withphpstan2.2.6.The PHPUnit 12 bump also surfaced coverage-metadata warnings that only appear under
composer test-coverage(which CI runs), notcomposer test: PHPUnit 12 no longer accepts a trait as a#[CoversClass]target, andphpunit.xmlsetsfailOnWarning="true", so the coverage run failed for every widget test that declared trait coverage. Those attributes are migrated to#[CoversTrait], and the PHPUnit schema reference and Rector PHPUnit set are aligned with the 12 line.Changes
Dependency updates (
composer.json)phpunit/phpunitfrom^11.5.55to^12.5.32(PHPUnit 13 requires PHP 8.4.1, above this library's PHP 8.3 floor, so 12 is the ceiling).drevops/phpcs-standardfrom^0.7to^1.0.0.rector/rectorfrom^2.5.2to^2.5.7.phpstan/phpstanfrom^2.2.4to>=2.2.4 <2.2.6, a deliberate ceiling rather than a plain bump, to keeprectorworking (see Summary).PHPUnit 12 test migration (
tests/phpunit/Unit/Widget/*)#[CoversClass(<Trait>::class)]to#[CoversTrait(<Trait>::class)]for the capability traits across nine widget test files, and added theCoversTraitimport where needed.#[CoversClass]is kept for the widget and helper classes. This clears the 207not a valid target for code coveragewarnings that failedcomposer test-coverageunder PHPUnit 12.Configuration alignment
phpunit.xml: pointed the schema reference athttps://schema.phpunit.de/12.5/phpunit.xsd(was 11.4).rector.php: switched the Rector PHPUnit set fromPHPUnitSetList::PHPUNIT_110toPHPUNIT_120. The 120 set introduces no rewrites in this codebase, so it is a configuration alignment only.Verification
composer lint(PHPCS + PHPStan level 9 + Rector) andcomposer test-coveragepass locally on both the normal and the--prefer-lowest --prefer-stabledependency sets under a PHP 8.3 platform.Before / After
Summary by CodeRabbit