Skip to content

[Sets] Remove DoctrineSetProvider, its sets are covered by the composer-based rules - #501

Merged
TomasVotruba merged 2 commits into
mainfrom
ignore-deprecated-set-objects
Aug 5, 2026
Merged

[Sets] Remove DoctrineSetProvider, its sets are covered by the composer-based rules#501
TomasVotruba merged 2 commits into
mainfrom
ignore-deprecated-set-objects

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Aug 5, 2026

Copy link
Copy Markdown
Member

Follows rectorphp/rector-src#8296, which deprecates the set objects in favor of bonding rules with ComposerPackageConstraintInterface, and mirrors what rector-symfony and rector-phpunit already did — the provider goes away instead of being ignored in phpstan.neon.

Every set the provider handed out is already covered by config/sets/composer-based.php, with the same package and the same lowest version the triggered set used:

removed ComposerTriggeredSet covered in composer-based.php by
doctrine/common 2.0 RenameClassRector, >=2.0
doctrine/collection 2.2 CriteriaOrderingConstantsDeprecationRector, doctrine/collections >=2.2
doctrine/doctrine-bundle 2.3 / 2.8 AddAnnotationToRepositoryRector >=2.3, EventSubscriberInterfaceToAttributeRector >=2.8
doctrine/dbal 2.11 / 3.0 / 3.8 / 4.0 / 4.2 rename rules >=2.11, >=3.0, >=4.0, plus MigrateQueryBuilderResetQueryPartRector >=3.8, AddArrayResultColumnNamesRector >=4.2
doctrine/orm 2.5 / 2.13 / 2.14 / 3.0 AddParamTypeDeclarationRector + ArgumentRemoverRector >=2.5, renames >=2.13, ReplaceLifecycleEventArgsByDedicatedEventArgsRector >=2.14, SetParametersArrayToCollectionRector + CastDoctrineExprToStringRector >=3.0
doctrine/data-fixtures 1.6 / 1.7 AddGetReferenceTypeRector >=1.6, AddReturnTypeDeclarationRector >=1.7
doctrine/mongodb-odm 2.16 RenameAttributeRector, >=2.16
the annotation-to-attribute Sets AnnotationToAttributeRector / NestedAnnotationToAttributeRector bound to doctrine/orm >=2.9, doctrine/mongodb-odm >=2.3, doctrine/mongodb-odm-bundle >=4.4, gedmo/doctrine-extensions >=3.5

The version-specific set files stay on disk — DoctrineSetList still points at them as deprecated constants, so anyone listing them by hand keeps working.

What a bonded rule buys over a triggered set

A triggered set only fired on the major version it was registered for, so a project jumping straight from ORM 2.5 to 3.0 had to walk every set in between. The bonded rule states the version its target API arrived in and applies from there upwards:

-new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.14', __DIR__ . '/doctrine-orm-214.php');
+// ReplaceLifecycleEventArgsByDedicatedEventArgsRector
+return new ComposerPackageConstraint('doctrine/orm', '>=2.14');

Needs the matching rector-src change

SetProviderCollector still does new DoctrineSetProvider(), and withComposerBased(doctrine: true) still resolves Doctrine through SetGroup::DOCTRINE. Both have to move in the same release — the collector entry dropped, and the commented-out line filled in:

if ($doctrine) {
    $this->sets[] = DoctrineSetList::COMPOSER_BASED;
}

rectorphp/rector-src#8296 deprecates the set objects in favor of bonding rules with the ComposerPackageConstraintInterface. Doctrine is still resolved through composer-triggered sets, so the provider keeps using them until its rules are bonded.

The entry is not reported when unmatched, so it holds both before and after the deprecation is released.
@TomasVotruba TomasVotruba changed the title [Sets] Ignore the deprecated set objects in DoctrineSetProvider [Sets] Remove DoctrineSetProvider, its sets are covered by the composer-based rules Aug 5, 2026
@TomasVotruba
TomasVotruba merged commit 2bf3418 into main Aug 5, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the ignore-deprecated-set-objects branch August 5, 2026 12:21
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