Skip to content

Use withComposerBased instead of the deprecated SetList#36

Closed
zoglo wants to merge 1 commit intocontao:mainfrom
zoglo:change/with_composer_based
Closed

Use withComposerBased instead of the deprecated SetList#36
zoglo wants to merge 1 commit intocontao:mainfrom
zoglo:change/with_composer_based

Conversation

@zoglo
Copy link
Copy Markdown
Member

@zoglo zoglo commented Nov 27, 2025

Description

Seen that new level sets have been introduced in ccc403a but the usage of SetList is discouraged and deprecated.

Since Rector 2 we can use composer based level set lists: https://getrector.com/blog/introducing-composer-version-based-sets
This PR changes it for the latest change right now making sure that the SetList is dependent on the composer.json.

/cc @aschempp this could be introduced in the other level sets in the future if needed. Wdyt?

@zoglo zoglo requested a review from aschempp November 27, 2025 19:05
@zoglo zoglo self-assigned this Nov 27, 2025
@aschempp
Copy link
Copy Markdown
Member

I don't think these are correct for our use case. It infers the Symfony version from your installed dependencies, which works for a project. But it you apply this to a bundle, you want to use the minimum version of your requirement, not what Composer installed.

@zoglo
Copy link
Copy Markdown
Member Author

zoglo commented Nov 27, 2025

But it you apply this to a bundle, you want to use the minimum version of your requirement

Good point, this feature however would take the lowest version 🤔. The blogpost does explain it pretty good that using specific sets will lead to your refactored base using the updated level sets instead of checking for the composer version instead, be it Symfony ^7.0 but our sets would most likely force it to upgrade to ^7.4 instead (even though the other minors are discouraged to use).

The real benefit comes when using Rector across major versions of Symfony (and kind of minors since ^7.0 will take all level sets right now, forcing your bundle to use 7.4 :) )

@zoglo
Copy link
Copy Markdown
Member Author

zoglo commented Nov 27, 2025

But it you apply this to a bundle, you want to use the minimum version of your requirement, not what Composer installed.

🤔 But you are right on that. For bundles it will be different.

@zoglo
Copy link
Copy Markdown
Member Author

zoglo commented Nov 27, 2025

I think I am gonna test this more with specific versions and requirements first =)

@aschempp
Copy link
Copy Markdown
Member

Contao 5.7 will require Symfony ^7.4 when it is released (as far as I know)

@aschempp aschempp removed their request for review December 23, 2025 08:59
@zoglo zoglo marked this pull request as draft December 23, 2025 23:21
@zoglo zoglo added the help wanted Issues and PRs which are looking for volunteers to complete them. label Dec 23, 2025
@aschempp
Copy link
Copy Markdown
Member

I just had to revert already-active withComposerBased in 75f3a92 because it cased issues in our build tools. Closing this for now, hoping they continue to add level sets to Rector …

@aschempp aschempp closed this Mar 30, 2026
@zoglo zoglo deleted the change/with_composer_based branch March 30, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Issues and PRs which are looking for volunteers to complete them.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants