Skip to content

Register composer-based set in PHPUnitSetProvider - #748

Merged
TomasVotruba merged 1 commit into
mainfrom
register-composer-based-set
Jul 31, 2026
Merged

Register composer-based set in PHPUnitSetProvider#748
TomasVotruba merged 1 commit into
mainfrom
register-composer-based-set

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

withComposerBased(phpunit: true) resolves SetGroup::PHPUNIT through PHPUnitSetProvider, which only lists the per-version upgrade sets. The new composer-based.php set was not among them, so it was only reachable by naming PHPUnitSetList::COMPOSER_BASED explicitly, or indirectly through phpunit110.php and newer.

It is registered now, for any installed PHPUnit version:

// applies to any installed PHPUnit version, the rules and configuration inside are bound
// to the exact version they are available from
new ComposerTriggeredSet(
    SetGroup::PHPUNIT,
    'phpunit/phpunit',
    '>=4.0',
    __DIR__ . '/../../../config/sets/composer-based.php'
),

The set does its own gating - every rule in it declares a ComposerPackageConstraint, and the configuration goes through ruleWithConfigurationComposerVersionBound() - so loading it on any version is safe; nothing inside applies below the version it belongs to.

Verified against this package (PHPUnit ^13.2 installed):

$setManager->matchBySetGroups([SetGroup::PHPUNIT]);

phpunit130.php
composer-based.php

Requires rectorphp/rector-src#8245, which allows a version constraint instead of only a bare major version in ComposerTriggeredSet. composer.json points at that branch so CI can run; to be reverted to dev-main once it is merged.

@TomasVotruba
TomasVotruba merged commit 1e12013 into main Jul 31, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the register-composer-based-set branch July 31, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant