Skip to content

Commit 1b70019

Browse files
committed
[Sets] Deprecate ComposerTriggeredSet in favor of ComposerPackageConstraintInterface
A set triggered on a single major version has to be repeated for every version an upgrade passes through. A rule bonded with ComposerPackageConstraintInterface, added in #7877, states the exact package version its target API is available from and applies from there upwards, so one set covers every upgrade path. rectorphp/rector-symfony#1010 and rectorphp/rector-phpunit#758 moved both extensions over, leaving Twig as the only remaining user. The internal resolving of the class is kept working and ignored in phpstan.neon until that lands too.
1 parent 7ec46de commit 1b70019

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎phpstan.neon‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@ parameters:
317317
message: '#Fetching (deprecated )?class constant (.*?) of (deprecated )?class (Rector\\Set\\ValueObject\\DowngradeLevelSetList|Rector\\Symfony\\Set\\(.*?))#'
318318
path: src/Configuration/RectorConfigBuilder.php
319319

320+
# the deprecated ComposerTriggeredSet is still resolved internally, until every extension bonds its rules
321+
-
322+
message: '#deprecated class Rector\\Set\\ValueObject\\ComposerTriggeredSet#'
323+
paths:
324+
- src/Set/SetManager.php
325+
- src/Bridge/SetProviderCollector.php
326+
- tests/Set/ValueObject/ComposerTriggeredSetTest.php
327+
- tests/Set/SetManager/SetManagerTest.php
328+
320329
# runtime comparison
321330
- '#Comparison operation ".*" between int<\d+, \d+> and \d+ is always true#'
322331

‎src/Set/ValueObject/ComposerTriggeredSet.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
/**
1414
* @api used by extensions
15+
*
16+
* @deprecated Bond the rules themselves instead, by implementing the ComposerPackageConstraintInterface. A set
17+
* triggered on a single major version has to be repeated for every version an upgrade passes through, while a bonded
18+
* rule states the exact package version its target API is available from and applies from there upwards.
19+
*
20+
* @see \Rector\VersionBonding\Contract\ComposerPackageConstraintInterface
21+
*
1522
* @see \Rector\Tests\Set\ValueObject\ComposerTriggeredSetTest
1623
*/
1724
final readonly class ComposerTriggeredSet implements SetInterface

0 commit comments

Comments
 (0)